diff --git a/documentation/Makefile.am b/documentation/Makefile.am
new file mode 100644
index 00000000..e46eef53
--- /dev/null
+++ b/documentation/Makefile.am
@@ -0,0 +1,38 @@
+## $Id$
+## Process this file with automake to produce Makefile.in
+
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2 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
+## General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+## USA
+
+# HTML is not supported by Automake yet, so we have to do some stuff
+# ourselves for now..
+
+targets = server-architecture.html \
+the_chaos_programming_reference_manual.html coding-standards.html \
+filesystem-hierarchy.html a_new_file_system.html
+
+all-local: $(targets)
+
+# SGML files generate multiple output files, so we just clean out
+# every HTML file in this directory.
+
+clean-local:
+ rm -f *.html *~
+
+%.html: %.texi
+ makeinfo --html $<
+
+%.html: %.sgml
+ sgmltools $<
\ No newline at end of file
diff --git a/documentation/Makefile.in b/documentation/Makefile.in
new file mode 100644
index 00000000..5585c10b
--- /dev/null
+++ b/documentation/Makefile.in
@@ -0,0 +1,236 @@
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# HTML is not supported by Automake yet, so we have to do some stuff
+# ourselves for now..
+
+
+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 = :
+CC = @CC@
+CPP = @CPP@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+makeinfo = @makeinfo@
+sgml2html = @sgml2html@
+
+targets = server-architecture.html the_chaos_programming_reference_manual.html coding-standards.html filesystem-hierarchy.html a_new_file_system.html
+
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in \
+install-sh missing mkinstalldirs
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): configure.in
+ cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+tags: TAGS
+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)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ 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: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-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 all-local
+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-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-generic mostlyclean-am clean-local
+
+clean: clean-am
+
+distclean-am: distclean-generic clean-am
+
+distclean: distclean-am
+ -rm -f config.status
+
+maintainer-clean-am: 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: tags distdir info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-local all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+all-local: $(targets)
+
+# SGML files generate multiple output files, so we just clean out
+# every HTML file in this directory.
+
+clean-local:
+ rm -f *.html *~
+
+%.html: %.texi
+ makeinfo --html $<
+
+%.html: %.sgml
+ sgmltools $<
+
+# 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/documentation/a_new_file_system.db-sgml b/documentation/a_new_file_system.db-sgml
new file mode 100644
index 00000000..30eab9b0
--- /dev/null
+++ b/documentation/a_new_file_system.db-sgml
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+A New File System
+
+chaos development, staff@chaosdev.org, with lots of help from Mats
+Giefvert.
+
+$Id$
+
+
+
+
+Differences vs. present-day file systems
+
+
+Present-day file systems are stone-age systems, developed and
+introduced with Unix, that have served their purpose well for a long
+time, but need to be replaced with a new file system that possesses a
+certain number of advantages.
+
+
+
+Some of the design issues where this new file system differs compared
+to the old one are these:
+
+
+
+
+
+
+* File extensions are replaced with objec type ID's. Microsoft Word documents
+are no longer identified by their .doc ending, but rather with a unique type ID.
+Applications registers as type ID handlers.
+* The differences between files and directories are skipped. These old concepts
+are replaced with objects. Objects can contain data, and can also be a container
+of other objects.
+* Applications are self-contained objects that register and unregister
+automatically in a computer system.
+* A hierarchical attribute structure can be applied to objects, allowing an
+efficient document storage and retrieval system.
+
+Each of the differences is explained in detail below.
+
+Object type ID:s
+
+The file extension is skipped. They can be retained if desired to, but
+have no system-wide meaning. Applications or executables are no longer
+marked .exe or with a +x attribute, but rather with an application
+object type which the system knows and treats like
+executables. Documents are identified by their type ID as well;
+applications become handlers of the type ID:s. Whenever a user wished
+to interact with a document, the system starts the registered document
+handler knonw by its type ID.
+
+Objects and containers
+
+Instead of having a sharp distinction between directories and files,
+they are both merged into the concept of objects. Objects contain
+data, other objects, or a combination of both. They can represent
+directories, and they can represent files as well. A directory becomes
+an object with no internal data - a "pure container". A file becomes
+an object that contains no other objects. There can also be
+combinations, where a file contains both internal data and other
+objects as well.
+
+This can be illustrated by the followin practical examples.
+
+A user creates a directory called "Documents". He sees the directory
+as any old operating system would represent it; but behind the scenes,
+what happens is that an object is created with a special type ID
+recognized by the system, called Folder. The system is the handler for
+objects of that type, and knows that folders should not contain any
+data in themselves; they are pure containers and only contain other
+objects. Should the system desire so, however, it will be able to
+place internal data in the object. This allows the system with a
+convenient place to store folder-specific information, like
+appearance, sorting, icons etc.
+
+In this Document folder, he creates a Microsoft Word document. He sees
+it as a plain old document, but the system has behind the scenes
+created yet another document, this time with the Microsoft Word
+Document type ID. This object, like any other object, has the
+capability to contain both data and other objects. It has, therefore,
+the functionality of both a file and a directory. When the user
+double-clicks on the file, Microsoft Word, which is the registered
+document handler, fires up and displays the document on the
+screen. When the user subsequentyl writes text into the document, it
+is stored inside the internal object data. If the user at this time
+wished to drag-and-rop an Excel sheet into the document, the Word
+application would do that happily without any thought about it. Behind
+the scenes, the object would start acting like a directory as well,
+placing either the Excel sheet within the Word object, or a link to
+the Excel sheet, much like you would have placed that document/link
+inside a directory. You would therefore be able to take that object,
+embedded in the Word document, and from the file system viewer itself
+remove it from the Word document and place it as a self-contained
+sheet in the Documents folder without any problem whatsoever.
+
+Let's also look at the concept of an application. An application is
+also an object, completely self-contained, in that all its dependent
+"files" reside inside the application as sub-objects. Therefore, it is
+extremely easy to move an application from one place to another; all
+that the user would have to do is to move the object to a new
+location. The executable code is stored within the object itself; it's
+needed files are stored as embedded objects in that container. Shared
+files, like Dynamic Link Libraries, or Shared Libraries, can be
+represented as links inside of the application object. Instead of
+storing a library as an embedded object file (still fully visible with
+the file system viewer), it could store a link to the library. This
+would allow th euser in no time to decide wether all the required
+libraries were installed on his computer or not. The user would also,
+if such functionality were to be built into the system, be able to
+replace a library inside an application, embedded or linked
+(i.e. static versus shared), at will, and would be able to make an
+application fully self-contained without shared libraries at all.
+
+It is worth noting that links in this content should be a special
+case; not objects, but pointer to objects, much like symbolic links in
+Unix They should be freely movable, and should be able to point to
+nonexisting objects - required in the case where an application
+contains a link to a shared library and the library does not exist;
+but if the user installs the library the link should automatically
+work, since both the library is installed, and the link points to a
+predefined location.
+
+Self-registering applications
+
+The operating system should know automatically which applications are
+installed and thus automatically determine the relationship between
+applications and document ID:s. Suppose, for instance, that a user has
+an object of the Microsoft Project1] type, but unfortunately, he
+doesn't have Microsoft Project installed. He knows, however, that his
+co-worker's computer at the office has Microsoft Project installed. At
+this point, this analogy starts breeaking copyright laws, but let's
+ignore that for the sake for the argument, and if you see any BSA
+agents, please warn me quickly. He goes into his friend's computer,
+and drags the Microsoft Project application object over to his
+Applications folder. As soon as it is copied, the operating system
+realizes that it is, indeed, an application object, and since the
+Applications folder is a place where the system knows active
+applications are stored (this functionaly could be built into the
+Applications folder object's type handler), the system scans the
+Microsoft Project application object and automatically registers it as
+an object type handler for the type ID:s found in the application. The
+user can now, without any further action, use his Microsoft Project
+document object by double-clicking on it. When the BSA sues the
+company a few days later, the system administrator drags the Microsoft
+Project application object into the trashbin, and the operating system
+automatically removes Microsoft Project as the type ID handler for the
+previously installed type ID:s.
+Hierarchical attribute lists
+The normal organization of user documents into directories function
+well, but is sometimes not good enough. The ability to assign a number
+of organizational attributes to a document enables the user to quickly
+store a document and just as quickly locate it a again.
+Let's suppose that the user has a very important document that is
+related to a meeting about a project called "Internet Banking". He
+wishes the document to possess the two attributes Internet Banking and
+Very Important. He couldn't store it in a directory called important
+because it belongs to the Internet Banking project; likewise, he
+couldn't just store it without cretain problems in a directory named
+after the project; because how would he know that that particular
+document was very important? If he wanted a list over very important
+documents, he'd have to go through the entire file system and review
+every document to know it's importance. and what if he simply wanted a
+list over every document that was business-related? All those
+questions rely hevaily on the organization of the directories
+involved; if the directory structure is insufficient, it has to be
+remade later on, with all the hassle it might produce. If the
+situation evolves to include multiple users, the problems have only
+begun.
+The assignment of attributes solves this. Individual files can be
+marked with certain attributes, in order to let the system search for
+them and find them efficiently. The attribbutes themselves would be
+organized hierarchically; that is, the attribute Internet Bankning
+would be located as a sub-attribute of the more general attribute
+Projects, or Business. A simple search for, say, Business, would then
+reveal all documents marked with the attribute Business, or any of
+it's sub-attributes, for instance Internet Banking. The search could
+of course be expaneded; the user might want to search for all Word
+document written in the last five days, that belong to any of the
+business-related projects, except all documents of low importance or
+documents written by Todd, a person at the office which everybody
+hates.
+Additional features...
+There is much to be said about additional features, like roaming
+profiles over networks, private user viewspace, collaboration issues
+with attribute trees and access control lists on all levels. But we
+leave those as an excercise to the reader.
+[1] At this point I must comment on all the Microsoft objects so
+far. I am not endorsing Microsoft products, nor will I ever do so, I'm
+just noticing that there are a lot of Microsoft docuemtns around and I
+figure that they are the most likely document object to be dealt with.
+
+
+
+
+
+
+
+
diff --git a/documentation/a_new_file_system.sgml b/documentation/a_new_file_system.sgml
new file mode 100644
index 00000000..32713c22
--- /dev/null
+++ b/documentation/a_new_file_system.sgml
@@ -0,0 +1,269 @@
+
+
+
+
+
+
+A New File System
+
+ Mats
+ Giefvert
+
+$Id$
+
+
+
+
+Differences vs. present-day file systems
+
+
+Present-day file systems are stone-age systems, developed and
+introduced with Unix, that have served their purpose well for a long
+time, but need to be replaced with a new file system that possesses a
+certain number of advantages.
+
+
+
+Some of the design issues where this new file system differs compared
+to the old one are these:
+
+
+
+
+
+
+
+
+File extensions are replaced with object type
+ID's. Microsoft Word documents are no longer identified by their .doc
+ending, but rather with a unique type ID. Applications registers as
+type ID handlers.
+
+
+
+
+
+The differences between files and directories are
+skipped. These old concepts are replaced with objects. Objects can
+contain data, and can also be a container of other objects.
+
+
+
+
+
+Applications are self-contained objects that register and
+unregister automatically in a computer system.
+
+
+
+
+
+A hierarchical attribute structure can be applied to
+objects, allowing an efficient document storage and retrieval
+system.
+
+
+
+
+
+
+
+Each of the differences is explained in detail below.
+
+
+
+
+Object type ID:s
+
+
+The file extension is skipped. They can be retained if desired to, but
+have no system-wide meaning. Applications or executables are no longer
+marked .exe or with a +x attribute, but rather with an application
+object type which the system knows and treats like
+executables. Documents are identified by their type ID as well;
+applications become handlers of the type ID:s. Whenever a user wished
+to interact with a document, the system starts the registered document
+handler knonw by its type ID.
+
+
+
+
+Objects and containers
+
+
+Instead of having a sharp distinction between directories and files,
+they are both merged into the concept of objects. Objects contain
+data, other objects, or a combination of both. They can represent
+directories, and they can represent files as well. A directory becomes
+an object with no internal data - a "pure container". A file becomes
+an object that contains no other objects. There can also be
+combinations, where a file contains both internal data and other
+objects as well.
+
+
+
+This can be illustrated by the following practical examples.
+
+
+
+A user creates a directory called "Documents". He sees the directory
+as any old operating system would represent it; but behind the scenes,
+what happens is that an object is created with a special type ID
+recognized by the system, called Folder. The system is the handler for
+objects of that type, and knows that folders should not contain any
+data in themselves; they are pure containers and only contain other
+objects. Should the system desire so, however, it will be able to
+place internal data in the object. This allows the system with a
+convenient place to store folder-specific information, like
+appearance, sorting, icons etc.
+
+
+
+In this Document folder, he creates a Microsoft Word document. He sees
+it as a plain old document, but the system has behind the scenes
+created yet another document, this time with the Microsoft Word
+Document type ID. This object, like any other object, has the
+capability to contain both data and other objects. It has, therefore,
+the functionality of both a file and a directory. When the user
+double-clicks on the file, Microsoft Word, which is the registered
+document handler, fires up and displays the document on the
+screen. When the user subsequentyl writes text into the document, it
+is stored inside the internal object data. If the user at this time
+wished to drag-and-rop an Excel sheet into the document, the Word
+application would do that happily without any thought about it. Behind
+the scenes, the object would start acting like a directory as well,
+placing either the Excel sheet within the Word object, or a link to
+the Excel sheet, much like you would have placed that document/link
+inside a directory. You would therefore be able to take that object,
+embedded in the Word document, and from the file system viewer itself
+remove it from the Word document and place it as a self-contained
+sheet in the Documents folder without any problem whatsoever.
+
+
+
+Let's also look at the concept of an application. An application is
+also an object, completely self-contained, in that all its dependent
+"files" reside inside the application as sub-objects. Therefore, it is
+extremely easy to move an application from one place to another; all
+that the user would have to do is to move the object to a new
+location. The executable code is stored within the object itself; it's
+needed files are stored as embedded objects in that container. Shared
+files, like Dynamic Link Libraries, or Shared Libraries, can be
+represented as links inside of the application object. Instead of
+storing a library as an embedded object file (still fully visible with
+the file system viewer), it could store a link to the library. This
+would allow th euser in no time to decide wether all the required
+libraries were installed on his computer or not. The user would also,
+if such functionality were to be built into the system, be able to
+replace a library inside an application, embedded or linked
+(i.e. static versus shared), at will, and would be able to make an
+application fully self-contained without shared libraries at all.
+
+
+
+It is worth noting that links in this content should be a special
+case; not objects, but pointer to objects, much like symbolic links in
+Unix They should be freely movable, and should be able to point to
+nonexisting objects - required in the case where an application
+contains a link to a shared library and the library does not exist;
+but if the user installs the library the link should automatically
+work, since both the library is installed, and the link points to a
+predefined location.
+
+
+
+
+Self-registering applications
+
+
+The operating system should know automatically which applications are
+installed and thus automatically determine the relationship between
+applications and document ID:s. Suppose, for instance, that a user has
+an object of the Microsoft Project[1] type, but unfortunately, he
+doesn't have Microsoft Project installed. He knows, however, that his
+co-worker's computer at the office has Microsoft Project installed. At
+this point, this analogy starts breeaking copyright laws, but let's
+ignore that for the sake for the argument, and if you see any BSA
+agents, please warn me quickly. He goes into his friend's computer,
+and drags the Microsoft Project application object over to his
+Applications folder. As soon as it is copied, the operating system
+realizes that it is, indeed, an application object, and since the
+Applications folder is a place where the system knows active
+applications are stored (this functionaly could be built into the
+Applications folder object's type handler), the system scans the
+Microsoft Project application object and automatically registers it as
+an object type handler for the type ID:s found in the application. The
+user can now, without any further action, use his Microsoft Project
+document object by double-clicking on it. When the BSA sues the
+company a few days later, the system administrator drags the Microsoft
+Project application object into the trashbin, and the operating system
+automatically removes Microsoft Project as the type ID handler for the
+previously installed type ID:s.
+
+
+
+
+Hierarchical attribute lists
+
+
+The normal organization of user documents into directories function
+well, but is sometimes not good enough. The ability to assign a number
+of organizational attributes to a document enables the user to quickly
+store a document and just as quickly locate it a again.
+
+
+
+Let's suppose that the user has a very important document that is
+related to a meeting about a project called "Internet Banking". He
+wishes the document to possess the two attributes Internet Banking and
+Very Important. He couldn't store it in a directory called important
+because it belongs to the Internet Banking project; likewise, he
+couldn't just store it without cretain problems in a directory named
+after the project; because how would he know that that particular
+document was very important? If he wanted a list over very important
+documents, he'd have to go through the entire file system and review
+every document to know it's importance. and what if he simply wanted a
+list over every document that was business-related? All those
+questions rely hevaily on the organization of the directories
+involved; if the directory structure is insufficient, it has to be
+remade later on, with all the hassle it might produce. If the
+situation evolves to include multiple users, the problems have only
+begun.
+
+
+
+The assignment of attributes solves this. Individual files can be
+marked with certain attributes, in order to let the system search for
+them and find them efficiently. The attribbutes themselves would be
+organized hierarchically; that is, the attribute Internet Bankning
+would be located as a sub-attribute of the more general attribute
+Projects, or Business. A simple search for, say, Business, would then
+reveal all documents marked with the attribute Business, or any of
+it's sub-attributes, for instance Internet Banking. The search could
+of course be expaneded; the user might want to search for all Word
+document written in the last five days, that belong to any of the
+business-related projects, except all documents of low importance or
+documents written by Todd, a person at the office which everybody
+hates.
+
+
+
+
+Additional features...
+
+
+There is much to be said about additional features, like roaming
+profiles over networks, private user viewspace, collaboration issues
+with attribute trees and access control lists on all levels. But we
+leave those as an excercise to the reader.
+
+
+
+[1] At this point I must comment on all the Microsoft objects so
+far. I am not endorsing Microsoft products, nor will I ever do so, I'm
+just noticing that there are a lot of Microsoft docuemtns around and I
+figure that they are the most likely document object to be dealt with.
+
+
+
+
\ No newline at end of file
diff --git a/documentation/aclocal.m4 b/documentation/aclocal.m4
new file mode 100644
index 00000000..272381a3
--- /dev/null
+++ b/documentation/aclocal.m4
@@ -0,0 +1,1062 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4-p6
+
+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+# lib-prefix.m4 serial 5 (gettext-0.15)
+dnl Copyright (C) 2001-2005 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 From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+ AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_LIB_ARG_WITH([lib-prefix],
+[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+ --without-lib-prefix don't search for libraries in includedir and libdir],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ if test $use_additional = yes; then
+ dnl Potentially add $additional_includedir to $CPPFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's already present in $CPPFLAGS,
+ dnl 3. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ for x in $CPPFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $CPPFLAGS.
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ dnl Potentially add $additional_libdir to $LDFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's already present in $LDFLAGS,
+ dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ for x in $LDFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux*) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LDFLAGS.
+ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+ dnl Unfortunately, prefix and exec_prefix get only finally determined
+ dnl at the end of configure.
+ if test "X$prefix" = "XNONE"; then
+ acl_final_prefix="$ac_default_prefix"
+ else
+ acl_final_prefix="$prefix"
+ fi
+ if test "X$exec_prefix" = "XNONE"; then
+ acl_final_exec_prefix='${prefix}'
+ else
+ acl_final_exec_prefix="$exec_prefix"
+ fi
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ $1
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
+dnl the basename of the libdir, either "lib" or "lib64".
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+ dnl There is no formal standard regarding lib and lib64. The current
+ dnl practice is that on a system supporting 32-bit and 64-bit instruction
+ dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
+ dnl libraries go under $prefix/lib. We determine the compiler's default
+ dnl mode by looking at the compiler's library search path. If at least
+ dnl of its elements ends in /lib64 or points to a directory whose absolute
+ dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
+ dnl default, namely "lib".
+ acl_libdirstem=lib
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+ if test -n "$searchpath"; then
+ acl_save_IFS="${IFS= }"; IFS=":"
+ for searchdir in $searchpath; do
+ if test -d "$searchdir"; then
+ case "$searchdir" in
+ */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib64 ) acl_libdirstem=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ fi
+])
+
+# lib-link.m4 serial 8 (gettext-0.15)
+dnl Copyright (C) 2001-2006 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 From Bruno Haible.
+
+AC_PREREQ(2.50)
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ define([Name],[translit([$1],[./-], [___])])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+ ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+ ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+ ])
+ LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+ INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+ dnl results of this search when this library appears as a dependency.
+ HAVE_LIB[]NAME=yes
+ undefine([Name])
+ undefine([NAME])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. If found, it
+dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
+dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ define([Name],[translit([$1],[./-], [___])])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+
+ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed lib[]Name and not disabled its use
+ dnl via --without-lib[]Name-prefix, he wants to use it.
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIB[]NAME"
+ AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+ LIBS="$ac_save_LIBS"
+ ])
+ if test "$ac_cv_lib[]Name" = yes; then
+ HAVE_LIB[]NAME=yes
+ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
+ AC_MSG_CHECKING([how to link with lib[]$1])
+ AC_MSG_RESULT([$LIB[]NAME])
+ else
+ HAVE_LIB[]NAME=no
+ dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+ dnl $INC[]NAME either.
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIB[]NAME=
+ LTLIB[]NAME=
+ fi
+ AC_SUBST([HAVE_LIB]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ undefine([Name])
+ undefine([NAME])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
+dnl hardcode_direct, hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+ dnl Tell automake >= 1.10 to complain if config.rpath is missing.
+ m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
+ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
+ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
+ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+ AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+ . ./conftest.sh
+ rm -f ./conftest.sh
+ acl_cv_rpath=done
+ ])
+ wl="$acl_cv_wl"
+ libext="$acl_cv_libext"
+ shlibext="$acl_cv_shlibext"
+ hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+ hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+ hardcode_direct="$acl_cv_hardcode_direct"
+ hardcode_minus_L="$acl_cv_hardcode_minus_L"
+ dnl Determine whether the user wants rpath handling at all.
+ AC_ARG_ENABLE(rpath,
+ [ --disable-rpath do not hardcode runtime library paths],
+ :, enable_rpath=yes)
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_LIB_ARG_WITH([lib$1-prefix],
+[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
+ --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ dnl Search the library and its dependencies in $additional_libdir and
+ dnl $LDFLAGS. Using breadth-first-seach.
+ LIB[]NAME=
+ LTLIB[]NAME=
+ INC[]NAME=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='$1 $2'
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+ dnl or AC_LIB_HAVE_LINKFLAGS call.
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+ else
+ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+ dnl that this library doesn't exist. So just drop it.
+ :
+ fi
+ else
+ dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+ dnl and the already constructed $LIBNAME/$LTLIBNAME.
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ if test $use_additional = yes; then
+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+ found_dir="$additional_libdir"
+ found_so="$additional_libdir/lib$name.$shlibext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ else
+ if test -f "$additional_libdir/lib$name.$libext"; then
+ found_dir="$additional_libdir"
+ found_a="$additional_libdir/lib$name.$libext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+ found_dir="$dir"
+ found_so="$dir/lib$name.$shlibext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ else
+ if test -f "$dir/lib$name.$libext"; then
+ found_dir="$dir"
+ found_a="$dir/lib$name.$libext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ dnl Found the library.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ dnl Linking with a shared library. We attempt to hardcode its
+ dnl directory into the executable's runpath, unless it's the
+ dnl standard /usr/lib.
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
+ dnl No hardcoding is needed.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ dnl The hardcoding into $LIBNAME is system dependent.
+ if test "$hardcode_direct" = yes; then
+ dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+ dnl resulting binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ dnl Rely on "-L$found_dir".
+ dnl But don't add it if it's already contained in the LDFLAGS
+ dnl or the already constructed $LIBNAME
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+ fi
+ if test "$hardcode_minus_L" != no; then
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
+ dnl here, because this doesn't fit in flags passed to the
+ dnl compiler. So give up. No hardcoding. This affects only
+ dnl very old systems.
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ dnl Linking with a static library.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+ else
+ dnl We shouldn't come here, but anyway it's good to have a
+ dnl fallback.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+ fi
+ fi
+ dnl Assume the include files are nearby.
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ dnl Potentially add $additional_includedir to $INCNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 3. if it's already present in $CPPFLAGS or the already
+ dnl constructed $INCNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INC[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $INCNAME.
+ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ dnl Look for dependencies.
+ if test -n "$found_la"; then
+ dnl Read the .la file. It defines the variables
+ dnl dlname, library_names, old_library, dependency_libs, current,
+ dnl age, revision, installed, dlopen, dlpreopen, libdir.
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ dnl We use only dependency_libs.
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 3. if it's already present in $LDFLAGS or the already
+ dnl constructed $LIBNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LIBNAME.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LTLIBNAME.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ dnl Handle this in the next round.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ dnl Handle this in the next round. Throw away the .la's
+ dnl directory; it is already contained in a preceding -L
+ dnl option.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ dnl Most likely an immediate library name.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ dnl Didn't find the library; assume it is in the system directories
+ dnl known to the linker and runtime loader. (All the system
+ dnl directories known to the linker should also be known to the
+ dnl runtime loader, otherwise the system is severely misconfigured.)
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user must
+ dnl pass all path elements in one option. We can arrange that for a
+ dnl single library, but not when more than one $LIBNAMEs are used.
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+ done
+ dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ dnl When using libtool, the option that works for both libraries and
+ dnl executables is -R. The -R options are cumulative.
+ for found_dir in $ltrpathdirs; do
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+ done
+ fi
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+ for element in [$2]; do
+ haveit=
+ for x in $[$1]; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ [$1]="${[$1]}${[$1]:+ }$element"
+ fi
+ done
+])
+
+dnl For those cases where a variable contains several -L and -l options
+dnl referring to unknown libraries and directories, this macro determines the
+dnl necessary additional linker options for the runtime path.
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
+dnl otherwise linking without libtool is assumed.
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+[
+ AC_REQUIRE([AC_LIB_RPATH])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ $1=
+ if test "$enable_rpath" != no; then
+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode directories into the resulting
+ dnl binary.
+ rpathdirs=
+ next=
+ for opt in $2; do
+ if test -n "$next"; then
+ dir="$next"
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next=
+ else
+ case $opt in
+ -L) next=yes ;;
+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next= ;;
+ *) next= ;;
+ esac
+ fi
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n ""$3""; then
+ dnl libtool is used for linking. Use -R options.
+ for dir in $rpathdirs; do
+ $1="${$1}${$1:+ }-R$dir"
+ done
+ else
+ dnl The linker is used for linking directly.
+ if test -n "$hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user
+ dnl must pass all path elements in one option.
+ alldirs=
+ for dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$dir"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="${$1}${$1:+ }$flag"
+ done
+ fi
+ fi
+ fi
+ fi
+ fi
+ AC_SUBST([$1])
+])
+
+# lib-ld.m4 serial 3 (gettext-0.13)
+dnl Copyright (C) 1996-2003 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 Subroutines of libtool.m4,
+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
+dnl with libtool.m4.
+
+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+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(acl_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
+ acl_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.
+ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break ;;
+ *)
+ test "$with_gnu_ld" != yes && break ;;
+ esac
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_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_LIB_PROG_LD_GNU
+])
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+# Copyright 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.4-p6])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN([AM_MISSING_PROG],
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
diff --git a/documentation/ccf-proposal b/documentation/ccf-proposal
new file mode 100644
index 00000000..a67fc8dc
--- /dev/null
+++ b/documentation/ccf-proposal
@@ -0,0 +1,124 @@
+
+ proposal for the chaos configuration utility
+ copyright 1999 chaos development
+-----------------------------------
+
+
+the chaos configuration utility shall be used by every program running under
+chaos and is dependant on a configuration file. each program has to supply it's
+own template file. the chaos configuration utility uses this file to present
+to the user, a friendly, graphical interface to set and change the
+configuration of the program. the program may supply a configuration file as
+well, but that will not be neccessary as it can easily be created from the
+template file. every program-package MUST create a
+/config//template file. the configuration utility checks on
+startup all the directories in the /config directory and presents the found
+directories to the user to choose from, unless program-name was given as a
+parameter. after this step, the configuration program reads the template file
+and creates all the menus, buttons and textboxes needed.
+
+
+ the template format and datatypes
+-------------------------------------
+
+
+the main template-skeleton is built up by sections like this:
+
+section ("card settings")
+{
+ /* stuff here */
+}
+
+section ("ethernet firewalling")
+{
+ /* more stuff here */
+}
+
+the user first has to choose a section to edit. this is to add overview to the
+configuration files and categorize all the options for the user. the program
+stores two files, when using this template; card_settings and
+ethernet_firewalling. they are both located in /config/
+
+each section is then built up by various datatypes with names and possible
+values:
+
+section ("card settings")
+{
+ integer io (0x280 to 0x360 step 0x10);
+ integer irq (3, 5, 9, 10, 11, 13);
+ check mac_assigned ("assign static ethernet address")
+ {
+ integer mac (0 to 0xFFFFFFFFFFFF);
+ }
+ select connection_type ("10baseT", "10Base2", "100baseTX");
+ text my_story ("write about your life, pal");
+}
+
+section ("ethernet firewalling")
+{
+ check ethernet_firewalling ("enable ethernet-level firewalling")
+ {
+ group policy
+ {
+ select type ("reject", "deny")
+ {
+ case ("reject")
+ {
+ integer mac (0 to 0xFFFFFFFFFFFF);
+ choice log;
+ textbox return_text ("send this text in the icmp-reject package");
+ }
+ case ("deny")
+ {
+ integer mac (0 to 0xFFFFFFFFFFFF);
+ choice log;
+ }
+ }
+ }
+ }
+}
+
+in this example, in the first section (card settings) you will have nine io
+addresses to choose from from a listbox, and similar with the irq. there will
+also be a checkbox (which can either be "on" or "off") and if it is checked/on,
+you will be able to fill in a textbox to assign a mac-address. this checkbox
+will only accept numbers between 0 and 0xFFFFFFFFFFFF. there will be a textbox
+for you to write about yourself too. this text has no limitations and can
+contain almost anything. the following is an example of a configuration file
+generated from this template:
+
+section ("card settings")
+{
+ io = 0x300;
+ irq = 10;
+ mac_assigned = TRUE;
+ mac = 0x4f035b8cd934;
+ connection_type = "10baseT";
+ my_story = "i was born, then i became l33t and finally i became a quaker...";
+}
+
+section ("ethernet firewalling")
+{
+ ethernet_firewalling = TRUE;
+ policy
+ {
+ type = "reject";
+ mac = 0x0472bd9c45ff;
+ log = FALSE;
+ }
+ policy
+ {
+ type = "reject";
+ mac = 0xfbc67d8200b0;
+ log = TRUE;
+ }
+ policy
+ {
+ type = "deny";
+ mac = 0x9c667bd3f67d;
+ log = FALSE;
+ return_text = "du suger!";
+ }
+}
+
+more datatypes will be added as there are needs for them...
diff --git a/documentation/changelog b/documentation/changelog
new file mode 100644
index 00000000..7524e83e
--- /dev/null
+++ b/documentation/changelog
@@ -0,0 +1,238 @@
+1999-10-19 Per Lundberg
+
+ * servers/debugshell/debugshell.c (command): Removed some erroneous
+ entries.
+
+ * include/misc.h (delay): Added inline function used for doing delays
+ which is needed when accessing some ISA hardware..
+
+1999-10-08 Per Lundberg
+
+ * storm/i386/process.c (process_vm_range_reserve): Created
+ process_vm_range_reserve, with equal functionality as
+ page_range_reserve, except that it reserved linear instead of
+ physical pages.
+
+ * storm/i386/elf.c (elf_execute): Now calls process_vm_range_reserve
+ to reserve it's memory space.
+ (elf_execute): Added a call to process_vm_init.
+
+1999-10-03 Per Lundberg
+
+ * include/port.h: Rewrote all the functions in a new and better style
+ inspired by Zack Weinberg.
+
+1999-10-01 Per Lundberg
+
+ * storm/i386/message.c: Documented the message support better.
+ * storm/i386/message.c: Started implemented queuing of messages.
+
+1999-09-30 Per Lundberg
+
+ * Makefile.am: New target 'install' for copying the GRUB menu file,
+ the servers and the kernel to the place specified by the --prefix
+ parameter to the configure script. The reason I did this was because
+ I needed it for the new netboot feature of GNU GRUB.
+
+1999-09-26 Per Lundberg
+
+ * Lots, and *LOTS* of changes. We've finally made the memory
+ management work so that new tasks can be created. Since we changed
+ almost 100% of the memory management code, some bugs may still persist.
+
+1999-09-05 Per Lundberg
+
+ * I've implemented a buddy system for memory allocation. So far a
+ very limited implementation, but it will shortly support
+ deallocation and other nice stuff. :)
+
+1999-09-04 Per Lundberg
+
+ * We haven't updated the changelog recently since we've been so
+ busy coding. Anyway, I've now created a little Perl script to
+ simplify management of the system calls. Now all files that are
+ dependant on the names and number of arguments of the system
+ calls are automatically created by this script (except for
+ syscall.h, since that would be quite difficult)
+ * Other things that has been done: MHz detection, PS/2 mouse support,
+ (non-working) serial support, a first development version of tornado
+ (pretty much just a joke right now) and probably some other stuff
+ I'm just forgetting about.
+
+1999-07-29 Per Lundberg
+
+ * Me and eihrul (eihrul@chaosdev.org) has been doing a whole lot
+ lately. Not much concrete, but we've been discussing how thing should
+ and shouldn't work. As I'm writing, eihrul is implementing a first
+ attempt to a real IPC system (only events for now; see ipc.txt in
+ the documentation directory for the full specification). The full
+ IPC support will probably be done pretty soon. Crimson is coming
+ over to my place tomorrow for some major coding.
+ * We have also decided to move the VFS support into a server of it's
+ own, and to do some kind of exec server which will make using
+ different binary formats very easy.
+
+1999-07-16 Per Lundberg
+
+ * Lot's of stuff has been fixed up, as usual. We've now got a fully
+ working VGA server, with support for 320x200x256, 80x50 and (broken?
+ It didn't work for me) 640x480x16 and 640x400x256 support. I've also
+ been redoing parts of the makefiles so that you can make a virtual
+ floppy even if your chaos source is located on an NFS drive.
+
+1999-06-25 Per Lundberg
+
+ * We've now got a working printf() in the kernel, which makes the
+ source a whole lot easier to read. We also added an sprintf() call in
+ the server library.
+ * A server stub has been written to make writing of servers quite much
+ simpler, esp. if you're used to other systems.
+
+1999-06-18 Per Lundberg
+
+ * We've had a little coding meeting to finish up stuff. The ELF support
+ is now much more complete and is able to load standard Linux linked
+ binaries.
+ * Process communication works perfectly now, so it's about time to
+ start code some servers and stuff.
+ * Interrupt handling is highly broken due to the paging implementation.
+ This is being worked on.
+
+1999-06-15 Henrik Hallin
+
+ * Received the latest storm sourcecode from Plundis, who had been
+ rewriting parts of it to make the storm compatible with GRUB.
+ * storm now loads perfectly from GRUB and can also be gzipped.
+ * Servers are no longer held inside a kernelimage. They are instead
+ loaded with the module=xxx command from GRUB. The servers can also be
+ gzipped.
+ * Started finishing paging...
+
+1999-05-28 Henrik Hallin
+
+ * Wrote a simple rr scheduler, allowing processes to be put to sleep
+ and waked up in a simple way.
+ * Added event timers, so a process can put itself to sleep for a given
+ number of milliseconds.
+ * Started rewriting the whole memory layout, both physical and virtual.
+ * Started writing the IPC.
+
+1999-05-01 Henrik Hallin
+
+ * Started implementing support for paging in storm. I set up basic
+ paging structures for the kernel during initialisation.
+ * Bochs seems a little buggy so chaos won't run under it anymore.
+ * Added cpuid code, to be able to detect the presence of for example
+ MMX in the cpu.
+ * Fixed some cosmetic things regarding the server startup sequence.
+ * Removed some junk from the chaos directories.
+ * Made some new homepages, to replace the existing one.
+ * Started writing a little on a scheduler.
+ * Rearranged the physical memory layout, making place for a page
+ directory and one page table for the kernel.
+
+1999-04-18 Per Lundberg
+
+ * The syscall for registering IRQ:s work almost perfectly now. For
+ some reason, the wrong data segment is being used, but I'm checking
+ it out right now and it'll probably work just fine later tonight.
+ The reason thing's are a little messy is the fact that we don't want
+ an interrupt handler to just go boom about everything and have
+ unlimited access to the computer; this is a basic design issue in
+ chaos (a program should not be able to crash the computer at all).
+ * syscall_register_port() works absolutely perfectly now.
+
+1999-04-10 Per Lundberg
+
+ * Gameland is over and we've come home. During the party we looked
+ at the syscalls a little and started rewriting the keyboard support
+ as a true server.
+ * I've also moved the kernel stack from 0x53000 to 0x13000, so that
+ it's right before the kernel code instead of right after (guess why)
+
+1999-03-27 Per Lundberg
+
+ * ELF support is now working just fine, when using our custom LD
+ script. Regular binaries won't work until we've got paging up and
+ running.
+ * All of the kernel has been rewritten to use a flat DS descriptor
+ instead of the old style (small DS only for kernel memory). This
+ makes the kernel extremely much easier to write and let us remove a lot
+ of junk (all of the memio.asm)
+ * Some unneccessary comments have been removed to make the kernel
+ source tinier..
+ * Rewrote the old TODO file to changelog format, which is the
+ reason some of the older comments aren't really about what's done
+ but more about what's to be done. The reason I kept the old stuff
+ is (of course) for nostalgia. :)
+
+1999-03-15 Henrik Hallin
+
+ * We have not done so many important things on the storm lately, just
+ planning and thinking. But almost everything has been changed a little
+ in some way. The storm is going to be something completely different
+ from the kernel we once started writing on. We think that the storm is
+ going to fit in 64k easily, because of its lack of any drivers. All
+ memory I/O and stuff like that originally planned to be contained in
+ the microkernel is going to be removed and replaced with servers.
+ * We have started writing on the ELF support in the microkernel so we
+ then can start writing the servers.
+ * The multitasking worked perfectly when we had the structures
+ statically set up. But now I have been rewriting the process functions
+ so that you can dynamically start and stop tasks. When the elf support
+ is finished we can combine these parts and the process support in the
+ kernel will be complete.
+ * Console functions are going to be removed, which will further reduce
+ the size of the storm.
+ * Added VESA videomode setup in the init code, so that you will be
+ able to run chaos in any VESA 2.0 compatible videomode. The idea is
+ that the init code will set up a video mode, using VBE 2.0 calls, for
+ example 1280x1024x16. This mode will then be used the whole time, with
+ no possibility to change the videomode later. The gui and the text
+ consoles will use the same mode all the time.
+
+1999-02-06 Henrik Hallin
+
+ * The microkernel has been given a name: storm.
+ * The memory is slightly rearranged.
+ * IRQ / exception handling works well.
+ * Support for CPU halt/reboot.
+ * Loader works well and loads perfectly from a harddrive.
+ It should be rewritten though, to use int 0x13 extensions if
+ available.
+ * Physical memory page allocation almost works.
+ * Timer driven task switcher works, almost. :)
+ * Writing numbers doesn't seem to work at all. :(
+ * We have been thinking a *LOT* on the server architecture and storm
+ is going to be very small with a lot of servers running under it.
+
+1999-01-05 Per Lundberg
+
+ * Reprogram the timer circuit
+ * Finish (oh, well..) the keyboard handler and make it translate
+ scancodes to ASCII
+ * Make %d in _printf work
+
+1999-01-04 Per Lundberg
+
+ * Make interrupt and exception handling.
+
+1998-12-11 Per Lundberg
+
+ * Make the loading of the microkernel work. ;)
+
+1998-12-03 Per Lundberg
+
+ * Fix the PM initialization code to set things up correctly and
+ organize the memory in an elegant way.
+ * Actually switch to protected mode and do something to show that it
+ works out the way it should work.
+ * Continue writing the microkernel basic functionality (DMA, IRQ,
+ memory I/O and so on)
+
+1998-11-16 Per Lundberg
+
+ * Re-write loader.asm to use BIOS calls for writing text.
+ * Make a proper list of how things ought to work and microkernel
+ structures. Document the system call features of the microkernel.
+ * Start working on the microkernel.
diff --git a/documentation/chaos-both.dsssl b/documentation/chaos-both.dsssl
new file mode 100644
index 00000000..2713e35f
--- /dev/null
+++ b/documentation/chaos-both.dsssl
@@ -0,0 +1,113 @@
+
+
+
+]]>
+
+
+]]>
+]>
+
+
+
+
+
+
+
+
+
+;; ====================
+;; customize the print stylesheet
+;; ====================
+
+;; make funcsynopsis look pretty
+(define %funcsynopsis-decoration%
+ ;; Decorate elements of a FuncSynopsis?
+ #t)
+
+;; this is necessary because right now jadetex does not understand
+;; symbolic entities, whereas things work well with numeric entities.
+(declare-characteristic preserve-sdata?
+ "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"
+ #f)
+(define %two-side% #t)
+
+(define %section-autolabel%
+ ;; Are sections enumerated?
+ #t)
+;; (define %title-font-family%
+;; ;; The font family used in titles
+;; "Ariel")
+(define %visual-acuity%
+ ;; General measure of document text size
+ ;; "presbyopic"
+ ;; "large-type"
+ "presbyopic")
+
+(define %generate-part-toc% #t)
+
+;; (define %block-start-indent% 10pt)
+
+(define %graphic-default-extension% "eps")
+
+
+
+
+
+
+
+
+
+;; this is necessary because right now jadetex does not understand
+;; symbolic entities, whereas things work well with numeric entities.
+(declare-characteristic preserve-sdata?
+ "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"
+ #f)
+
+;; put the legal notice in a separate file
+(define %generate-legalnotice-link%
+ #t)
+
+(define %funcsynopsis-decoration%
+ ;; Decorate elements of a FuncSynopsis?
+ #t)
+
+(define %html-ext% ".html")
+(define %body-attr%
+ ;; What attributes should be hung off of BODY?
+ '())
+;; (list
+;; (list "BGCOLOR" "#FFFFFF")
+;; (list "TEXT" "#000000")))
+
+(define %generate-article-toc%
+ ;; Should a Table of Contents be produced for Articles?
+ ;; If true, a Table of Contents will be generated for each 'Article'.
+ #t)
+
+(define %generate-part-toc% #t)
+
+(define %shade-verbatim%
+ #t)
+
+(define %use-id-as-filename%
+ ;; Use ID attributes as name for component HTML files?
+ #t)
+
+(define %graphic-default-extension% "gif")
+
+(define %stylesheet% "/documentation.css")
+(define %stylesheet-type% "text/css")
+
+
+
+
+
+
+
diff --git a/documentation/coding-standards.fot b/documentation/coding-standards.fot
new file mode 100644
index 00000000..620895d2
--- /dev/null
+++ b/documentation/coding-standards.fot
@@ -0,0 +1,1056 @@
+
+
+
+
+
+The chaos Coding Standards
+
+
+
+Per
+
+Lundberg
+
+$Id$
+
+
+Introduction
+
+ This is The chaos Coding Standards. It is a guide in programming
+
+ for the chaos operating system. If you intend to submit your
+
+ code, please adhere to these standards. This will save both you
+
+ and us some unnecessary work reformatting and rewriting the
+
+ code. It is very important to keep the same quality on all
+
+ code.
+
+
+
+ The code formatting chapters in this publication is mostly
+
+ C-related, but some of them can be used for other languages too.
+
+
+
+
+Language choice
+
+ Choosing the right language for a project is very important. If
+
+ you make a bad choice, it may render the program unusable for
+
+ some, or all, of its users. For example, if you choose a
+
+ language where a free interpreter/compiler is not available, few
+
+ people will be able to use it. So please, choose a language
+
+ which is usable. Another important aspect is to choose a
+
+ language as suitable for the project as possible. For example,
+
+ storm, the chaos kernel, is written in a C and assembly
+
+ combination. This is because those were the most suitable
+
+ languages - C is quite low-level, which is good for a kernel, and
+
+ assembly is almost necessary to use. But those considerations
+
+ may vary depending on your project type. For example, the
+
+
+
+cAPS
+ (chaos Advanced Packaging System) system
+
+ is written in a combination of C and Perl, since we found those
+
+ languages to be most suitable.
+
+
+
+ If you do not think you will be able to do the project all by
+
+ yourself, try using a language that is widely accepted (C, C++
+
+ and Perl are three good examples). Avoid using "smaller"
+
+ languages like Objective C or Haskell if possible.
+
+
+
+
+License choice
+
+ chaos is a free operating system, as defined by the FSF, and as
+
+ such, all parts of it must be free. However, they do not have to
+
+ be GPL, even though we encourage people to release their work
+
+ under this license. This is the list of acceptable licenses for
+
+ chaos:
+
+
+
+
+
+
+
+
+
+GNU GPL (General public license)
+ is
+
+ our preferred license for all code we write
+
+
+
+except
+ for the system
+
+ libraries. This is necessary to make licensing of chaos
+
+ programs under other free licenses possible. Use this
+
+ license if possible.
+
+
+
+
+
+
+GNU LGPL (Lesser General Public
+
+ License)
+ permits linkage between your work and
+
+ proprietary (closed-source, non-free) programs. We only
+
+ use this license for the system libraries. It is
+
+ deprecated for everything else.
+
+
+
+
+
+
+BSD
+ is the Berkeley Software
+
+ Distribution license. We do not use it, but you may use it
+
+
+
+if
+, and only if, you remove the
+
+ advertising clause. We do not recommend using this license
+
+ anyway, since it is not a copyleft and thus does not
+
+
+ protect your freedom in a way we prefer, but we will
+
+ nevertheless accept if you decide to do so.
+
+
+
+
+
+
+The Artistic license
+ is the license
+
+ used by Perl. We do not encourage its usage except for
+
+ Perl-related things; in such cases, please follow the Perl
+
+ example and dual-license your code under both the Artistic
+
+ license and the GNU GPL.
+
+
+
+
+ The GNU FDL (Free Documentation License) is a pretty new
+
+ license from the Free Software Foundation. It is intended
+
+ for documentation, and should be used for that.
+
+
+
+
+
+
+ You do not need to give over the rights to your code to
+
+ us. Licensing it under one of those licenses is probably enough,
+
+ but be careful if you have signed a contract with your employer
+
+ stating they own everything you write. If so, you can not
+
+ legally license the code under GPL yourself. You must get
+
+ permission from your employer to do so. Please be careful with
+
+ these issues so neither you or we get into legal trouble.
+
+
+
+
+Compiler flags
+
+ The chaos build system, autochaos, automatically uses our
+
+ standard C flags, so there is little need to duplicate them
+
+ here. What our flags do is try to eliminate the pitfalls of the
+
+ C programming language (there are quite a few). The only really
+
+ important flag is -Werror, which turns all warnings into
+
+ errors. We believe this should have been the default in gcc. A
+
+ warning is nothing to take lightly. And really, if you do not
+
+ care about the warning, why don't you turn it off?
+
+
+
+
+Symbol names
+
+ All symbol names should be in lower-case only. The only
+
+ exception to this is acronyms like VGA, GDT, IDT etc, where you
+
+ could put the acronym in uppercase if you would like. Separate
+
+ logic words with underscores, like this: screen_base_address.
+
+
+
+ It is very important to be consequent when naming your
+
+ functions, variables and such. Do not abbreviate names. It only
+
+ makes it harder to figure out what a function or variable is
+
+ used for. Symbol names must
+
+always
+ be
+
+ descriptive. One-name variables are neat for the lazy, but is a
+
+ no-no. Try to name your counter variables index (if you are
+
+ operating on a one-dimensional list), x and y (if a
+
+ two-dimensional structure), x, y and z, and so on. In short, try
+
+ to be as descriptive as possible. It is tempting at times to
+
+ call your variables i, j, k and such, but this just makes the
+
+ program more difficult for other people to get into.
+
+
+
+ All global symbols should have their file name prepended to
+
+ them. Thus, all the symbols exported from the file
+
+
+
+port.c
+ should be named port_*. When doing a
+
+ library, it is okay to split it up into smaller files and still
+
+ have the functions named foo_bar. (if the library name is foo)
+
+
+
+
+Functions
+
+ The usage of functions is standard in all structured
+
+ programming. You should try to keep your functions as long as
+
+ suitable. We do not give a specific limit, but try to split your
+
+ code in natural functions. For example, if your program is
+
+ reading and processing lines from a file, and the
+processing is
+
+ more than a few statements of code, put it in a separate
+
+ function. This is not really difficult when you get used to it.
+
+
+
+ Always put a comment before the function declaration where you
+
+ state what it does. It is also desirable that you document the
+
+ input and return variables if it is not implicit.
+
+
+
+ A typical function declaration can look like this:
+
+
+
+ /* Initialise the page allocation system. */
+
+
+
+ void page_init (void)
+
+ {
+
+ [...]
+
+ }
+
+
+
+ As you see, we do not put the function name in the leftmost
+
+ column. There is no reason to do so. It just makes the code look
+
+ ugly.
+
+
+
+ Also, if the function types and names do not fit on one line,
+
+ write it like this:
+
+
+
+ extern inline return_type system_call_thread_control
+
+ (process_id_type process_id, u32 class, u32 parameter)
+
+
+
+
+Comments
+
+ Code without comments is like an operating system without
+
+ applications -- it is not very usable. Try to comment your code
+
+ as much as suitable to understand it for a reasonably
+
+ experienced programmer. A good idea is to let someone else look
+
+ at your code and see where she gets stuck.
+
+
+
+ Always put comments on their own line, with a blank line above
+
+ and below. Do not put comments at the end of the line, after the
+
+ code; it just makes everything messy.
+
+
+
+ When commenting a statement, put the comment above the
+
+ statement, like this:
+
+
+
+ /* Check if we are ready yet. */
+
+
+
+ if (finished ())
+
+ {
+
+ return;
+
+ }
+
+
+
+ Some people like C++ comments. We prefer to only use them for
+
+ temporary commenting away code, so that they can not get
+
+ mistaken for being real comments.
+
+
+
+
+Indentation
+
+ The indentation level should be two spaces. Do not use
+
+ tabs. When starting a new block, the braces should be on their own line
+
+ at the same level of indentation as the previous line, like this:
+
+
+
+ if (age > LEGAL_AGE)
+
+ {
+
+ print_age (age);
+
+ }
+
+
+
+
+Inline assembly
+
+ Inline assembly is a twin-edged sword. It can make
+
+ computing-intensive programs a lot speedier, at the cost of
+
+ making the source more difficult to get into. Generally, only
+
+ use it if the speed gain is significant, or in the kernel and
+
+ other places where things might be impossible to do without
+
+ it. In general user programs there is little need for it, but
+
+ occasionally, it might be okay. The thumb rule is to start by
+
+ optimising the algorithms. If that is not enough, try to profile
+
+ your code and see where the most time is spent, and rewrite
+
+ those parts in assembly. If the gain is more than a few percent,
+
+ inline assembly is okay.
+
+
+
+ If you for one reason or another have to use inline assembly, do
+
+ it like this:
+
+
+
+ asm volatile
+
+ ("\
+
+ pushl %2
+
+ pushl %3
+
+ pushl %4
+
+ lcall %5, $0
+
+ "
+
+ : "=a" (return_value), "=g" (*buffer)
+
+ : "g" (buffer), "g"
+(parameter), "g" (class),
+
+ "n" (SYSTEM_CALL_KERNELFS_ENTRY_READ << 3));
+
+
+
+ Do not write long blocks of uncommented inline assembly, but
+
+ keep it into functional blocks separated with blank lines and
+
+ comments, so it is easier to get into the code.
+
+
+
+
+Miscellaneous
+
+ Here you will find stuff that did not fit into one of the
+
+ previous chapters:
+
+
+
+
+
+
+
+ When writing if-statements, always use braces to indicate
+
+ a block, even for one-line statements where it is not
+
+ required. Like this:
+
+
+
+ if (age > LEGAL_AGE)
+
+ {
+
+ print_age (age);
+
+ }
+
+ else
+
+ {
+
+ return;
+
+ }
+
+
+
+
+ When writing switch statements, always use braces in the
+
+ case blocks. Like this:
+
+
+
+ switch (key)
+
+ {
+
+ case ESCAPE:
+
+ {
+
+ return;
+
+ }
+
+ }
+
+
+
+
+ When writing conditional statements, never use the fact
+
+ that non-zero is TRUE. You can only do this on
+
+ booleans. If something is not a boolean, you must compare
+
+ it with a number. Like this:
+
+
+
+ if (get_age () != 0)
+
+ {
+
+ do_something ();
+
+ }
+
+
+
+ This makes things much clearer. The lack of real booleans
+
+ in C is showing, but using this fact makes your programs
+
+ very ugly.
+
+
+
+
+ When declaring external functions (in library header files
+
+ and elsewhere), always write like this:
+
+
+
+ extern my_function (void);
+
+
+
+ The extern attribute is not mandatory in gcc, but use it
+
+ anyway since it makes it very clear what we are talking about.
+
+
+
+
+
+
+
+Whitespace
+
+ A lot of programmers tend to forget how important whitespace is
+
+ to write good code. A good example of this can be found in the
+
+ Linux source code, but unfortunately, the practice is rather
+
+ common (especially in the Unix world). In chaos, we use as much
+
+ whitespace as is practical. Always use whitespace between
+
+ function names and parentheses, after commas, semicolons and
+
+ other places. Separate blocks of code with blank lines and
+
+ comments.
+
+
+
+
+Documentation
+
+ Documentation is essential for a program to succeed. All
+
+ documentation should be written in English (but may also be
+
+ translated to other languages if desirable). The standard format
+
+ for documentation in chaos is SGML using the DocBook DTD. You
+
+ can find more information about this DTD on
+
+ the
+
+DocBook Web Site
+.
+
+
+
+
+Examples
+
+
+A C example
+
+/* $Id$ */
+
+/* Abstract: Semaphores for the kernel. */
+
+
+
+/* Copyright 1999-2000 chaos development. */
+
+
+
+/* This program is free software; you can redistribute it and/or
+
+ modify it under the terms of the GNU
+General Public License as
+
+ published by the Free Software Foundation; either version 2 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
+
+ General Public License for more details.
+
+
+
+ You should have received a copy of the GNU General Public License
+
+ along with this program; if not, write to the Free Software
+
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+
+ USA */
+
+
+
+#include
+<
+storm/i386/error_numbers.h
+>
+
+
+#include
+<
+storm/i386/semaphore.h
+>
+
+
+#include
+<
+storm/i386/thread.h
+>
+
+
+#include
+<
+storm/i386/types.h
+>
+
+
+#include
+<
+storm/state.h
+>
+
+
+
+
+/* Semaphore lock variable. 1 if none is accessing the semaphores, 0
+
+ if someone is. */
+
+
+
+static kernel_mutex_type semaphore_mutex = 1;
+
+
+
+error_type semaphore_wait (kernel_semaphore_type *semaphore)
+
+{
+
+ spin_lock (semaphore_mutex);
+
+
+
+ if (*semaphore
+<
+= 0)
+
+ {
+
+ spin_unlock (semaphore_mutex);
+
+ thread_block_semaphore (STATE_SEMAPHORE, semaphore);
+
+ return ERROR_UNKNOWN;
+
+ }
+
+ else
+
+ {
+
+ (*semaphore)--;
+
+ spin_unlock (semaphore_mutex);
+
+ }
+
+
+
+ return ERROR_UNKNOWN;
+
+}
+
+
+
+/* Release the lock around the given semaphore. */
+
+
+
+error_type semaphore_signal (kernel_semaphore_type *semaphore)
+
+{
+
+ spin_lock (semaphore_mutex);
+
+
+
+ if (thread_unblock_semaphore (semaphore) == ERROR_NO_THREAD_UNBLOCKED)
+
+ {
+
+ (*semaphore)++;
+
+ }
+
+
+
+ spin_unlock (semaphore_mutex);
+
+
+
+ return ERROR_UNKNOWN;
+
+}
+
+
+
+
+A Perl example
+
+#!/usr/bin/perl -w
+
+
+
+# $Id$
+
+
+
+# Abstract: Program for building chaos packages.
+
+# Author: Per Lundberg
+<
+plundis@chaosdev.org
+>
+
+
+
+
+use chaos::cAPS;
+
+use strict;
+
+
+
+my $CONFIGFILE;
+
+
+
+# Abstract: Clean things up.
+
+
+
+sub cleanup
+
+{
+
+ close (CONFIGFILE);
+
+}
+
+
+
+my $cAPS = new chaos::cAPS ('/mnt/chaos/system/caps');
+
+my %config_keyword = $cAPS->config_keyword_get ();
+
+my %config;
+
+
+
+# All mandatory keywords are stored in this list.
+
+
+
+my @mandatory_keyword = ('name', 'type', 'version', 'description' );
+
+
+
+open (CONFIGFILE, '
+<
+chaos/config') or die "Couldn't open chaos/config.\n";
+
+
+
+# This is the main config file parser loop. Neat, isn't it? :) This
+
+# used to be written in flex/bison, and was rather complex and
+
+# difficult to get into. But now...
+
+
+
+while (
+<
+CONFIGFILE
+>
+)
+
+{
+
+ chop;
+
+ ($_, my $dummy) = split ('#');
+
+ (my $key, my $value) = /^([\w\-]+)\s*=\s*\"([^\"]*)\"/;
+
+
+
+ if (!$key || !$value)
+
+ {
+
+ print ("Syntax error in config file: $_.\n");
+
+ exit;
+
+ }
+
+
+
+ my $flag = 1;
+
+
+
+ foreach my $config_key (keys %config_keyword)
+
+ {
+
+ if ($config_keyword{$config_key} eq $key)
+
+ {
+
+ $config{$key} = $value;
+
+ $flag = 0;
+
+ }
+
+ }
+
+ if ($flag == 1)
+
+ {
+
+ print ("Bad keyword '$key' in config file. Aborting.\n");
+
+ exit 1;
+
+ }
+
+}
+
+
+
+# It's time to start some serious business. But first, we check that
+
+# all mandatory keywords have been specified.
+
+
+
+foreach my $keyword (@mandatory_keyword)
+
+{
+
+ if (!$config{$keyword})
+
+ {
+
+ print ("Mandatory keyword $keyword missing from config file.\n");
+
+ exit 1;
+
+ }
+
+}
+
+
+
+# All things clear? Great! Now we check if the package directory
+
+# exists.
+
+
+
+# ..chaos/$config{name}
+
+
+
+# Clean things up.
+
+
+
+cleanup ();
+
+
+
+
+Emacs settings for chaos indentation
+
+ This is our .emacs settings for chaos indentation style for C
+
+ code. It makes writing compliant code much easier.
+
+
+
+
+
+ ;; chaos indentation style
+
+
+
+ (defconst chaos-c-style
+
+ '(
+
+ (c-basic-offset . 2)
+
+ (c-comment-only-line-offset . (0 . 0))
+
+ (c-comment-continuation-stars . "")
+
+ (c-hanging-comment-ender-p . t)
+
+ (c-offsets-alist . (
+
+ (statement-block-intro . +)
+
+ (knr-argdecl-intro . +)
+
+ (substatement-open . 0)
+
+ (label . 0)
+
+ (statement-cont . +)
+
+ (case-label . 2)
+
+ )
+
+ )
+
+ )
+
+ "chaos"
+
+ )
+
+
+
+ (defun chaos-c-mode-common-hook ()
+
+
+
+ ;; add my personal style and set it for the current buffer
+
+
+
+ (c-add-style "chaos" chaos-c-style t)
+
+
+
+ ;; this will make sure spaces are used instead of tabs
+
+
+
+ (setq indent-tabs-mode nil))
+
+
+
+ (add-hook 'c-mode-common-hook 'chaos-c-mode-common-hook)
+
+
+
diff --git a/documentation/coding-standards.sgml b/documentation/coding-standards.sgml
new file mode 100644
index 00000000..da7379b8
--- /dev/null
+++ b/documentation/coding-standards.sgml
@@ -0,0 +1,661 @@
+
+
+
+
+ The chaos Coding Standards
+
+
+ Per
+ Lundberg
+
+
+ Henrik
+ Hallin
+
+
+ Anders
+ Öhrt
+
+
+ $Id$
+
+
+
+ Introduction
+
+
+ This is The chaos Coding Standards. It is a guide in programming
+ for the chaos operating system. If you intend to submit your
+ code, please adhere to these standards. This will save both you
+ and us some unnecessary work reformatting and rewriting the
+ code. It is very important to keep the same quality on all
+ code.
+
+
+
+ The code formatting chapters in this publication is mostly
+ C-related, but some of them can be used for other languages too.
+
+
+
+
+
+ Language choice
+
+
+ Choosing the right language for a project is very important. If
+ you make a bad choice, it may render the program unusable for
+ some, or all, of its users. For example, if you choose a
+ language where a free interpreter/compiler is not available, few
+ people will be able to use it. So please, choose a language
+ which is usable. Another important aspect is to choose a
+ language as suitable for the project as possible. For example,
+ storm, the chaos kernel, is written in a C and assembly
+ combination. This is because those were the most suitable
+ languages - C is quite low-level, which is good for a kernel, and
+ assembly is almost necessary to use. But those considerations
+ may vary depending on your project type. For example, the
+ cAPS (chaos Advanced Packaging System) system
+ is written in a combination of C and Perl, since we found those
+ languages to be most suitable.
+
+
+
+ If you do not think you will be able to do the project all by
+ yourself, try using a language that is widely accepted (C, C++
+ and Perl are three good examples). Avoid using "smaller"
+ languages like Objective C or Haskell if possible.
+
+
+
+
+ License choice
+
+
+ chaos is a free operating system, as defined by the FSF, and as
+ such, all parts of it must be free. However, they do not have to
+ be GPL, even though we encourage people to release their work
+ under this license. This is the list of acceptable licenses for
+ chaos:
+
+
+
+
+ GNU GPL (General public license) is
+ our preferred license for all code we write
+ except for the system
+ libraries. This is necessary to make licensing of chaos
+ programs under other free licenses possible. Use this
+ license if possible.
+
+
+
+
+
+ GNU LGPL (Lesser General Public
+ License) permits linkage between your work and
+ proprietary (closed-source, non-free) programs. We only
+ use this license for the system libraries. It is
+ deprecated for everything else.
+
+
+
+
+
+ BSD is the Berkeley Software
+ Distribution license. We do not use it, but you may use it
+ if, and only if, you remove the
+ advertising clause. We do not recommend using this license
+ anyway, since it is not a copyleft and thus does not
+ protect your freedom in a way we prefer, but we will
+ nevertheless accept if you decide to do so.
+
+
+
+
+
+ The Artistic license is the license
+ used by Perl. We do not encourage its usage except for
+ Perl-related things; in such cases, please follow the Perl
+ example and dual-license your code under both the Artistic
+ license and the GNU GPL.
+
+
+
+
+
+ The GNU FDL (Free Documentation License) is a pretty new
+ license from the Free Software Foundation. It is intended
+ for documentation, and should be used for that.
+
+
+
+
+
+
+
+ You do not need to give over the rights to your code to
+ us. Licensing it under one of those licenses is probably enough,
+ but be careful if you have signed a contract with your employer
+ stating they own everything you write. If so, you can not
+ legally license the code under GPL yourself. You must get
+ permission from your employer to do so. Please be careful with
+ these issues so neither you or we get into legal trouble.
+
+
+
+
+ Compiler flags
+
+
+ The chaos build system, autochaos, automatically uses our
+ standard C flags, so there is little need to duplicate them
+ here. What our flags do is try to eliminate the pitfalls of the
+ C programming language (there are quite a few). The only really
+ important flag is -Werror, which turns all warnings into
+ errors. We believe this should have been the default in gcc. A
+ warning is nothing to take lightly. And really, if you do not
+ care about the warning, why don't you turn it off?
+
+
+
+
+ Symbol names
+
+
+ All symbol names should be in lower-case only. The only
+ exception to this is acronyms like VGA, GDT, IDT etc, where you
+ could put the acronym in uppercase if you would like. Separate
+ logic words with underscores, like this: screen_base_address.
+
+
+
+ It is very important to be consequent when naming your
+ functions, variables and such. Do not abbreviate names. It only
+ makes it harder to figure out what a function or variable is
+ used for. Symbol names must always be
+ descriptive. One-name variables are neat for the lazy, but is a
+ no-no. Try to name your counter variables index (if you are
+ operating on a one-dimensional list), x and y (if a
+ two-dimensional structure), x, y and z, and so on. In short, try
+ to be as descriptive as possible. It is tempting at times to
+ call your variables i, j, k and such, but this just makes the
+ program more difficult for other people to get into.
+
+
+
+ All global symbols should have their file name prepended to
+ them. Thus, all the symbols exported from the file
+ port.c should be named port_*. When doing a
+ library, it is okay to split it up into smaller files and still
+ have the functions named foo_bar. (if the library name is foo)
+
+
+
+
+ Functions
+
+
+ The usage of functions is standard in all structured
+ programming. You should try to keep your functions as long as
+ suitable. We do not give a specific limit, but try to split your
+ code in natural functions. For example, if your program is
+ reading and processing lines from a file, and the processing is
+ more than a few statements of code, put it in a separate
+ function. This is not really difficult when you get used to it.
+
+
+
+ Always put a comment before the function declaration where you
+ state what it does. It is also desirable that you document the
+ input and return variables if it is not implicit.
+
+
+
+ A typical function declaration can look like this:
+
+
+
+ /* Initialise the page allocation system. */
+
+ void page_init (void)
+ {
+ [...]
+ }
+
+
+
+ As you see, we do not put the function name in the leftmost
+ column. There is no reason to do so. It just makes the code look
+ ugly.
+
+
+
+ Also, if the function types and names do not fit on one line,
+ write it like this:
+
+
+
+ extern inline return_type system_call_thread_control
+ (process_id_type process_id, u32 class, u32 parameter)
+
+
+
+
+ Comments
+
+
+ Code without comments is like an operating system without
+ applications -- it is not very usable. Try to comment your code
+ as much as suitable to understand it for a reasonably
+ experienced programmer. A good idea is to let someone else look
+ at your code and see where she gets stuck.
+
+
+
+ Always put comments on their own line, with a blank line above
+ and below. Do not put comments at the end of the line, after the
+ code; it just makes everything messy.
+
+
+
+ When commenting a statement, put the comment above the
+ statement, like this:
+
+
+
+ /* Check if we are ready yet. */
+
+ if (finished ())
+ {
+ return;
+ }
+
+
+
+ Some people like C++ comments. We prefer to only use them for
+ temporary commenting away code, so that they can not get
+ mistaken for being real comments.
+
+
+
+
+
+ Indentation
+
+
+ The indentation level should be two spaces. Do not use
+ tabs. When starting a new block, the braces should be on their own line
+ at the same level of indentation as the previous line, like this:
+
+
+
+ if (age > LEGAL_AGE)
+ {
+ print_age (age);
+ }
+
+
+
+
+ Inline assembly
+
+
+ Inline assembly is a twin-edged sword. It can make
+ computing-intensive programs a lot speedier, at the cost of
+ making the source more difficult to get into. Generally, only
+ use it if the speed gain is significant, or in the kernel and
+ other places where things might be impossible to do without
+ it. In general user programs there is little need for it, but
+ occasionally, it might be okay. The thumb rule is to start by
+ optimising the algorithms. If that is not enough, try to profile
+ your code and see where the most time is spent, and rewrite
+ those parts in assembly. If the gain is more than a few percent,
+ inline assembly is okay.
+
+
+
+ If you for one reason or another have to use inline assembly, do
+ it like this:
+
+
+
+ asm volatile
+ ("\
+ pushl %2
+ pushl %3
+ pushl %4
+ lcall %5, $0
+ "
+ : "=a" (return_value), "=g" (*buffer)
+ : "g" (buffer), "g" (parameter), "g" (class),
+ "n" (SYSTEM_CALL_KERNELFS_ENTRY_READ << 3));
+
+
+
+ Do not write long blocks of uncommented inline assembly, but
+ keep it into functional blocks separated with blank lines and
+ comments, so it is easier to get into the code.
+
+
+
+
+ Miscellaneous
+
+
+ Here you will find stuff that did not fit into one of the
+ previous chapters:
+
+
+
+
+ When writing if-statements, always use braces to indicate
+ a block, even for one-line statements where it is not
+ required. Like this:
+
+
+
+ if (age > LEGAL_AGE)
+ {
+ print_age (age);
+ }
+ else
+ {
+ return;
+ }
+
+
+
+
+
+ When writing switch statements, always use braces in the
+ case blocks. Like this:
+
+
+
+ switch (key)
+ {
+ case ESCAPE:
+ {
+ return;
+ }
+ }
+
+
+
+
+
+ When writing conditional statements, never use the fact
+ that non-zero is TRUE. You can only do this on
+ booleans. If something is not a boolean, you must compare
+ it with a number. Like this:
+
+
+
+ if (get_age () != 0)
+ {
+ do_something ();
+ }
+
+
+
+ This makes things much clearer. The lack of real booleans
+ in C is showing, but using this fact makes your programs
+ very ugly.
+
+
+
+
+
+ When declaring external functions (in library header files
+ and elsewhere), always write like this:
+
+
+
+ extern my_function (void);
+
+
+
+ The extern attribute is not mandatory in gcc, but use it
+ anyway since it makes it very clear what we are talking about.
+
+
+
+
+
+
+
+ Whitespace
+
+
+ A lot of programmers tend to forget how important whitespace is
+ to write good code. A good example of this can be found in the
+ Linux source code, but unfortunately, the practice is rather
+ common (especially in the Unix world). In chaos, we use as much
+ whitespace as is practical. Always use whitespace between
+ function names and parentheses, after commas, semicolons and
+ other places. Separate blocks of code with blank lines and
+ comments.
+
+
+
+
+ Documentation
+
+
+ Documentation is essential for a program to succeed. All
+ documentation should be written in English (but may also be
+ translated to other languages if desirable). The standard format
+ for documentation in chaos is SGML using the DocBook DTD. You
+ can find more information about this DTD on
+ the DocBook Web Site.
+
+
+
+
+ Examples
+
+
+ A C example
+
+/* $Id$ */
+/* Abstract: Semaphores for the kernel. */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA */
+
+#include <storm/i386/error_numbers.h>
+#include <storm/i386/semaphore.h>
+#include <storm/i386/thread.h>
+#include <storm/i386/types.h>
+#include <storm/state.h>
+
+/* Semaphore lock variable. 1 if none is accessing the semaphores, 0
+ if someone is. */
+
+static kernel_mutex_type semaphore_mutex = 1;
+
+error_type semaphore_wait (kernel_semaphore_type *semaphore)
+{
+ spin_lock (semaphore_mutex);
+
+ if (*semaphore <= 0)
+ {
+ spin_unlock (semaphore_mutex);
+ thread_block_semaphore (STATE_SEMAPHORE, semaphore);
+ return ERROR_UNKNOWN;
+ }
+ else
+ {
+ (*semaphore)--;
+ spin_unlock (semaphore_mutex);
+ }
+
+ return ERROR_UNKNOWN;
+}
+
+/* Release the lock around the given semaphore. */
+
+error_type semaphore_signal (kernel_semaphore_type *semaphore)
+{
+ spin_lock (semaphore_mutex);
+
+ if (thread_unblock_semaphore (semaphore) == ERROR_NO_THREAD_UNBLOCKED)
+ {
+ (*semaphore)++;
+ }
+
+ spin_unlock (semaphore_mutex);
+
+ return ERROR_UNKNOWN;
+}
+
+
+
+
+ A Perl example
+
+#!/usr/bin/perl -w
+
+# $Id$
+
+# Abstract: Program for building chaos packages.
+# Author: Per Lundberg <plundis@chaosdev.org>
+
+use chaos::cAPS;
+use strict;
+
+my $CONFIGFILE;
+
+# Abstract: Clean things up.
+
+sub cleanup
+{
+ close (CONFIGFILE);
+}
+
+my $cAPS = new chaos::cAPS ('/mnt/chaos/system/caps');
+my %config_keyword = $cAPS->config_keyword_get ();
+my %config;
+
+# All mandatory keywords are stored in this list.
+
+my @mandatory_keyword = ('name', 'type', 'version', 'description' );
+
+open (CONFIGFILE, '<chaos/config') or die "Couldn't open chaos/config.\n";
+
+# This is the main config file parser loop. Neat, isn't it? :) This
+# used to be written in flex/bison, and was rather complex and
+# difficult to get into. But now...
+
+while (<CONFIGFILE>)
+{
+ chop;
+ ($_, my $dummy) = split ('#');
+ (my $key, my $value) = /^([\w\-]+)\s*=\s*\"([^\"]*)\"/;
+
+ if (!$key || !$value)
+ {
+ print ("Syntax error in config file: $_.\n");
+ exit;
+ }
+
+ my $flag = 1;
+
+ foreach my $config_key (keys %config_keyword)
+ {
+ if ($config_keyword{$config_key} eq $key)
+ {
+ $config{$key} = $value;
+ $flag = 0;
+ }
+ }
+ if ($flag == 1)
+ {
+ print ("Bad keyword '$key' in config file. Aborting.\n");
+ exit 1;
+ }
+}
+
+# It's time to start some serious business. But first, we check that
+# all mandatory keywords have been specified.
+
+foreach my $keyword (@mandatory_keyword)
+{
+ if (!$config{$keyword})
+ {
+ print ("Mandatory keyword $keyword missing from config file.\n");
+ exit 1;
+ }
+}
+
+# All things clear? Great! Now we check if the package directory
+# exists.
+
+# ..chaos/$config{name}
+
+# Clean things up.
+
+cleanup ();
+
+
+
+
+ Emacs settings for chaos indentation
+
+
+ This is our .emacs settings for chaos indentation style for C
+ code. It makes writing compliant code much easier.
+
+
+
+
+ ;; chaos indentation style
+
+ (defconst chaos-c-style
+ '(
+ (c-basic-offset . 2)
+ (c-comment-only-line-offset . (0 . 0))
+ (c-comment-continuation-stars . "")
+ (c-hanging-comment-ender-p . t)
+ (c-offsets-alist . (
+ (statement-block-intro . +)
+ (knr-argdecl-intro . +)
+ (substatement-open . 0)
+ (label . 0)
+ (statement-cont . +)
+ (case-label . 2)
+ )
+ )
+ )
+ "chaos"
+ )
+
+ (defun chaos-c-mode-common-hook ()
+
+ ;; add my personal style and set it for the current buffer
+
+ (c-add-style "chaos" chaos-c-style t)
+
+ ;; this will make sure spaces are used instead of tabs
+
+ (setq indent-tabs-mode nil))
+
+ (add-hook 'c-mode-common-hook 'chaos-c-mode-common-hook)
+
+
+
diff --git a/documentation/coding-standards.xml b/documentation/coding-standards.xml
new file mode 100644
index 00000000..10cb8e4b
--- /dev/null
+++ b/documentation/coding-standards.xml
@@ -0,0 +1,534 @@
+
+The chaos Coding StandardsPerLundberg$Id$Introduction This is The chaos Coding Standards. It is a guide in programming
+ for the chaos operating system. If you intend to submit your
+ code, please adhere to these standards. This will save both you
+ and us some unnecessary work reformatting and rewriting the
+ code. It is very important to keep the same quality on all
+ code.
+ The code formatting chapters in this publication is mostly
+ C-related, but some of them can be used for other languages too.
+ Language choice Choosing the right language for a project is very important. If
+ you make a bad choice, it may render the program unusable for
+ some, or all, of its users. For example, if you choose a
+ language where a free interpreter/compiler is not available, few
+ people will be able to use it. So please, choose a language
+ which is usable. Another important aspect is to choose a
+ language as suitable for the project as possible. For example,
+ storm, the chaos kernel, is written in a C and assembly
+ combination. This is because those were the most suitable
+ languages - C is quite low-level, which is good for a kernel, and
+ assembly is almost necessary to use. But those considerations
+ may vary depending on your project type. For example, the
+ cAPS (chaos Advanced Packaging System) system
+ is written in a combination of C and Perl, since we found those
+ languages to be most suitable.
+ If you do not think you will be able to do the project all by
+ yourself, try using a language that is widely accepted (C, C++
+ and Perl are three good examples). Avoid using "smaller"
+ languages like Objective C or Haskell if possible.
+ License choice chaos is a free operating system, as defined by the FSF, and as
+ such, all parts of it must be free. However, they do not have to
+ be GPL, even though we encourage people to release their work
+ under this license. This is the list of acceptable licenses for
+ chaos:
+
+ GNU GPL (General public license) is
+ our preferred license for all code we write
+ except for the system
+ libraries. This is necessary to make licensing of chaos
+ programs under other free licenses possible. Use this
+ license if possible.
+ GNU LGPL (Lesser General Public
+ License) permits linkage between your work and
+ proprietary (closed-source, non-free) programs. We only
+ use this license for the system libraries. It is
+ deprecated for everything else.
+ BSD is the Berkeley Software
+ Distribution license. We do not use it, but you may use it
+ if, and only if, you remove the
+ advertising clause. We do not recommend using this license
+ anyway, since it is not a copyleft and thus does not
+ protect your freedom in a way we prefer, but we will
+ nevertheless accept if you decide to do so.
+ The Artistic license is the license
+ used by Perl. We do not encourage its usage except for
+ Perl-related things; in such cases, please follow the Perl
+ example and dual-license your code under both the Artistic
+ license and the GNU GPL.
+ The GNU FDL (Free Documentation License) is a pretty new
+ license from the Free Software Foundation. It is intended
+ for documentation, and should be used for that.
+
+ You do not need to give over the rights to your code to
+ us. Licensing it under one of those licenses is probably enough,
+ but be careful if you have signed a contract with your employer
+ stating they own everything you write. If so, you can not
+ legally license the code under GPL yourself. You must get
+ permission from your employer to do so. Please be careful with
+ these issues so neither you or we get into legal trouble.
+ Compiler flags The chaos build system, autochaos, automatically uses our
+ standard C flags, so there is little need to duplicate them
+ here. What our flags do is try to eliminate the pitfalls of the
+ C programming language (there are quite a few). The only really
+ important flag is -Werror, which turns all warnings into
+ errors. We believe this should have been the default in gcc. A
+ warning is nothing to take lightly. And really, if you do not
+ care about the warning, why don't you turn it off?
+ Symbol names All symbol names should be in lower-case only. The only
+ exception to this is acronyms like VGA, GDT, IDT etc, where you
+ could put the acronym in uppercase if you would like. Separate
+ logic words with underscores, like this: screen_base_address.
+ It is very important to be consequent when naming your
+ functions, variables and such. Do not abbreviate names. It only
+ makes it harder to figure out what a function or variable is
+ used for. Symbol names must always be
+ descriptive. One-name variables are neat for the lazy, but is a
+ no-no. Try to name your counter variables index (if you are
+ operating on a one-dimensional list), x and y (if a
+ two-dimensional structure), x, y and z, and so on. In short, try
+ to be as descriptive as possible. It is tempting at times to
+ call your variables i, j, k and such, but this just makes the
+ program more difficult for other people to get into.
+ All global symbols should have their file name prepended to
+ them. Thus, all the symbols exported from the file
+ port.c should be named port_*. When doing a
+ library, it is okay to split it up into smaller files and still
+ have the functions named foo_bar. (if the library name is foo)
+ Functions The usage of functions is standard in all structured
+ programming. You should try to keep your functions as long as
+ suitable. We do not give a specific limit, but try to split your
+ code in natural functions. For example, if your program is
+ reading and processing lines from a file, and the processing is
+ more than a few statements of code, put it in a separate
+ function. This is not really difficult when you get used to it.
+ Always put a comment before the function declaration where you
+ state what it does. It is also desirable that you document the
+ input and return variables if it is not implicit.
+ A typical function declaration can look like this:
+ /* Initialise the page allocation system. */
+
+ void page_init (void)
+ {
+ [...]
+ }
+ As you see, we do not put the function name in the leftmost
+ column. There is no reason to do so. It just makes the code look
+ ugly.
+ Also, if the function types and names do not fit on one line,
+ write it like this:
+ extern inline return_type system_call_thread_control
+ (process_id_type process_id, u32 class, u32 parameter)
+ Comments Code without comments is like an operating system without
+ applications -- it is not very usable. Try to comment your code
+ as much as suitable to understand it for a reasonably
+ experienced programmer. A good idea is to let someone else look
+ at your code and see where she gets stuck.
+ Always put comments on their own line, with a blank line above
+ and below. Do not put comments at the end of the line, after the
+ code; it just makes everything messy.
+ When commenting a statement, put the comment above the
+ statement, like this:
+ /* Check if we are ready yet. */
+
+ if (finished ())
+ {
+ return;
+ }
+ Some people like C++ comments. We prefer to only use them for
+ temporary commenting away code, so that they can not get
+ mistaken for being real comments.
+ Indentation The indentation level should be two spaces. Do not use
+ tabs. When starting a new block, the braces should be on their own line
+ at the same level of indentation as the previous line, like this:
+ if (age > LEGAL_AGE)
+ {
+ print_age (age);
+ }
+ Inline assembly Inline assembly is a twin-edged sword. It can make
+ computing-intensive programs a lot speedier, at the cost of
+ making the source more difficult to get into. Generally, only
+ use it if the speed gain is significant, or in the kernel and
+ other places where things might be impossible to do without
+ it. In general user programs there is little need for it, but
+ occasionally, it might be okay. The thumb rule is to start by
+ optimising the algorithms. If that is not enough, try to profile
+ your code and see where the most time is spent, and rewrite
+ those parts in assembly. If the gain is more than a few percent,
+ inline assembly is okay.
+ If you for one reason or another have to use inline assembly, do
+ it like this:
+ asm volatile
+ ("\
+ pushl %2
+ pushl %3
+ pushl %4
+ lcall %5, $0
+ "
+ : "=a" (return_value), "=g" (*buffer)
+ : "g" (buffer), "g" (parameter), "g" (class),
+ "n" (SYSTEM_CALL_KERNELFS_ENTRY_READ << 3));
+ Do not write long blocks of uncommented inline assembly, but
+ keep it into functional blocks separated with blank lines and
+ comments, so it is easier to get into the code.
+ Miscellaneous Here you will find stuff that did not fit into one of the
+ previous chapters:
+
+ When writing if-statements, always use braces to indicate
+ a block, even for one-line statements where it is not
+ required. Like this:
+ if (age > LEGAL_AGE)
+ {
+ print_age (age);
+ }
+ else
+ {
+ return;
+ }
+ When writing switch statements, always use braces in the
+ case blocks. Like this:
+ switch (key)
+ {
+ case ESCAPE:
+ {
+ return;
+ }
+ }
+ When writing conditional statements, never use the fact
+ that non-zero is TRUE. You can only do this on
+ booleans. If something is not a boolean, you must compare
+ it with a number. Like this:
+ if (get_age () != 0)
+ {
+ do_something ();
+ }
+ This makes things much clearer. The lack of real booleans
+ in C is showing, but using this fact makes your programs
+ very ugly.
+ When declaring external functions (in library header files
+ and elsewhere), always write like this:
+ extern my_function (void);
+ The extern attribute is not mandatory in gcc, but use it
+ anyway since it makes it very clear what we are talking about.
+
+ Whitespace A lot of programmers tend to forget how important whitespace is
+ to write good code. A good example of this can be found in the
+ Linux source code, but unfortunately, the practice is rather
+ common (especially in the Unix world). In chaos, we use as much
+ whitespace as is practical. Always use whitespace between
+ function names and parentheses, after commas, semicolons and
+ other places. Separate blocks of code with blank lines and
+ comments.
+ Documentation Documentation is essential for a program to succeed. All
+ documentation should be written in English (but may also be
+ translated to other languages if desirable). The standard format
+ for documentation in chaos is SGML using the DocBook DTD. You
+ can find more information about this DTD on
+ the DocBook Web Site.
+ ExamplesA C example/* $Id$ */
+/* Abstract: Semaphores for the kernel. */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA */
+
+#include <storm/i386/error_numbers.h>
+#include <storm/i386/semaphore.h>
+#include <storm/i386/thread.h>
+#include <storm/i386/types.h>
+#include <storm/state.h>
+
+/* Semaphore lock variable. 1 if none is accessing the semaphores, 0
+ if someone is. */
+
+static kernel_mutex_type semaphore_mutex = 1;
+
+error_type semaphore_wait (kernel_semaphore_type *semaphore)
+{
+ spin_lock (semaphore_mutex);
+
+ if (*semaphore <= 0)
+ {
+ spin_unlock (semaphore_mutex);
+ thread_block_semaphore (STATE_SEMAPHORE, semaphore);
+ return ERROR_UNKNOWN;
+ }
+ else
+ {
+ (*semaphore)--;
+ spin_unlock (semaphore_mutex);
+ }
+
+ return ERROR_UNKNOWN;
+}
+
+/* Release the lock around the given semaphore. */
+
+error_type semaphore_signal (kernel_semaphore_type *semaphore)
+{
+ spin_lock (semaphore_mutex);
+
+ if (thread_unblock_semaphore (semaphore) == ERROR_NO_THREAD_UNBLOCKED)
+ {
+ (*semaphore)++;
+ }
+
+ spin_unlock (semaphore_mutex);
+
+ return ERROR_UNKNOWN;
+}
+ A Perl example#!/usr/bin/perl -w
+
+# $Id$
+
+# Abstract: Program for building chaos packages.
+# Author: Per Lundberg <plundis@chaosdev.org>
+
+use chaos::cAPS;
+use strict;
+
+my $CONFIGFILE;
+
+# Abstract: Clean things up.
+
+sub cleanup
+{
+ close (CONFIGFILE);
+}
+
+my $cAPS = new chaos::cAPS ('/mnt/chaos/system/caps');
+my %config_keyword = $cAPS->config_keyword_get ();
+my %config;
+
+# All mandatory keywords are stored in this list.
+
+my @mandatory_keyword = ('name', 'type', 'version', 'description' );
+
+open (CONFIGFILE, '<chaos/config') or die "Couldn't open chaos/config.\n";
+
+# This is the main config file parser loop. Neat, isn't it? :) This
+# used to be written in flex/bison, and was rather complex and
+# difficult to get into. But now...
+
+while (<CONFIGFILE>)
+{
+ chop;
+ ($_, my $dummy) = split ('#');
+ (my $key, my $value) = /^([\w\-]+)\s*=\s*\"([^\"]*)\"/;
+
+ if (!$key || !$value)
+ {
+ print ("Syntax error in config file: $_.\n");
+ exit;
+ }
+
+ my $flag = 1;
+
+ foreach my $config_key (keys %config_keyword)
+ {
+ if ($config_keyword{$config_key} eq $key)
+ {
+ $config{$key} = $value;
+ $flag = 0;
+ }
+ }
+ if ($flag == 1)
+ {
+ print ("Bad keyword '$key' in config file. Aborting.\n");
+ exit 1;
+ }
+}
+
+# It's time to start some serious business. But first, we check that
+# all mandatory keywords have been specified.
+
+foreach my $keyword (@mandatory_keyword)
+{
+ if (!$config{$keyword})
+ {
+ print ("Mandatory keyword $keyword missing from config file.\n");
+ exit 1;
+ }
+}
+
+# All things clear? Great! Now we check if the package directory
+# exists.
+
+# ..chaos/$config{name}
+
+# Clean things up.
+
+cleanup ();
+ Emacs settings for chaos indentation This is our .emacs settings for chaos indentation style for C
+ code. It makes writing compliant code much easier.
+
+ ;; chaos indentation style
+
+ (defconst chaos-c-style
+ '(
+ (c-basic-offset . 2)
+ (c-comment-only-line-offset . (0 . 0))
+ (c-comment-continuation-stars . "")
+ (c-hanging-comment-ender-p . t)
+ (c-offsets-alist . (
+ (statement-block-intro . +)
+ (knr-argdecl-intro . +)
+ (substatement-open . 0)
+ (label . 0)
+ (statement-cont . +)
+ (case-label . 2)
+ )
+ )
+ )
+ "chaos"
+ )
+
+ (defun chaos-c-mode-common-hook ()
+
+ ;; add my personal style and set it for the current buffer
+
+ (c-add-style "chaos" chaos-c-style t)
+
+ ;; this will make sure spaces are used instead of tabs
+
+ (setq indent-tabs-mode nil))
+
+ (add-hook 'c-mode-common-hook 'chaos-c-mode-common-hook)
+
diff --git a/documentation/config.cache b/documentation/config.cache
new file mode 100644
index 00000000..c99a2a4e
--- /dev/null
+++ b/documentation/config.cache
@@ -0,0 +1,24 @@
+# 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.
+#
+ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
+ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
+ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
+ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
+ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
+ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
+ac_cv_prog_gcc=${ac_cv_prog_gcc=yes}
+ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes}
+ac_cv_prog_makeinfo=${ac_cv_prog_makeinfo=makeinfo}
+ac_cv_prog_sgml2html=${ac_cv_prog_sgml2html=sgml2html}
diff --git a/documentation/configure b/documentation/configure
new file mode 100755
index 00000000..b0cf2c0b
--- /dev/null
+++ b/documentation/configure
@@ -0,0 +1,4334 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.60.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 &1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="coding-standards.sgml"
+ac_default_prefix=/mnt/chaos
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+SET_MAKE
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+CPP
+makeinfo
+sgml2html
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -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_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$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 ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval enable_$ac_feature=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ 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 | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$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 ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ 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 | -n)
+ 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 ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$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 ;;
+
+ -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_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval with_$ac_package=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ 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 "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# 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 the parent directory.
+ ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ 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
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # 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 <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --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
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L if you have libraries in a
+ nonstandard directory
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if
+ you have headers in a nonstandard directory
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" || continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.60
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.60. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+am__api_version="1.4"
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$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
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# 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
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# 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"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /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
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_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. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&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}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# 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 "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f conftest*
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+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"
+# Double any \ or $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ SET_MAKE=
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+PACKAGE=documentation
+
+VERSION=0.0.0
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+{ echo "$as_me:$LINENO: checking for working aclocal-${am__api_version}" >&5
+echo $ECHO_N "checking for working aclocal-${am__api_version}... $ECHO_C" >&6; }
+# 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-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal-${am__api_version}
+ { echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6; }
+else
+ ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
+ { echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for working autoconf" >&5
+echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6; }
+# 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 "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6; }
+else
+ AUTOCONF="$missing_dir/missing autoconf"
+ { echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for working automake-${am__api_version}" >&5
+echo $ECHO_N "checking for working automake-${am__api_version}... $ECHO_C" >&6; }
+# 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-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+ AUTOMAKE=automake-${am__api_version}
+ { echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6; }
+else
+ AUTOMAKE="$missing_dir/missing automake-${am__api_version}"
+ { echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for working autoheader" >&5
+echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6; }
+# 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 "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6; }
+else
+ AUTOHEADER="$missing_dir/missing autoheader"
+ { echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for working makeinfo" >&5
+echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6; }
+# 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 "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6; }
+else
+ MAKEINFO="$missing_dir/missing makeinfo"
+ { echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6; }
+fi
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ fi
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_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 $# != 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
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&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
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+#include
+#include
+#include
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ xno)
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer to if __STDC__ is defined, since
+ # exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer to if __STDC__ is defined, since
+ # exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include
+#else
+# include
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ SET_MAKE=
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+# Extract the first word of "makeinfo", so it can be a program name with args.
+set dummy makeinfo; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_makeinfo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$makeinfo"; then
+ ac_cv_prog_makeinfo="$makeinfo" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_makeinfo="makeinfo"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+makeinfo=$ac_cv_prog_makeinfo
+if test -n "$makeinfo"; then
+ { echo "$as_me:$LINENO: result: $makeinfo" >&5
+echo "${ECHO_T}$makeinfo" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+
+if [ x$makeinfo != xmakeinfo ]; then
+ echo -e "\nError: You must have makeinfo to compile the documentation. It can be found"
+ echo -e "at your favourite GNU mirror.\n"
+ exit 1
+fi
+
+
+# Extract the first word of "sgml2html", so it can be a program name with args.
+set dummy sgml2html; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_sgml2html+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$sgml2html"; then
+ ac_cv_prog_sgml2html="$sgml2html" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_sgml2html="sgml2html"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+sgml2html=$ac_cv_prog_sgml2html
+if test -n "$sgml2html"; then
+ { echo "$as_me:$LINENO: result: $sgml2html" >&5
+echo "${ECHO_T}$sgml2html" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+
+if [ x$sgml2html != xsgml2html ]; then
+ echo -e "\nError: You must have sgml-tools to compile the documentation. It can be found"
+ echo -e "at http://pobox.com/~cg/sgmltools.\n"
+ exit 1
+fi
+
+
+
+ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
+# 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, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# 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.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.60. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to ."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.60,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
+ export CONFIG_SHELL
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+CPP!$CPP$ac_delim
+makeinfo!$makeinfo$ac_delim
+sgml2html!$sgml2html$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 60; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$ac_file_inputs $ac_f"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input="Generated from "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+ esac
+ ;;
+
+
+
+ esac
+
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+
+
diff --git a/documentation/configure.in b/documentation/configure.in
new file mode 100644
index 00000000..ebf59667
--- /dev/null
+++ b/documentation/configure.in
@@ -0,0 +1,56 @@
+dnl $Id$
+dnl Autoconf script for the documentation.
+
+dnl Copyright 1999 chaos development.
+dnl Author: Per Lundberg .
+
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+AC_INIT
+AC_CONFIG_SRCDIR([coding-standards.sgml])
+AM_INIT_AUTOMAKE(documentation, 0.0.0)
+AC_PREFIX_DEFAULT(/mnt/chaos)
+
+dnl Check for the programs we need.
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_MAKE_SET
+
+AC_CHECK_PROG(makeinfo, makeinfo, makeinfo)
+
+[
+if [ x$makeinfo != xmakeinfo ]; then
+ echo -e "\nError: You must have makeinfo to compile the documentation. It can be found"
+ echo -e "at your favourite GNU mirror.\n"
+ exit 1
+fi
+]
+
+AC_CHECK_PROG(sgml2html, sgml2html, sgml2html)
+
+[
+if [ x$sgml2html != xsgml2html ]; then
+ echo -e "\nError: You must have sgml-tools to compile the documentation. It can be found"
+ echo -e "at http://pobox.com/~cg/sgmltools.\n"
+ exit 1
+fi
+]
+
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+
+
diff --git a/documentation/dataarea.txt b/documentation/dataarea.txt
new file mode 100644
index 00000000..20b20606
--- /dev/null
+++ b/documentation/dataarea.txt
@@ -0,0 +1,19 @@
+
+The storm data area is used to hold information collected in real mode to be
+used in protected mode later. This is the layout of the storm data area:
+
+
+(bytes)
+
+ offset | length | purpose
+-----------+------------+-----------------------------------------------------
+ 0 | 4 | linear pointer to the multiboot data area
+ 132 | 1 | type of display used (0 = text, 1 = graphic).
+ 133 | 2 | vertical resoultion (characters if display type = 0,
+ | | or else pixels).
+ 135 | 2 | the same thing, but horizontal resoulution.
+ 137 | 512 | vesa info buffer (standard vesa supervga information
+ | | buffer).
+
+The kernel data area is located at linear address 0x3000 and is one page big
+(4096 bytes).
diff --git a/documentation/docbook2html b/documentation/docbook2html
new file mode 100755
index 00000000..1db8cbba
--- /dev/null
+++ b/documentation/docbook2html
@@ -0,0 +1,77 @@
+#! /bin/sh
+
+CATALOG=/etc/sgml.catalog
+DB_STYLESHEET=chaos-both.dsssl
+
+output=db2html-dir
+TMPDIR=DBTOHTML_OUTPUT_DIR$$
+
+echo TMPDIR is $TMPDIR
+
+# Dave Mason's option to specify a different stylesheet
+case $1 in
+ -d) DB_STYLESHEET=$2
+ shift 2
+ ;;
+esac
+
+echo "Using stylesheet: \"${DB_STYLESHEET}\""
+
+if [ $# -gt 2 ]
+then
+ echo "Usage: `basename $0` [filename.sgml]" >&2
+ exit 1
+fi
+
+if [ $# -eq 1 ]
+then
+ if [ ! -r $1 ]
+ then
+ echo Cannot read \"$1\". Exiting. >&2
+ exit 1
+ fi
+ if echo $1 | egrep -i '\.sgml$|\.sgm$' >/dev/null 2>&1
+ then
+ # now make sure that the output directory is always a subdirectory
+ # of hte current directory
+ echo
+ input_file=`basename $1`
+ output="`echo $input_file | sed 's,\.sgml$,,;s,\.sgm$,,'`"
+ echo "input file was called $input_file -- output will be in $output"
+ echo
+ fi
+fi
+
+# we used to generate a single file, but with the modular DB_STYLESHEETs
+# it's best to make a new directory with several html files in it
+#cat $* | jade -d $DB_STYLESHEET -t sgml -V nochunks > $TMPFN
+
+mkdir $TMPDIR
+SAVE_PWD=`pwd`
+if [ $1 = `basename $1` ]; then
+ echo "working on ../$1"
+ (cd $TMPDIR; jade -c $CATALOG -t sgml -ihtml -d ${DB_STYLESHEET}\#html ../$1; cd $SAVE_PWD)
+else
+ echo "working on $1"
+ (cd $TMPDIR; jade -c $CATALOG -t sgml -ihtml -d ${DB_STYLESHEET}\#html $1; cd $SAVE_PWD)
+fi
+
+if [ $# -eq 1 ]
+then
+ if [ -d ${output}.junk ]
+ then
+ /bin/rm -rf ${output}.junk
+ fi
+ if [ -d ${output} ]
+ then
+ mv $output ${output}.junk
+ fi
+ echo "about to rename temporary directory to $output"
+ mv ${TMPDIR} $output
+else
+ cat $TMPDIR/*
+fi
+
+rm -rf $TMPDIR
+
+exit 0
diff --git a/documentation/filesystem-hierarchy.sgml b/documentation/filesystem-hierarchy.sgml
new file mode 100644
index 00000000..5fdefd5a
--- /dev/null
+++ b/documentation/filesystem-hierarchy.sgml
@@ -0,0 +1,161 @@
+
+
+
+chaos Filesystem Hierarchy Standard
+chaos development, $Id$
+
+
+This is the chaos Filesystem Hierarchy Standard. In here, we try to
+document the filsystem hierarchy used by the chaos Operating
+System. See the section for more
+information about this.
+
+
+
+Prologue
diff --git a/documentation/gdt.txt b/documentation/gdt.txt
new file mode 100644
index 00000000..d08896fd
--- /dev/null
+++ b/documentation/gdt.txt
@@ -0,0 +1,30 @@
+
+ Layout Of The GDT In storm
+---------------------------------------
+
+0 NULL descriptor
+1 Flat data (DS in the kernel)
+2 Kernel code (CS in the kernel)
+3 Kernel stack (SS in the kernel)
+4 Kernel TSS
+5-n Syscalls
+n TSS of first task
+n+1 LDT of first task
+...
+
+
+ NEW LAYOUT
+---------------------------------------
+
+0 NULL descriptor
+1 Kernel data (ds in the kernel)
+2 Kernel code (cs in the kernel)
+3 Reserved
+4 Linear code segment (used for processes)
+5 Linear data segment (used for processes)
+6 Reserved
+7 Process TSS1
+8 Process TSS2
+9-15 Reserved
+16-47 Exception task gates
+48-n Syscall call gates
diff --git a/documentation/install-sh b/documentation/install-sh
new file mode 100755
index 00000000..e9de2384
--- /dev/null
+++ b/documentation/install-sh
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/documentation/installation.sgml b/documentation/installation.sgml
new file mode 100644
index 00000000..08fbe543
--- /dev/null
+++ b/documentation/installation.sgml
@@ -0,0 +1,280 @@
+
+
+
+
+
+ Installation of chaos
+
+
+ Per
+ Lundberg
+
+
+ $Id$
+
+
+
+ Introduction
+
+
+ chaos is, as you probably know, an operating system written
+ totally from scratch by a bunch of Swedish (and others)
+ hackers. Right now, we have not come as far as to write an
+ installation program, so getting chaos onto your computer is not
+ as straightforward as it could be. In this paper, you will be
+ able to get some information about the different methods of
+ setting things up. Hopefully, after reading this, you will find
+ setting chaos up pretty trivial. In any way, please do not
+ hesitate to mail staff@chaosdev.org if this information is wrong
+ in any way.
+
+
+
+ Now, as you will see, there are several methods of trying out
+ chaos. They have one chapter each, and are listed in order of
+ complexity.
+
+
+
+
+
+ Installing a floppy image
+
+
+ Using a floppy image to try out chaos is very easy. All you have
+ to do is to download the floppy image (from our download page on
+ http://www.chaosdev.org, or via anonymous FTP from
+ ftp://ftp.chaosdev.org/chaos). Now, gunzip it if your web
+ browser did not do it auto-magically (Netscape Navigator does
+ that, and possible others too). If you do not have a program for
+ decompressing gz files, get one from
+ ftp://ftp.gnu.org/pub/gnu/gzip.
+
+
+
+ When you have decompressed the floppy image, get it onto a 1.44
+ 3,5" floppy. If you are using DOS or Windows, get the
+ rawrite2.exe program from ftp://ftp.chaosdev.org/dosutils. Write
+ like this:
+
+
+
+ rawrite2 -f floppy.img -d a:
+
+
+
+ (Give the floppy image a letter within the 8.3 range to avoid
+ problems; rawrite is a DOS program with no support for long file
+ names.)
+
+
+
+ If you are using some kind of Unix (most probably Linux or some
+ of the BSD systems. Anything else is probably out of the scope
+ of this document, and if you are using such a system, you should
+ be skilled enough to do such things anyway), do like this:
+
+
+
+ dd if=floppy.image of=/dev/fd0
+
+
+
+ If using BSD-derived systems, you will need to use /dev/fd0c
+ instead. Anyway, that is all! Now, boot a computer with this
+ floppy, and something magic will (hopefully) appear. Much joy!
+
+
+
+
+ Compiling the source
+
+
+ Do you feel tired of waiting for us to update the floppy images,
+ or do you feel to do some chaos hacking? If so, compiling the
+ source is probably of interest. It is really not very
+ difficult. First, get the sources, and decompress them. Do
+ something like this:
+
+
+
+ tar xvIf chaos_snapshot-20001224.tar.bz2
+
+
+
+ (You must have a pretty recent GNU tar and a working bzip2 for
+ this to work. If you are using an older version of tar, you
+ might have to decompress the file manually first. Read the man
+ pages for your bzip2 and tar programs for more information.)
+
+
+
+ Now, go to the newly created chaos directory, and read the file
+ README.Linux. It will contain up-to-date instructions for
+ building the system.
+
+
+
+ If everything works out fine, your chaos root (/mnt/chaos is the
+ only possible choice right now -- sorry about that) will be
+ filled with new, fresh stuff. It is not really more difficult
+ than this.
+
+
+
+
+ Net-booting
+
+
+ The absolutely most elegant way to boot chaos, especially when
+ developing the system, is to use the net-boot feature of GNU
+ GRUB, our boot loader. It is a little tricky to get up, so we
+ provide some information for your pleasure.
+
+
+
+ This chapter will tell you how to get GNU GRUB with net-boot
+ installed on a floppy, but you should be able to do the same if
+ you want to install GNU GRUB on your hard drive. The reason we
+ are primarily focusing on doing a floppy is because it is
+ easier, and it will make most people happy. In the future, it is
+ very likely that we will extend this appendix to include
+ information about installating onto hard drives.
+
+
+
+ First, you must choose which method you want to use to configure
+ the IP address of the system you want to net-boot on (hereafter
+ referred to as the client). This is used to select which
+ software to install on the machine you want to boot from
+ (hereafter called the server). The methods available in GNU GRUB
+ right now are rarpd, bootp and DHCP. They all work pretty
+ similarly, so if you are unsure of which one to choose, just
+ pick anyone. If you happen to be on a network where a DHCP or
+ bootp server already exists, you can be a little tricky and
+ install a rarpd server, without risk of interfering with the
+ other server. (You can find all the software you need for this
+ at http://www.freshmeat.net/)
+
+
+
+ When you have got the IP configuration server up and running, it
+ is time to install a TFTP server. TFTP is an acronym for Trivial
+ File Transfer Protocol and is used by GNU GRUB to transfer the
+ kernel and servers from the boot server. You can find TFTP
+ servers at the same place as the rest of the software.
+
+
+
+ (I will not go into detail about how to configure the software
+ here, but I will just mention one thing I would like you to
+ avoid: GNU GRUB does not support "IP ranges" in the DHCP server
+ configuration. You must have a host entry for the machine in
+ question).
+
+
+
+ Okay, so you might have succeeded in getting rarpd/bootpd/dhcpd
+ and tftpd installed, but where do we go from here? This is
+ where it starts getting interesting. Unpack the GNU GRUB source,
+ change to the newly created directory and write like this:
+
+
+
+ ./configure --help | less
+
+
+
+ Now, make sure your network adapter is supported by GRUB. If it
+ is, run configure again, with the correct parameter. For
+ example, like this:
+
+
+
+ ./configure --enable-rtl8139
+
+
+
+ Now, run the 'make', which will compile the GRUB stage1 and
+ stage2 files. For information about how to install the created
+ files, check the GNU GRUB documentation. Basically, format the
+ floppy (FAT or ext2 is just fine) and copy the stage1 and stage2
+ files there. Now, run the GRUB shell and write something like
+ this:
+
+
+
+ install (fd0)/stage1 (fd0) (fd0)/stage2 (fd0)/menu
+
+
+
+ Now, create a file on the floppy, called menu. It should look
+ like this:
+
+
+
+ timeout = 1
+ title = Netboot
+ dhcp
+ configfile (nd)/mnt/chaos/config/grub/menu
+
+
+
+ Substitute dhcp with bootp or rarp if you like. Now, boot with
+ this floppy, and it will (hopefully) configure its IP address
+ and load the second configuration file from the server.
+
+
+
+
+ Example GNU GRUB menu file
+
+ This is what I use on my net-boot server:
+
+
+
+timeout = 2
+
+title Net-chaos
+root (nd)
+kernel /mnt/chaos/system/kernel/storm
+module /mnt/chaos/system/servers/keyboard
+module /mnt/chaos/system/servers/vga
+module /mnt/chaos/system/servers/console
+module /mnt/chaos/system/servers/log
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/initial_ramdisk
+module /mnt/chaos/system/servers/fat
+module /mnt/chaos/system/servers/virtual_file_system
+module /mnt/chaos/system/servers/pci
+module /mnt/chaos/system/servers/serial
+module /mnt/chaos/system/servers/boot
+module /mnt/chaos/system/servers/tornado
+
+
+
+ This is what I use when booting chaos locally:
+
+
+
+title chaos
+root (hd0,2)
+kernel /mnt/chaos/system/kernel/storm
+module /mnt/chaos/system/servers/keyboard
+module /mnt/chaos/system/servers/console
+module /mnt/chaos/system/servers/vga
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/log
+module /mnt/chaos/system/servers/idle
+module /mnt/chaos/system/servers/fat
+module /mnt/chaos/system/servers/initial_ramdisk
+module /mnt/chaos/system/servers/virtual_file_system
+module /mnt/chaos/system/servers/ipv4
+module /mnt/chaos/system/servers/3c509
+module /mnt/chaos/system/servers/boot
+
+
+
\ No newline at end of file
diff --git a/documentation/installation.txt b/documentation/installation.txt
new file mode 100644
index 00000000..00a0e2fe
--- /dev/null
+++ b/documentation/installation.txt
@@ -0,0 +1,195 @@
+
+Installation of chaos
+
+Per Lundberg
+ _________________________________________________________________
+
+ Table of Contents
+ Introduction
+ 1. Installing a floppy image
+ 2. Compiling the source
+ A. Net-booting
+ B. Example GNU GRUB menu file
+ _________________________________________________________________
+
+Introduction
+
+ chaos is, as you probably know, an operating system written totally
+ from scratch by a bunch of Swedish (and others) hackers. Right now, we
+ have not come as far as to write an installation program, so getting
+ chaos onto your computer is not as straightforward as it could be. In
+ this paper, you will be able to get some information about the
+ different methods of setting things up. Hopefully, after reading this,
+ you will find setting chaos up pretty trivial. In any way, please do
+ not hesitate to mail staff@chaosdev.org if this information is wrong
+ in any way.
+
+ Now, as you will see, there are several methods of trying out chaos.
+ They have one chapter each, and are listed in order of complexity.
+ _________________________________________________________________
+
+Chapter 1. Installing a floppy image
+
+ Using a floppy image to try out chaos is very easy. All you have to do
+ is download the floppy image (from our download page on
+ http://www.chaosdev.org, or via anonymous FTP to
+ ftp://ftp.chaosdev.org/chaos). Now, gunzip it if your web browser did
+ not do it auto-magically (Netscape Navigator does that, and possible
+ others too). If you do not have a program for decompressing gz files,
+ get one from ftp://ftp.gnu.org/pub/gnu/gzip.
+
+ When you have decompressed the floppy image, get it onto a 1.44 3,5"
+ floppy. If you are using DOS or Windows, get the rawrite2.exe program
+ from ftp://ftp.chaosdev.org/dosutils. Write like this:
+ rawrite2 -f floppy.img -d a:
+
+
+ (Give the floppy image a letter within the 8.3 range to avoid
+ problems; rawrite is a DOS program with no support for long file
+ names)
+
+ If you are using some kind of Unix (most probably Linux or some of the
+ BSD:s. Anything else is probably out of the scope of this document,
+ and if you are using such a system, you should be skilled enough to do
+ such things anyway), do like this:
+ dd if=floppy.image of=/dev/fd0
+
+
+ And that is all! Now, boot a computer with this floppy, and something
+ magic will (hopefully) appear. Much joy!
+ _________________________________________________________________
+
+Chapter 2. Compiling the source
+
+ Do you feel tired of waiting for us to update the floppy images, or do
+ you feel to do some chaos hacking? If so, compiling the source is
+ probably of interest. It is really not very difficult. First, get the
+ sources, and decompress them. Do something like this:
+ tar xvIf chaos_snapshot-20001224.tar.bz2
+
+
+ (You must have a pretty recent tar and a working bzip2 for this to
+ work. If you are using and older version of tar, you might have to
+ decompress the file manually first)
+
+ Now, go to the newly created chaos directory, and read the file
+ README.Linux. It will contain up-to-date instructions for building the
+ system.
+
+ If everything works out fine, your chaos root (/mnt/chaos is the only
+ possible choice right now -- sorry about that) will be filled with
+ new, fresh stuff. It is not really more difficult than this.
+ _________________________________________________________________
+
+Appendix A. Net-booting
+
+ The absolutely most elegant way to boot chaos, especially when
+ developing the system, is to use the net-boot feature of GNU GRUB, our
+ boot loader. It is a little tricky to get up, so we provide some
+ information for your pleasure.
+
+ This chapter will tell you how to get GNU GRUB with net-boot installed
+ on a floppy, but you should be able to do the same if you want to
+ install GNU GRUB on your hard drive. The reason we are primarily
+ focusing on doing a floppy is because it is easier, and it will make
+ most people happy. In the future, it is very likely that we will
+ extend this chapter to include this information.
+
+ First, you must choose which method you want to use to configure the
+ IP address of the system you want to net-boot on (hereafter referred
+ to as the client). This is used to select which software to install on
+ the machine you want to boot from (hereafter called the server). The
+ methods available in GNU GRUB right now are rarpd, bootp and DHCP.
+ They all work pretty similarly, so if you are unsure of which one to
+ choose, just pick anyone. If you happen to be on a network where a
+ DHCP or bootp server already exists, you can be a little tricky and
+ install a rarpd server, without risk of interfering with the other
+ server. (You can find all the software you need for this at
+ http://www.freshmeat.net/)
+
+ When you have got the IP configuration server up and running, it is
+ time to install a TFTP server. TFTP is an acronym for Trivial File
+ Transfer Protocol and is used by GNU GRUB to transfer the kernel and
+ servers from the boot server. You can find TFTP servers at the same
+ place as the rest of the software.
+
+ (I will not go into detail about how to configure the software here,
+ but I will just mention one thing I would like you to avoid: GNU GRUB
+ does not support "IP ranges" in the DHCP server configuration. You
+ must have a host entry for the machine in question).
+
+ Okay, so you might have succeeded in getting rarpd/bootpd/dhcpd and
+ tftpd installed, but where do we go from there? This is where it
+ starts getting interesting. Unpack the GNU GRUB source, change to the
+ newly created directory and write like this:
+ ./configure --help | less
+
+
+ Now, make sure your network adapter is supported by GRUB. If it is,
+ run configure again, with the correct parameter. For example, like
+ this:
+ ./configure --enable-rtl8139
+
+
+ Now, run the 'make', which will compile the GRUB stage1 and stage2
+ files. For information about how to install the created files, check
+ the GNU GRUB documentation. Basically, format the floppy (FAT or ext2
+ is just fine) and copy the stage1 and stage2 files there. Now, run the
+ GRUB shell and write something like this:
+ install (fd0)/stage1 (fd0) (fd0)/stage2 (fd0)/menu
+
+
+ Now, create a file on the floppy, called menu. It should look like
+ this:
+ timeout = 1
+ title = Netboot
+ dhcp
+ configfile (nd)/mnt/chaos/config/grub/menu
+
+
+ Substitute dhcp with bootp or rarp if you like. Now, boot with this
+ floppy, and it will (hopefully) configure its IP address and load the
+ second configuration file from the server.
+ _________________________________________________________________
+
+Appendix B. Example GNU GRUB menu file
+
+ This is what I use on my net-boot server:
+timeout = 2
+
+title Net-chaos
+root (nd)
+kernel /mnt/chaos/system/kernel/storm
+module /mnt/chaos/system/servers/keyboard
+module /mnt/chaos/system/servers/vga
+module /mnt/chaos/system/servers/console
+module /mnt/chaos/system/servers/log
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/initial_ramdisk
+module /mnt/chaos/system/servers/fat
+module /mnt/chaos/system/servers/virtual_file_system
+module /mnt/chaos/system/servers/pci
+module /mnt/chaos/system/servers/serial
+module /mnt/chaos/system/servers/boot
+module /mnt/chaos/system/servers/tornado
+
+
+ This is what I use when booting chaos locally:
+title chaos
+root (hd0,2)
+kernel /mnt/chaos/system/kernel/storm
+module /mnt/chaos/system/servers/keyboard
+module /mnt/chaos/system/servers/console
+module /mnt/chaos/system/servers/vga
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/log
+module /mnt/chaos/system/servers/idle
+module /mnt/chaos/system/servers/fat
+module /mnt/chaos/system/servers/initial_ramdisk
+module /mnt/chaos/system/servers/virtual_file_system
+module /mnt/chaos/system/servers/ipv4
+module /mnt/chaos/system/servers/3c509
+module /mnt/chaos/system/servers/boot
diff --git a/documentation/installation.xml b/documentation/installation.xml
new file mode 100644
index 00000000..bffebfb8
--- /dev/null
+++ b/documentation/installation.xml
@@ -0,0 +1,282 @@
+
+
+
+
+
+
+ Installation of chaos
+
+
+ Per
+ Lundberg
+
+
+ $Id$
+
+
+
+ Introduction
+
+
+ chaos is, as you probably know, an operating system written
+ totally from scratch by a bunch of Swedish (and others)
+ hackers. Right now, we have not come as far as to write an
+ installation program, so getting chaos onto your computer is not
+ as straightforward as it could be. In this paper, you will be
+ able to get some information about the different methods of
+ setting things up. Hopefully, after reading this, you will find
+ setting chaos up pretty trivial. In any way, please do not
+ hesitate to mail staff@chaosdev.org if this information is wrong
+ in any way.
+
+
+
+ Now, as you will see, there are several methods of trying out
+ chaos. They have one chapter each, and are listed in order of
+ complexity.
+
+
+
+
+
+ Installing a floppy image
+
+
+ Using a floppy image to try out chaos is very easy. All you have
+ to do is download the floppy image (from our download page on
+ http://www.chaosdev.org, or via anonymous FTP from
+ ftp://ftp.chaosdev.org/chaos). Now, gunzip it if your web browser did
+ not do it auto-magically (Netscape Navigator does that, and
+ possible others too). If you do not have a program for
+ decompressing gz files, get one from
+ ftp://ftp.gnu.org/pub/gnu/gzip.
+
+
+
+ When you have decompressed the floppy image, get it onto a 1.44
+ 3,5" floppy. If you are using DOS or Windows, get the
+ rawrite2.exe program from ftp://ftp.chaosdev.org/dosutils. Write
+ like this:
+
+
+
+ rawrite2 -f floppy.img -d a:
+
+
+
+ (Give the floppy image a letter within the 8.3 range to avoid
+ problems; rawrite is a DOS program with no support for long file
+ names.)
+
+
+
+ If you are using some kind of Unix (most probably Linux or some
+ of the BSD systems. Anything else is probably out of the scope
+ of this document, and if you are using such a system, you should
+ be skilled enough to do such things anyway), do like this:
+
+
+
+ dd if=floppy.image of=/dev/fd0
+
+
+
+ If using BSD-derived systems, you will need to use /dev/fd0c
+ instead. Anyway, that is all! Now, boot a computer with this
+ floppy, and something magic will (hopefully) appear. Much joy!
+
+
+
+
+ Compiling the source
+
+
+ Do you feel tired of waiting for us to update the floppy images,
+ or do you feel to do some chaos hacking? If so, compiling the
+ source is probably of interest. It is really not very
+ difficult. First, get the sources, and decompress them. Do
+ something like this:
+
+
+
+ tar xvIf chaos_snapshot-20001224.tar.bz2
+
+
+
+ (You must have a pretty recent GNU tar and a working bzip2 for
+ this to work. If you are using an older version of tar, you
+ might have to decompress the file manually first. Read the man
+ pages for your bzip2 and tar programs for more information.)
+
+
+
+ Now, go to the newly created chaos directory, and read the file
+ README.Linux. It will contain up-to-date instructions for
+ building the system.
+
+
+
+ If everything works out fine, your chaos root (/mnt/chaos is the
+ only possible choice right now -- sorry about that) will be
+ filled with new, fresh stuff. It is not really more difficult
+ than this.
+
+
+
+
+ Net-booting
+
+
+ The absolutely most elegant way to boot chaos, especially when
+ developing the system, is to use the net-boot feature of GNU
+ GRUB, our boot loader. It is a little tricky to get up, so we
+ provide some information for your pleasure.
+
+
+
+ This chapter will tell you how to get GNU GRUB with net-boot
+ installed on a floppy, but you should be able to do the same if
+ you want to install GNU GRUB on your hard drive. The reason we
+ are primarily focusing on doing a floppy is because it is
+ easier, and it will make most people happy. In the future, it is
+ very likely that we will extend this appendix to include
+ information about installating onto hard drives too.
+
+
+
+ First, you must choose which method you want to use to configure
+ the IP address of the system you want to net-boot on (hereafter
+ referred to as the client). This is used to select which
+ software to install on the machine you want to boot from
+ (hereafter called the server). The methods available in GNU GRUB
+ right now are rarpd, bootp and DHCP. They all work pretty
+ similarly, so if you are unsure of which one to choose, just
+ pick anyone. If you happen to be on a network where a DHCP or
+ bootp server already exists, you can be a little tricky and
+ install a rarpd server, without risk of interfering with the
+ other server. (You can find all the software you need for this
+ at http://www.freshmeat.net/)
+
+
+
+ When you have got the IP configuration server up and running, it
+ is time to install a TFTP server. TFTP is an acronym for Trivial
+ File Transfer Protocol and is used by GNU GRUB to transfer the
+ kernel and servers from the boot server. You can find TFTP
+ servers at the same place as the rest of the software.
+
+
+
+ (I will not go into detail about how to configure the software
+ here, but I will just mention one thing I would like you to
+ avoid: GNU GRUB does not support "IP ranges" in the DHCP server
+ configuration. You must have a host entry for the machine in
+ question).
+
+
+
+ Okay, so you might have succeeded in getting rarpd/bootpd/dhcpd
+ and tftpd installed, but where do we go from here? This is
+ where it starts getting interesting. Unpack the GNU GRUB source,
+ change to the newly created directory and write like this:
+
+
+
+ ./configure --help | less
+
+
+
+ Now, make sure your network adapter is supported by GRUB. If it
+ is, run configure again, with the correct parameter. For
+ example, like this:
+
+
+
+ ./configure --enable-rtl8139
+
+
+
+ Now, run the 'make', which will compile the GRUB stage1 and
+ stage2 files. For information about how to install the created
+ files, check the GNU GRUB documentation. Basically, format the
+ floppy (FAT or ext2 is just fine) and copy the stage1 and stage2
+ files there. Now, run the GRUB shell and write something like
+ this:
+
+
+
+ install (fd0)/stage1 (fd0) (fd0)/stage2 (fd0)/menu
+
+
+
+ Now, create a file on the floppy, called menu. It should look
+ like this:
+
+
+
+ timeout = 1
+ title = Netboot
+ dhcp
+ configfile (nd)/mnt/chaos/config/grub/menu
+
+
+
+ Substitute dhcp with bootp or rarp if you like. Now, boot with
+ this floppy, and it will (hopefully) configure its IP address
+ and load the second configuration file from the server.
+
+
+
+
+ Example GNU GRUB menu file
+
+ This is what I use on my net-boot server:
+
+
+
+timeout = 2
+
+title Net-chaos
+root (nd)
+kernel /mnt/chaos/system/kernel/storm
+module /mnt/chaos/system/servers/keyboard
+module /mnt/chaos/system/servers/vga
+module /mnt/chaos/system/servers/console
+module /mnt/chaos/system/servers/log
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/initial_ramdisk
+module /mnt/chaos/system/servers/fat
+module /mnt/chaos/system/servers/virtual_file_system
+module /mnt/chaos/system/servers/pci
+module /mnt/chaos/system/servers/serial
+module /mnt/chaos/system/servers/boot
+module /mnt/chaos/system/servers/tornado
+
+
+
+ This is what I use when booting chaos locally:
+
+
+
+title chaos
+root (hd0,2)
+kernel /mnt/chaos/system/kernel/storm
+module /mnt/chaos/system/servers/keyboard
+module /mnt/chaos/system/servers/console
+module /mnt/chaos/system/servers/vga
+module /mnt/chaos/system/servers/cluido
+module /mnt/chaos/system/servers/log
+module /mnt/chaos/system/servers/idle
+module /mnt/chaos/system/servers/fat
+module /mnt/chaos/system/servers/initial_ramdisk
+module /mnt/chaos/system/servers/virtual_file_system
+module /mnt/chaos/system/servers/ipv4
+module /mnt/chaos/system/servers/3c509
+module /mnt/chaos/system/servers/boot
+
+
+
\ No newline at end of file
diff --git a/documentation/ipc.txt b/documentation/ipc.txt
new file mode 100644
index 00000000..f93dbc05
--- /dev/null
+++ b/documentation/ipc.txt
@@ -0,0 +1,111 @@
+I. IPC primitives
+
+ The following proposed IPC mechanism supplies two different primitives: messages and events.
+Both of the primitives conform to similar interfaces (they are sent and received) with the exception of
+the semantics of how they are actually sent. The first part of this proposal describes the "send" and
+"receive" semantics of messages followed by events and then continues to outline some useful or somewhat
+necessary extensions to these concepts.
+
+II. Messages
+
+ Messages are an unbuffered, synchronous form of IPC. At the interface level, they are strings
+of data with associated lengths up to some fixed size. This data is copied directly from the sender's
+message buffer to the receiver's buffer which imposes their synchronous restriction that both
+the sender and receiver must be blocked until one acknowledges the other. The implementation would
+possibly work as follows:
+
+ * N + 1 page table entries would be reserved for IPC in each address space to accomodate
+ messages up to N pages long (the extra entry is to handle messages not aligned on pages).
+ These pages would always be marked supervisor and read-write.
+
+ * The sender attempts to send a message to some arbitrary receiver. If the receiver is not
+ in a RECEIVE_BLOCKED state induced by attempting to receive a message, the sender enters
+ a SEND_BLOCKED state until the receiver actually tries to receive a message.
+
+ * The receiver attempt to receive a message from some arbitrary sender. If there are no qualifying
+ senders in a SEND_BLOCKED state, the receiver enters a RECEIVE_BLOCKED state subject to the above
+ conditions until a message is sent from a qualifying sender.
+
+ * Once either a receiver in a RECEIVE_BLOCKED state is sent a message from a qualifying sender
+ or a sender in a SEND_BLOCKED state has its message received by the specified sender, the receiver's
+ message buffer is mapped into the pages reserved for message IPC in the sender's address space.
+ The message is then read out of the sender's buffer and into the mapped pages, obeying
+ any length restrictions the receiver specified. A special optimization case exists for
+ messages <= 8 bytes of data where the message can be copied solely in 2 registers
+ and avoid this mapping completely.
+
+ * Both receiver and sender are finally unblocked.
+
+ What happens after the receiver and sender are unblocked is somewhat tricky. Various microkernels
+such as QNX switch to the receiver process and allow it to process the request. However, QNX's
+interface makes "send" a complex operation that first sends a message then receives a reply in addition
+to its "receive" and "reply" operations. If the sender is allowed to continue instead, it can immediately
+execute an appropriate receive operation which will give up it's control, therefor achieving the same
+level of functionality without a third operation. This could have slight performance hindrances, but
+I cannot see glaring ones at this time. This would take combining two simple system calls to achieve
+the functionality of QNX's single third, but reduces the number of system calls exported as well
+as possibly simplifying implementation. Yet, since mapped pages requires invalidating parts of the TLB,
+it could be more speed economical to schedule the receiver upon completion, preventing needless
+redumping. Such would require composite IPC operations to be supplied to prevent switching and
+the complications of adding them would need to be assessed before considering scheduling
+the receiver.
+
+III. Events
+
+ Events are a buffered, asynchronous form of IPC. At the interface level, an event is simply two
+double words - the first usually being the class of the event and the second being some other parameter.
+This relation is not enforced in any manner and events can simply be used for buffered quad word messages
+if desired. The implementation would possibly work as follows:
+
+ * Every process would have a FIFO buffer storing a fixed number of events. Since events are only
+ 8 bytes (two dwords), this shouldn't be a problem, and buffers don't need to be extremely large.
+ Their length could even possibly be configurable in which case a buffer wouldn't be needed
+ unless events were used at all.
+
+ * The sender attempts to send an event to some arbitrary receiver. If the receiver is not in
+ a RECEIVE_BLOCKED state induced by attempting to receive a message, the event is placed
+ into the FIFO buffer, otherwise the event is placed into the receiver's event buffer directly.
+ In either case, the sender is NOT blocked.
+
+ * The receiver attempts to retrieve an event from some arbitrary sender. If there is no qualifying
+ event in the FIFO buffer, the receiver is RECEIVE_BLOCKED. As discussed above, the receiver is
+ unblocked when a qualifying event is sent.
+
+ Deciding which thread is scheduled next is again tricky. Look to the previous discussion under "Messages"
+for considerations.
+
+IV. Blocking
+
+ As outlined above, a process can be in a RECEIVE_BLOCKED state with regard to events and in either a
+RECEIVE_BLOCKED state or a SEND_BLOCKED state with regard to messages. Blocking indefinitely, however,
+is not always appropriate. To remedy this, one can implement a system call interrupt timer on a per-call
+basis or a per-thread basis.
+ In a per-call scheme, a timer is supplied or not supplied (to block indefinitely) as a parameter
+to the IPC operation. The snag here is that every system call must process the timer argument that
+wants to allow for blocked states to be interrupted.
+ In a per-thread scheme, a timer is maintained in every thread and is reset and enabled whenever a process
+enters a blocked state as a result of a system call. A system call would be supplied to set the reset
+value for this timer. The snag with this scheme is that a sequence of calls which vary widely
+in timer values would require many calls to set the value of this timer and a set of IPC calls might
+need to be supported which simply return failure (i.e. "try_send", "try_receive") instead of blocking if
+the sender/receiver is not ready without resorting to an API call to set the timer reset value to 0.
+Having a separate call to set the timer makes it more convenient for complex timer values of more than one
+parameter, however.
+ Beyond message passing operations, two explicitly blocking operations are also required. Firstly,
+a system call that blocks until either either an event or message is sent and returns some value
+to determine which or error is needed. Lastly, there need be a call to block indefinitely which
+can only be interrupted by a timer. The functionality of these could conceivably be combined into a
+single call which blocks until any form of IPC is sent from a specified process. Then, a process
+could simply wait for IPC from itself.
+
+V. Miscellaneous Considerations
+
+ * Since messages are sent to processes and not individual threads, many threads within a process
+ can wait on many messages and many events at once. This could, however, prove hindering if a server
+ wants to fork off a thread to handle a request. In such cases, providing facilities for managing
+ IPC ports might be useful so that threads can share or not share ports as they please. Message ports
+ do, however, add some amount of complexity and are, most likely, not even needed.
+
+ * Later performance requirements could demand composite IPC operations like 'call' and 'service'
+ that combine send and receive operations and vice versa. This remains to be seen, however.
+
diff --git a/documentation/makefile b/documentation/makefile
new file mode 100644
index 00000000..c10ee7cd
--- /dev/null
+++ b/documentation/makefile
@@ -0,0 +1,11 @@
+# $Id$
+
+DSSSL_FILE = /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/print/docbook.dsl
+TARGETS = coding-standards.pdf filesystem-hierarchy.pdf installation.pdf
+
+all: $(TARGETS)
+
+%.pdf: %.sgml
+ jade -t tex -d $(DSSSL_FILE) $<
+ pdfjadetex $(*F).tex
+ rm $(*F).tex
diff --git a/documentation/missing b/documentation/missing
new file mode 100755
index 00000000..7789652e
--- /dev/null
+++ b/documentation/missing
@@ -0,0 +1,190 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard , 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing - GNU libit 0.0"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acinclude.m4' or \`configure.in'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`configure.in'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acconfig.h' or \`configure.in'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/documentation/mkinstalldirs b/documentation/mkinstalldirs
new file mode 100755
index 00000000..6b3b5fc5
--- /dev/null
+++ b/documentation/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman
+# Created: 1993-05-16
+# Public domain
+
+# $Id$
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/documentation/physical-memory.txt b/documentation/physical-memory.txt
new file mode 100644
index 00000000..6bfb3f90
--- /dev/null
+++ b/documentation/physical-memory.txt
@@ -0,0 +1,17 @@
+Physical Memory Map
+===================
+
+Offset | Length | Description
+-------+--------+--------------------
+ 0 | 4K | GDT/IDT
+ 4K | 4K | storm TSS
+ 8K | 8K | storm stack
+ 16K | 4K | Module names and parameters
+ 1M | ? | Kernel start
+
+Also, at 1.5 MB, the data structures for physical page allocation is
+located. It consists of a list and a bitmap. Don't think about how
+this works. This is the way the chaos operating system does it, and it
+works.
+
+(Thanks to Microsoft for this wording. We owe you!)
\ No newline at end of file
diff --git a/documentation/protocols.texi b/documentation/protocols.texi
new file mode 100644
index 00000000..0a9da31e
--- /dev/null
+++ b/documentation/protocols.texi
@@ -0,0 +1,172 @@
+@settitle chaos Protocols
+@node Top
+@top Protocols
+
+$Id$
+
+
+@menu
+* Introduction::
+* Basics::
+* VFS::
+* Keyboard::
+* Console::
+* Graphics::
+@end menu
+
+
+@node Introduction
+@chapter Introduction
+
+This file tries to document all the standard protocols used in a chaos system. Since
+chaos evolves very quickly, it might at times be a little outdated. If you feel like there is so,
+please notify us. Also, much information will be unfinished, but we'll try to always keep this
+documention up to date, since developers of servers for chaos need the information contained
+in this document to write servers.
+
+
+@node Basics
+@chapter Basics
+
+All communications between processes are done by sending blocks of dwords
+containing the data via the kernel-functions for sending and receiving
+messages. The first dword in a command block is always a signed dword
+containing the command ID. If the protocol being used acknowledges the command
+it should do this by placing the command ID in the first dword of the returned
+message, or a negative value if there was an error. This is refered to as
+"Standard return" in this file. All string in the command block are padded out
+with zeroes to the next integral multiple of 4.
+
+
+@node VFS
+@chapter VFS
+
+All programs and servers in chaos accesses the filesystem hierarchy by
+communicating with the VFS-server. This is done by a few simple protocols:
+
+@table @strong
+@item Purpose
+@emph{Get detailed information about an entry in the hierarchy.}
+
+@item Call
+@table @strong
+@item 0
+@emph{VFS_GET_ENTRY}
+@item 1..n
+@emph{Path string (length dword padded)}
+@item n+1
+@emph{Entry number}
+@end table
+
+@item Return
+@table @strong
+@item 0
+@emph{Standard return}
+@item 1
+@emph{Length of filename in bytes}
+@item 2..n
+@emph{Filename string}
+@item n+1
+@emph{Filesize in bytes}
+@item n+2
+@emph{Type}
+@end table
+@end table
+
+
+@node Keyboard
+@chapter Keyboard
+
+If a program in chaos wants to take input from the keyboard, it sends a message
+to the keyboard server registering itself as a receiver of keypresses.
+
+
+@node Console
+@chapter Console
+
+If a program (non-tornado-native) wants to output anything, it first needs to request
+a virtual screen from the console-server. There is a few standard protocols for this:
+
+@table @strong
+@item CONSOLE_SCREEN_OPEN - Open a new screen with a specified mode
+
+@item Call
+@table @strong
+@item dword 0
+@emph{CONSOLE_SCREEN_OPEN}
+@item dword 1
+@emph{Mode (0 = text / 1 = graphic)}
+@item dword 2
+@emph{Width of screen (characters / pixels)}
+@item dword 3
+@emph{Height of screen (characters / pixels}
+@item dword 4
+@emph{BPP (bits per pixel)}
+@end table
+
+@item Return
+@table @strong
+@item dword 0
+@emph{Standard return}
+@item dword 1
+@emph{Linear pointer where program is allowed to map screen buffer}
+@item dword 2
+@emph{Physical pointer to screen buffer}
+@end table
+
+@end table
+
+
+@table @strong
+@item CONSOLE_CHANGE - Change active console
+
+@item Call
+@table @strong
+@item dword 0
+@emph{CONSOLE_CHANGE}
+@item dword 1
+@emph{Pid owning console to change to}
+@end table
+
+@item Return
+@table @strong
+@item dword 0
+@emph{Standard return}
+@end table
+
+@end table
+
+
+@node Graphics
+@chapter Graphics
+
+Although you'll have a server for each graphic-card, the will all use the same
+standard protocol to communicate. Constants are defined in graphics.h in the
+chaos-standard-headers package.
+
+@table @strong
+@item GRAPHICS_MODE_CHANGE - Change current videmode
+
+@item Call
+@table @strong
+@item dword 0
+@emph{GRAPHICS_MODE_CHANGE}
+@item dword 1
+@emph{Type of mode (0 = text / 1 = graphic) (textmode may not be supported on all cards / platforms)}
+@item dword 2
+@emph{Width of screen (characters / pixels)}
+@item dword 3
+@emph{Height of screen (characters / pixels)}
+@item dword 4
+@emph{BPP (bits per pixel)}
+@end table
+
+@item Return
+@table @strong
+@item dword 0
+@emph{Standard return}
+@item dword 1
+@emph{Physical pointer to framebuffer}
+@end table
+
+@end table
diff --git a/documentation/server-architecture.texi b/documentation/server-architecture.texi
new file mode 100644
index 00000000..42ba31b4
--- /dev/null
+++ b/documentation/server-architecture.texi
@@ -0,0 +1,114 @@
+@settitle The chaos Architecture
+@node Top
+@top The chaos Architecture
+
+The chaos Architecture
+
+$Id$
+
+Copyright 1999 chaos development
+
+@menu
+* Prologue::
+* The Microkernel::
+* Overview of the Server Architecture::
+* Client-Server Communication::
+@end menu
+
+@node Prologue
+@chapter Prologue
+
+In this document, we (chaos development) describe how the chaos system will
+work. All of this is not written yet, but most of the kernel is finished and
+we're starting slowly to write some basic servers. If you feel you want to
+help, please contact us. You will find contact information at our website,
+@url{http://www.chaosdev.org/}.
+
+@node The Microkernel
+@chapter The Microkernel
+
+chaos is a microkernelbased operating system. This means that as much as
+possible has been removed from the kernel. This design has several advantages
+to traditional monolithic systems (like Linux and *BSD). The most important
+(in our opinion, of course) is that it is easier to separate drivers from each
+other. If, for example, you suddenly feel like you need IPv6 support, support
+for this protocol can easily be added without the need of rebooting or even
+recompiling anything. Our opinion is that only programmers should need to have
+a compiler installed.
+
+Our microkernel, called @emph{storm}, contains only the following::
+
+@table @samp
+@item IRQ management
+@item Exception handling
+@item Task switching (commonly called multitasking, but that is not true in non-SMP systems)
+@item Process startup and stopping
+@item Thread support
+@item Advanced scheduler with support for priorities and threads
+@item DMA support (this is not written yet, please contact us if you want to volunteer)
+@item Interprocess communication (IPC)
+@item Memory and I/O-port protection
+@item Paging (virtual memory)
+@end table
+
+As you can see, there are no hardware drivers, no networking, no graphics
+code; hardly anything. This makes the kernel extremely small (~15K for the
+moment, in compressed format), but still features the things necessary to
+load other modules.
+
+@node Overview of the Server Architecture
+@chapter Overview of the Server Architecture
+
+A @dfn{server} in chaos terminology is what most other operating systems refer
+to as a @dfn{driver} or a @dfn{module}. The reason we call it @dfn{server} is
+simply because this is what it is; it is not just a bunch of code. The
+difference from most other systems is that a server isn't any more privileged
+than a regular user process (well, actually, it is, but it's not at all as
+privileged as the kernel, even though administratory rights are required to
+start a server). This means that a server cannot just read and write from the
+memory and/or I/O ports it wants as in traditional, older systems. In chaos,
+you have to first @dfn{register} the I/O port(s) and/or IRQ(s) you want the
+server to use, and @emph{then} you will be able to use it/them,
+@emph{if, and only if} the I/O port(s) and/or IRQ(s) was not used by a
+previously started server. This, in combination with the memory protection
+mechanisms chaos uses to separate all processes, makes it virtually impossible
+for a server to bring the computer down. This makes a chaos system stable and
+robust. And what's best of it all: it doesn't make the system noticeably
+slower than a regular, non-protected system!
+
+Technically speaking, this is accomplished by running all kernel code
+(syscalls and bootup initialization) in privilige level (PL) zero, servers and
+regular user processes in PL 3. This makes it impossible for an ordinary user
+process to access the hardware, and still allows the servers to use the
+port(s) and stuff it needs if it was able to allocate it. Several syscalls
+that are not available for ordinary user processes are available for the
+servers. The kernel separates servers from other processes by having an
+internal flag for every process indicating the process' type.
+
+@node Client-Server Communication
+@chapter Client-Server Communication
+
+All communication between servers and regular processes (referred to as
+@dfn{clients} in this chapter) is done by means of the
+syscall_message_send () and syscall_message_receive () system calls. The format
+of the data is highly standardized and follows these simple rules:
+
+Structure for IPC
+
+@table @samp
+@item 1 dword
+Command ID. This is the command ID, and is specific for each server. This is
+used by the server to decode the data passed.
+@item 1 dword
+Length of data in @emph{this} block. It should be noted that in one message,
+multiple command blocks can be put together in a single packet. This ensures
+high performance, since you do not have to do a system call for each
+operation. The server may then split the operations contained in one message
+and schedule the operations between processes in a fair way to prevent long
+wait-times for processes.
+@item data
+This is individual for each command ID the server takes and it's length is
+specified by the previous dword.
+@item ...
+Repeats until the length of the packet is reached.
+@end table
diff --git a/documentation/the_chaos_programming_reference_manual.texi b/documentation/the_chaos_programming_reference_manual.texi
new file mode 100644
index 00000000..494b0546
--- /dev/null
+++ b/documentation/the_chaos_programming_reference_manual.texi
@@ -0,0 +1,274 @@
+@settitle The chaos Programming Reference Manual
+@node Top
+@top The chaos Programming Reference Manual
+
+$Id$
+
+Copyright 1999 chaos development. This document can be used under the
+terms of the GPL, version 2 or (at your option) any later version. But
+please, please use a different name in derivative works.
+
+Version 0.0.1. Please note that this is work in progress; don't treat
+this as a finished manual, for it is not.
+
+@menu
+* Introduction:: What's all this about?
+* Chapter 1:: The Kernel API
+* Chapter 2:: The chaos Libraries
+* Chapter 3:: Error numbers
+@end menu
+
+@node Introduction
+@chapter What's all this about?
+
+This is The chaos Programming Reference Manual. It describes how the
+Kernel API and the chaos Libraries (will) work. It is not a programming
+tutorial, but it will probably be pretty helpful for those of you who
+have been programming for other systems earlier. Since chaos is pretty
+different to what most of you likely are used to, we will focus on the
+differences; hence, knowledge of programming for (for example) Linux or
+other Unix systems will be desirable (but not required).
+
+This reference is split up into two parts: first, the kernel; then, the
+user libraries. The kernel interface shouldn't be used by most programs,
+but we felt like documenting it anyway, so that we won't forget how it
+works. The user libraries are very unfinished yet (only the console
+library has been written, actually). Please don't be afraid to help us
+if you like to.
+
+@node Chapter 1
+@chapter The Kernel API
+
+First, a very important thing to note. Our inline function in
+system/system_calls.h all push their input variables onto the
+stack. Thus, if you use local variables and pass them into the system
+calls, you must @emph{not} use -fomit-frame-pointer. It @emph{will}
+generate invalid code. Trust me on this; we spent quite some time on
+debugging this...
+
+The Kernel API consists of the following functions:
+
+@deffn Function dword syscall_read_timer (void)
+Reads the number of ticks since the system last was rebooted. The number
+of clock ticks... can not be determined right now. Wait for the
+kernelfs. But OTOH, this system call will probably be removed and
+replaced by an entry there...
+@end deffn
+
+@deffn Function void syscall_log (char *s)
+Prints a message to the logging facilities. Currently, it just prints it
+to the screen (prepending the server name and appending a newline), but
+a log server will be written shortly which will make this obsolete.
+@end deffn
+
+@deffn Function dword syscall_register_irq (dword irq, void (*b)(void))
+Register an IRQ handler for the given IRQ. This can only be done by a
+server. It will enable the interrupt in the interrupt controller, and
+set up the interrupt as a separate task (it's like a hybrid-thread which
+never gets scheduled).
+@end deffn
+
+@deffn Function dword syscall_register_port (dword base, dword num)
+Registers a port range for usage by the server (not available to regular
+programs). Please note that by default, no port access is allowed, so if
+a server needs to probe a region, it must firt allocate it (and perhaps
+later deallocate it if neccessary)
+@end deffn
+
+@deffn Function dword syscall_mmap (pid_type pid, dword linear_page, dword physical_page, dword pages)
+This maps the physical pages specified at the linear page address given
+for the given pid. Right now, no security checks are done @emph{at all},
+so please be careful when using this call. This will be fixed as soon as
+we think it's neccessary.
+@end deffn
+
+@deffn Function thread_type syscall_thread (void)
+This creates a new thread for the current process. The returned value is
+the number of the thread in the old thread, and zero in the new thread.
+@end deffn
+
+@deffn Function error_type syscall_process_control (pid_type pid, dword class, dword parameter)
+This changes the state of a process. The classes are defined in
+process.h, and are as follows:
+@end deffn
+
+@deffn Class PROCESS_TERMINATE
+Tells the kernel to kill the process unconditionally.
+@end deffn
+
+@deffn Class PROCESS_SUSPEND
+Suspend a process until resumed by PROCESS_RESUME.
+@end deffn
+
+@deffn Class PROCESS_RESUME
+Resumes a process suspended with PROCESS_SUSPEND.
+@end deffn
+
+@deffn Class PROCESS_SLEEP
+Puts a process to sleep for a user specified amount of time.
+@end deffn
+
+@deffn Function error_type syscall_set_name (char *name)
+Sets the process name. This is used as a primitive form of name-space in
+conjunction with the next function.
+@end deffn
+
+@deffn Function pid_type syscall_get_pid_by_name (char *name)
+Returns the pid number of the process with the given name.
+@end deffn
+
+@node Chapter 2
+@chapter The chaos Libraries
+
+@menu
+* Section 2.1:: Why not just POSIX?
+* Section 2.1.5:: About return values
+* Section 2.2:: The file library (library_file)
+* Section 2.3:: The tornado library (library_tornado)
+* Section 2.4:: The graphics library (library_graphics)
+* Section 2.5:: The console I/O library (library_console)
+* Section 2.6:: The network library (library_network)
+* Section 2.7:: The memory library (library_memory)
+* Appendix A:: ACL (Access Control Limits)
+@end menu
+
+@node Section 2.1
+@section Why not just POSIX?
+
+First, POSIX is not freely available. Thus, supporting it without paying
+money gets difficult. Second, POSIX doesn't really fit into the chaos
+philosophy. We don't like abbreviations, for example. Therefore, we decided
+to go our own way. However, to make porting of foreign programs easy in
+the beginning, we will also port a regular C library (probably glibc). It
+is to be clearly marked that using this library for new programs is strongly
+discouraged. Only use it if your program must be portable.
+
+@node Section 2.1.5
+@section About return values.
+
+In the chaos libraries, we @emph{always} use return_type for functions,
+except in the cases where the function can not fail. (Very seldom, but
+'random' is such an example. It is not dependant on any external factors)
+
+We do not use the errno approach at all, since it is very poor.
+
+@node Section 2.2
+@section The file library (library_file)
+
+@deffn Function file_handle_type file_open (u8 *@var{file})
+Opens the given file name and associates it with a file handle (which is used
+when communicating to the VFS server). If the file does not exist, an error
+will be returned.
+@end deffn
+
+@deffn Function error_type file_close (file_handle_type @var{file})
+Closes the given file handle.
+@end deffn
+
+@deffn Function error_type file_write (file_handle_type @var{file}, void *@var{data}, dword @var{size})
+Writes @var{size} bytes of the data block located at @var{data} to the file
+handle associated with @var{file}.
+@end deffn
+
+@deffn Function error_type file_read (file_handle_type @var{file}, void *@var{data}, dword @var{size})
+Reads up to @var{size} bytes to @var{data} from the file handle associated with
+@var{file}.
+@end deffn
+
+@deffn Function error_type file_create (u8 *@var{name})
+Creates a file with @var{name} as its full name (including path). Per default,
+the file will be unaccessible by everybody but the owner; this may later be
+changed by the @code{file_permissions_*} group of functions described later.
+@end deffn
+
+@deffn Function error_type file_permissions_delete_rule (u8 *@var{name}, acl_type @var{acl})
+Deletes an ACL rule to the given file. Returns an error if this can't be done.
+@end deffn
+
+@deffn Function error_type file_permissions_add_rule (u8 *@var{name}, acl_type @var{acl})
+Adds an ACL rule to the given file. Returns an error if this can't be done.
+@end deffn
+
+TODO: More ACL stuff, do error number stuff.
+
+@node Section 2.3
+@section The tornado library (library_tornado)
+
+@node Section 2.4
+@section The graphics library (library_graphics)
+
+@node Section 2.5
+@section The console I/O library (library_console)
+
+@deffn Function void console_print (u8 *@var{string})
+Prints @var{string} to the terminal owned by the program.
+@end deffn
+
+@deffn Function error_type console_print_formatted (u8 *@var{format_string}, ...)
+Prints @var{format_string}, replacing the type identifiers given
+with the parameters added to the function call. The syntax is identical to
+the ordinary ISO C @code{printf} function.
+@end deffn
+
+@deffn Function error_type console_clear (void)
+Clears the current console.
+@end deffn
+
+@deffn Function error_type console_cursor_move (int @var{x}, int @var{y})
+Move the cursor to the given position.
+@end deffn
+
+@deffn Function error_type console_cursor_get_position (int *@var{x}, int *@var{y})
+Get the current cursor position.
+@end deffn
+
+@deffn Function key_type console_key_wait (void)
+Waits for a keypress and returns its keycode. The key codes are in standard
+BIOS format. (????)
+@end deffn
+
+@deffn Function key_type console_key_check (void)
+Checks if a keypress has been made. If so, the key code is returned.
+Otherwise, KEY_ERROR is returned.
+@end deffn
+
+@node Section 2.6
+@section The network library (library_network)
+
+@deffn Function socket_type network_open (protocol_type @var{protocol}, void *@var{parameters})
+Opens a network socket of type @var{protocol}. Some network protocols require
+additional parameters; if so, those are passed in @var{parameters}.
+@end deffn
+
+@deffn Function error_type network_close (socket_type @var{socket})
+Closes the socket associated with @var{socket}.
+@end deffn
+
+@node Section 2.7
+@section The memory library (library_memory)
+
+@deffn Function void *memory_allocate (dword size)
+Allocates @var{size} bytes of contigous memory. If, for some very strange
+reason, no memory can be allocated, returns NULL. Otherwise, returns a
+pointer to the memory area.
+@end deffn
+
+@deffn Function error_type memory_deallocate (void *@var{block})
+Deallocates the memory block given in @var{block}. If the memory can't be
+deallocated, returns the error code ERROR_NO_MEMORY. Otherwise, returns
+SUCCESS.
+@end deffn
+
+@node Appendix A
+@section Access Control Limits
+
+TODO: Write about this.
+
+@node Chapter 3
+@chapter Error numbers
+
+@deffn Macro ERROR_NO_MEMORY
+No memory available. The system cannot allocate more virtual memory because
+its capacity is full.
+@end deffn
+
diff --git a/documentation/tornado-proposal b/documentation/tornado-proposal
new file mode 100644
index 00000000..05bedf0f
--- /dev/null
+++ b/documentation/tornado-proposal
@@ -0,0 +1,86 @@
+tornado proposal version 0.2. copyright 1999 chaos development.
+
+ introduction
+--------------
+
+tornado is an graphical user interface (gui) written for the operating
+system chaos. it uses the mechanisms provided by the microkernel storm
+for interprocess communication and threadhandling. it is/should be
+developed with the keywords flexibility and modularity in mind.
+tornado is a ordinary user process, not a server.
+
+
+ initialisation of tornado
+---------------------------
+
+* open the /config/tornado/configuration file.
+* try to find the default videomode (many modes may be listed and switched
+ between later). could be overridden by a parameter.
+ XXX: create a protocol for the graphicsserver to allow it to return
+ all available modes.
+* send a message to the console-server requesting a screen with the mode.
+* find the mouse-device in the configuration-file. could be overridden by
+ a parameter.
+* start a thread to handle the mouse.
+ XXX: this means telling the mouse server (determined by it's servicefile)
+ to send mouse updates to this thread. but how do we specify which
+ thread it is?
+* start a thread to handle the keyboard.
+* register tornado as a receiver of both mouse-events and keyboard-events to
+ the selected servers.
+* start a thread that does the syscall_message_receive and handles messages on
+ arrival. these events can be from the programs running under tornado
+ or from other processes wanting to communicate for some
+ reason. signals are also
+ handled by this thread.
+* execute the programs listed in /config/tornado/startup-programs.
+* put one of the started programs in focus (determined from the configuration
+ file).
+* kill the tornado main/startup thread.
+
+
+ libraries
+-----------
+
+tornado is dynamically linked to shared libraries. these are, for
+example:
+
+* window
+* menu
+* language
+* button
+* font
+* etc...
+
+these libraries contains functions for drawing and managing windows,
+dialog-boxes, menus and stuff like that. they are of course replacable
+during runtime of tornado.
+
+all tornado programs will be linked to the library_tornado
+library. this library is responsible for registering objects to
+tornado in terms of sending a message to tornado. the tornado
+mouse-handling thread checks these objects when receiving a
+mouse-click or other action from the mouse. if it founds an object at
+the current mouse-position, it sends the program a message containing
+which object was clicked. all keypresses tornado receives is also sent
+to the program in focus. some keypresses/combinations is interpreted
+by tornado as described in the configuration. an example is for
+example alt+tab which can be used to change program in focus.
+
+
+ objects
+---------
+
+tornado provides all necessary objects needed for all programs. These are:
+
+type (what is specified on registration)
+
+* button (name, size, position and text)
+* textbox
+
+ epilogue
+----------
+
+This is just a proposal, and nothing is decided yet. Lets keep up the
+discussion and find problems, if they exist, before they prove to
+exist the hard way.
diff --git a/documentation/virtual-memory.txt b/documentation/virtual-memory.txt
new file mode 100644
index 00000000..8aad5fd5
--- /dev/null
+++ b/documentation/virtual-memory.txt
@@ -0,0 +1,42 @@
+virtual-memory.txt ($Id$)
+==================
+
+Layout of the linear address-space for a task
+=============================================
+
+ Start | Length | Description
+-----------------+-------------+-------------
+ 4K | 4K | Process pagedirectory.
+ 8K | 4K | Exception TSS:es.
+ 32K | 8K | Temporary mapped data.
+ 40K | 4K | Kernel TSS.
+ 44K | 4K | GDT/IDT.
+ 1M | ? | Kernel code and data.
+ 3M | 1M | Process code and data. Used by process_create.
+ 4M | 28M | Process' low-level memory allocation
+ | | structures.
+ 32M | 4M | Process' pagetables.
+ 36M | 4M | Process data. Parameters and other info.
+ 40M | SIZE_GLOBAL | Global data area. Hifi-eslöf, ports, etc...
+ 40M+SIZE_GLOBAL | ? | Free (process data and code).
+ -64M | 64M | Stack (bottom page is PL0).
+
+
+Format of the global memory space
+=================================
+
+ Offset | Length | Description
+--------+-------------------+-------------
+ 0M | 40M | hifi-eslöf structures.
+ 40M | The rest | Kernel data.
+
+
+Note
+====
+
+There is also shared memory, which is a window in a process' address
+space mapping the same physical pages as mapped in another
+process. Through this space, the processes can communicate. This is
+used when large datastructures is to be transfered between
+processes. An ordinary mailbox is often used to synchronize the
+transfers.
diff --git a/libraries/AUTHORS b/libraries/AUTHORS
new file mode 100644
index 00000000..e90217cf
--- /dev/null
+++ b/libraries/AUTHORS
@@ -0,0 +1,6 @@
+AUTHORS ($Id$)
+=======
+
+* Per Lundberg
+* Henrik Hallin
+* Martin Alvarez
diff --git a/libraries/COPYING b/libraries/COPYING
new file mode 100644
index 00000000..c4792dd2
--- /dev/null
+++ b/libraries/COPYING
@@ -0,0 +1,515 @@
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+^L
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+^L
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+^L
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+^L
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+^L
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+^L
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License
+may add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+^L
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+^L
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms
+of the ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library.
+It is safest to attach them to the start of each source file to most
+effectively convey the exclusion of warranty; and each file should
+have at least the "copyright" line and a pointer to where the full
+notice is found.
+
+
+
+ Copyright (C)
+
+ This 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 of the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper
+mail.
+
+You should also get your employer (if you work as a programmer) or
+your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James
+Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/libraries/INSTALL b/libraries/INSTALL
new file mode 100644
index 00000000..86cd094b
--- /dev/null
+++ b/libraries/INSTALL
@@ -0,0 +1,21 @@
+INSTALL ($Id$)
+=======
+
+Right now, setting up the chaos system is not very easy. We are well
+aware of this, but we have been forced to oversee it for now -- if the
+code does not work, it is not of much use to be able to install it.
+
+Still, you should be able to do something like this:
+
+ make configure
+ make install
+
+(This will copy the compiled libraries to some different directories
+under the path you've chosen as prefix)
+
+Well, that should be it. If everything works out fine, you should be
+able to link chaos programs to those libraries. We hope to make the
+process of setting up chaos a lot easier in the future. For now, happy
+hacking!
+
+-- Per Lundberg Mon, 10 Apr 2000 08:50:54 +0200
\ No newline at end of file
diff --git a/libraries/README b/libraries/README
new file mode 100644
index 00000000..60b148fb
--- /dev/null
+++ b/libraries/README
@@ -0,0 +1,18 @@
+README ($Id$)
+======
+
+This is the chaos libraries. They are required to compile the servers,
+and eventually to compile virtually any chaos program.
+
+They are *not* licensed under the GPL, but under the Lesser General
+Public License (LGPL), since we want people to be able to write
+non-GPL:ed free software for chaos (for example, BSD-licensed
+programs). This also makes it possible to develop proprietary software
+for chaos, which we do not encourage people to do, but nevertheless
+accept *if* they choose to do so. Please see the file COPYING for more
+information about this.
+
+(You can read more about the licensing of chaos on
+http://www.chaosdev.org/legal.shtml)
+
+-- Per Lundberg Fri, 21 Jul 2000 18:52:00 +0200
diff --git a/libraries/TODO b/libraries/TODO
new file mode 100644
index 00000000..dc283ce0
--- /dev/null
+++ b/libraries/TODO
@@ -0,0 +1,7 @@
+TODO ($Id$)
+====
+
+* ipc: Support closing connections. network: Support for binding
+* sockets, and also listening and sending data. pci: Make it
+* work. Support finding of I/O ranges, etc, and also bus mastering
+ when we have shared memory proper in the kernel.
diff --git a/libraries/chaos.ld b/libraries/chaos.ld
new file mode 100644
index 00000000..8c4dc6ad
--- /dev/null
+++ b/libraries/chaos.ld
@@ -0,0 +1,154 @@
+/* $Id$ */
+/* Abstract: chaos linker script. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+ "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(startup)
+SEARCH_DIR(/mnt/chaos/programming/libraries/static);
+
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+
+ . = 0x40000000 + SIZEOF_HEADERS;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.text :
+ { *(.rel.text) *(.rel.gnu.linkonce.t*) }
+ .rela.text :
+ { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+ .rel.data :
+ { *(.rel.data) *(.rel.gnu.linkonce.d*) }
+ .rela.data :
+ { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+ .rel.rodata :
+ { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
+ .rela.rodata :
+ { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ .init : { *(.init) } =0x9090
+ .plt : { *(.plt) }
+ . = ALIGN(0x1000);
+ .text :
+ {
+ *(.text)
+ *(.stub)
+
+ /* .gnu.warning sections are handled specially by elf32.em. */
+
+ *(.gnu.warning)
+ *(.gnu.linkonce.t*)
+ } =0x9090
+ _etext = .;
+ PROVIDE (etext = .);
+ .fini : { *(.fini) } =0x9090
+ .rodata1 : { *(.rodata1) }
+
+ /* Adjust the address for the data segment. We want to page align it. */
+
+ . = ALIGN(0x1000);
+ .data :
+ {
+ *(.data)
+ *(.rodata)
+/* *(.gnu.linkonce.d*)
+ CONSTRUCTORS */
+ }
+ _edata = .;
+ PROVIDE (edata = .);
+ __bss_start = .;
+ .sbss : { *(.sbss) *(.scommon) }
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ . = ALIGN(32 / 8);
+ _end = . ;
+ PROVIDE (end = .);
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+
+ .debug_info 0 : { *(.debug_info) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /* These must appear regardless of . */
+}
diff --git a/libraries/checksum/autochaos.rules b/libraries/checksum/autochaos.rules
new file mode 100644
index 00000000..6bff5720
--- /dev/null
+++ b/libraries/checksum/autochaos.rules
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ makefile
+ ..
+
+
+
+
+
+ checksum.h
+ defines.h
+ functions.h
+ types.h
+
+
+
+
diff --git a/libraries/checksum/changelog b/libraries/checksum/changelog
new file mode 100644
index 00000000..2313da43
--- /dev/null
+++ b/libraries/checksum/changelog
@@ -0,0 +1,12 @@
+2000-09-17 Per Lundberg
+
+ * md5.c (checksum_md5): New function that does all the real work
+ in one sweep.
+
+2000-07-26 Per Lundberg
+
+ * md5.c: New file, adopted from FreeBSD, which in turn adopted the
+ reference implementation from RFC 1321...
+
+ * Started writing this change log.
+
diff --git a/libraries/checksum/checksum.h b/libraries/checksum/checksum.h
new file mode 100644
index 00000000..32cd9f43
--- /dev/null
+++ b/libraries/checksum/checksum.h
@@ -0,0 +1,29 @@
+/* $Id$ */
+/* Abstract: Checksum library header file. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CHECKSUM_CHECKSUM_H__
+#define __LIBRARY_CHECKSUM_CHECKSUM_H__
+
+#include
+#include
+#include
+
+#endif /* !__LIBRARY_CHECKSUM_CHECKSUM_H__ */
diff --git a/libraries/checksum/config.h b/libraries/checksum/config.h
new file mode 100644
index 00000000..8009e22f
--- /dev/null
+++ b/libraries/checksum/config.h
@@ -0,0 +1,11 @@
+/* Automatically generated by autochaos 0.2.1. Not intended to be
+ hand edited. */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define PACKAGE_NAME "checksum"
+#define PACKAGE_VERSION "0.0.1"
+
+
+#endif /* !__CONFIG_H__ */
\ No newline at end of file
diff --git a/libraries/checksum/configure b/libraries/checksum/configure
new file mode 100755
index 00000000..c236c97d
--- /dev/null
+++ b/libraries/checksum/configure
@@ -0,0 +1,423 @@
+#! /usr/bin/perl -w
+
+# Abstract: Script for configuring this package.
+
+# Copyright 2000 chaos development. This script is in the public domain.
+
+# Please note that this script was automatically generated by
+# autochaos 0.2.1. It should not be modified. Do the changes you
+# want in autochaos instead.
+
+use strict;
+use POSIX;
+
+my $chaos_root = "/tftpboot/chaos";
+my @libraries = ();
+my @headers = ();
+my @sources = ();
+my @objects = ();
+my @deps = ();
+my $MAKEFILE;
+my $TEMPLATE;
+my $root_dir = getcwd ();
+my %options =
+(
+);
+
+my $install_prefix_flag = 0;
+
+foreach my $argument (@ARGV)
+{
+ if ($install_prefix_flag eq 1)
+ {
+ $chaos_root = $argument;
+ $install_prefix_flag = 0;
+ }
+ else
+ {
+ if ($argument eq '--install-prefix')
+ {
+ $install_prefix_flag = 1;
+ }
+ elsif ($argument =~ m/--enable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--enable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'TRUE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ elsif ($argument =~ m/--disable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--disable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'FALSE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+}
+
+if ($install_prefix_flag eq 1)
+{
+ print "Malformed --install-prefix command option. Value missing.\n";
+ exit 1;
+}
+
+print "\n Configuring library: checksum...\n\n";
+
+print ("Using chaos root... ($chaos_root)\n");
+
+
+my $all_arguments = "";
+foreach my $argument (@ARGV)
+{
+ $all_arguments .= $argument . " ";
+}
+
+print ("Checking for autochaos... ");
+my $autochaos = `autochaos --version 2> /dev/null`;
+
+my $has_autochaos;
+unless ($autochaos)
+{
+ print ("not found.\n");
+ $has_autochaos = undef;
+}
+else
+{
+ (my $version) = ($autochaos =~ m/ ([\d\.]+)$/);
+ print ("found (version $version).\n");
+ $has_autochaos = $version;
+}
+
+
+
+@headers = (
+'checksum.h',
+'defines.h',
+'functions.h',
+'types.h',
+);
+
+@sources = (
+'crc32.c',
+'md5.c',
+);
+@objects = ('crc32.o',
+'md5.o',
+);
+@deps = ('crc32.dep',
+'md5.dep',
+);
+ print "Writing ./makefile...
+";
+ open (MAKEFILE, '>' . "./makefile") or
+ die ("Could not write to ./makefile: $!\n");
+
+# Write the default rules we want.
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE "\n\nOBJECTS = ";
+ foreach my $object (@objects)
+ {
+ print MAKEFILE " \\\
+$object";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @headers > 0)
+ {
+ print MAKEFILE "\n\nHEADERS = ";
+ foreach my $header (@headers)
+ {
+ print MAKEFILE " \\\
+$header";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @sources > 0)
+ {
+ print MAKEFILE "\n\nSOURCES = ";
+ foreach my $source (@sources)
+ {
+ print MAKEFILE " \\\
+$source";
+ }
+ print MAKEFILE "\
+";
+
+ }
+
+ print (MAKEFILE < \$(*F).dep
+
+%.o: %.S
+ \@echo Compiling \$<...
+ \@\$(CC) -o \$(@) \$(CFLAGS) \$(INCLUDES) \$(DEFS) -c \$<
+ \@\$(CC) -M \$< \$(CFLAGS) \$(INCLUDES) \$(DEFS) > \$(*F).dep
+
+%.o: %.asm
+ \$(NASM) -o \$(@) \$< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+STOP
+
+ {
+ my $target = "library_checksum.a" if (scalar @objects);
+
+ unless ($target)
+ {
+ $target = "";
+ }
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE " rm -f \$(OBJECTS)
+";
+ }
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ foreach my $dep (@deps)
+ {
+ print (MAKEFILE "-include $dep\n");
+ }
+ }
+
+ print (MAKEFILE "\n");
+
+ if (open (TEMPLATE, "." . "/makefile.template"))
+ {
+ while ()
+ {
+ my $row = $_;
+
+ print (MAKEFILE $row);
+ }
+ }
+ close (MAKEFILE);
+
+
+ # Now, also write to the config.h
+
+ print "Writing config.h...\
+";
+ my $CONFIG;
+ open (CONFIG, '>config.h');
+ print (CONFIG <\n");
+ }
+
+ print (CONFIG "\n#endif /* !__CONFIG_H__ */");
+
+ close (CONFIG);
diff --git a/libraries/checksum/crc32.c b/libraries/checksum/crc32.c
new file mode 100644
index 00000000..b88ab71b
--- /dev/null
+++ b/libraries/checksum/crc32.c
@@ -0,0 +1,134 @@
+/* $Id$ */
+/* Abstract: CRC32 function. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#include
+
+/* This code was borrowed from the original crc32.c, written by Gary
+ S. Brown in 1986. Thank you, Gary! */
+
+/* First, the polynomial itself and its table of feedback terms. The
+ polynomial is
+ X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
+
+ Note that we take it "backwards" and put the highest-order term in
+ the lowest-order bit. The X^32 term is "implied"; the LSB is the
+ X^31 term, etc. The X^0 term (usually shown as "+1") results in
+ the MSB being 1.
+
+ Note that the usual hardware shift register implementation, which
+ is what we're using (we're merely optimizing it by doing eight-bit
+ chunks at a time) shifts bits into the lowest-order term. In our
+ implementation, that means shifting towards the right. Why do we
+ do it this way? Because the calculated CRC must be transmitted in
+ order from highest-order term to lowest-order term. UARTs transmit
+ characters in order from LSB to MSB. By storing the CRC this way,
+ we hand it to the UART in the order low-byte to high-byte; the UART
+ sends each low-bit to hight-bit; and the result is transmission bit
+ by bit from highest- to lowest-order term without requiring any bit
+ shuffling on our part. Reception works similarly.
+
+ The feedback terms table consists of 256, 32-bit entries. Notes:
+
+ The table can be generated at runtime if desired; code to do so
+ is shown later. It might not be obvious, but the feedback terms
+ simply represent the results of eight shift/xor operations for
+ all combinations of data and CRC register values.
+
+ The values must be right-shifted by eight bits by the "updcrc"
+ logic; the shift must be unsigned (bring in zeroes). On some
+ hardware you could probably optimize the shift in assembler by
+ using byte-swap instructions.
+
+ The polynomial is 0xEDB88320. */
+
+#include
+
+static u32 crc32_table[] =
+{
+ 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, 0x076DC419L,
+ 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, 0x0EDB8832L, 0x79DCB8A4L,
+ 0xE0D5E91EL, 0x97D2D988L, 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L,
+ 0x90BF1D91L, 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL,
+ 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, 0x136C9856L,
+ 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, 0x14015C4FL, 0x63066CD9L,
+ 0xFA0F3D63L, 0x8D080DF5L, 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L,
+ 0xA2677172L, 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL,
+ 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, 0x32D86CE3L,
+ 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, 0x26D930ACL, 0x51DE003AL,
+ 0xC8D75180L, 0xBFD06116L, 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L,
+ 0xB8BDA50FL, 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L,
+ 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, 0x76DC4190L,
+ 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, 0x71B18589L, 0x06B6B51FL,
+ 0x9FBFE4A5L, 0xE8B8D433L, 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL,
+ 0xE10E9818L, 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L,
+ 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, 0x6C0695EDL,
+ 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, 0x65B0D9C6L, 0x12B7E950L,
+ 0x8BBEB8EAL, 0xFCB9887CL, 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L,
+ 0xFBD44C65L, 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L,
+ 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, 0x4369E96AL,
+ 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, 0x44042D73L, 0x33031DE5L,
+ 0xAA0A4C5FL, 0xDD0D7CC9L, 0x5005713CL, 0x270241AAL, 0xBE0B1010L,
+ 0xC90C2086L, 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL,
+ 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, 0x59B33D17L,
+ 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, 0xEDB88320L, 0x9ABFB3B6L,
+ 0x03B6E20CL, 0x74B1D29AL, 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L,
+ 0x73DC1683L, 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L,
+ 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, 0xF00F9344L,
+ 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, 0xF762575DL, 0x806567CBL,
+ 0x196C3671L, 0x6E6B06E7L, 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL,
+ 0x67DD4ACCL, 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L,
+ 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, 0xD1BB67F1L,
+ 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, 0xD80D2BDAL, 0xAF0A1B4CL,
+ 0x36034AF6L, 0x41047A60L, 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL,
+ 0x4669BE79L, 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L,
+ 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, 0xC5BA3BBEL,
+ 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, 0xC2D7FFA7L, 0xB5D0CF31L,
+ 0x2CD99E8BL, 0x5BDEAE1DL, 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL,
+ 0x026D930AL, 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L,
+ 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, 0x92D28E9BL,
+ 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, 0x86D3D2D4L, 0xF1D4E242L,
+ 0x68DDB3F8L, 0x1FDA836EL, 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L,
+ 0x18B74777L, 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL,
+ 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, 0xA00AE278L,
+ 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, 0xA7672661L, 0xD06016F7L,
+ 0x4969474DL, 0x3E6E77DBL, 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L,
+ 0x37D83BF0L, 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L,
+ 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, 0xBAD03605L,
+ 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, 0xB3667A2EL, 0xC4614AB8L,
+ 0x5D681B02L, 0x2A6F2B94L, 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL,
+ 0x2D02EF8DL
+};
+
+/* Return a 32-bit CRC of the contents of the buffer. */
+
+u32 checksum_crc32 (u8 *buffer, unsigned int length)
+{
+ unsigned int index;
+ u32 crc32_value = 0;
+
+ for (index = 0; index < length; index++)
+ {
+ crc32_value = (crc32_table[(crc32_value ^ buffer[index]) & 0xFF] ^
+ (crc32_value >> 8));
+ }
+
+ return crc32_value;
+}
diff --git a/libraries/checksum/defines.h b/libraries/checksum/defines.h
new file mode 100644
index 00000000..6dd590b2
--- /dev/null
+++ b/libraries/checksum/defines.h
@@ -0,0 +1,29 @@
+/* $Id$ */
+/* Abstract: Defines used by the checksum library. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CHECKSUM_DEFINES_H__
+#define __LIBRARY_CHECKSUM_DEFINES_H__
+
+/* Defines. */
+
+#define CHECKSUM_MD5_DIGEST_LENGTH 16
+
+#endif /* !__LIBRARY_CHECKSUM_DEFINES_H__ */
diff --git a/libraries/checksum/functions.h b/libraries/checksum/functions.h
new file mode 100644
index 00000000..73e3c86e
--- /dev/null
+++ b/libraries/checksum/functions.h
@@ -0,0 +1,32 @@
+/* $Id$ */
+/* Abstract: CRC32 library function prototypes. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CHECKSUM_FUNCTIONS_H__
+#define __LIBRARY_CHECKSUM_FUNCTIONS_H__
+
+#include
+
+extern u32 checksum_crc32 (u8 *block, unsigned int length);
+
+void checksum_md5
+ (void *input, unsigned int length, checksum_md5_digest_type *digest);
+
+#endif /* !__LIBRARY_CHECKSUM_FUNCTIONS_H__ */
diff --git a/libraries/checksum/makefile b/libraries/checksum/makefile
new file mode 100644
index 00000000..173f221b
--- /dev/null
+++ b/libraries/checksum/makefile
@@ -0,0 +1,122 @@
+# This makefile was generated by autochaos 0.2.1. Please do not
+# tamper with it unless you are very certain about what you are doing.
+
+ALL_ARGUMENTS = --install-prefix /tftpboot/chaos
+
+PREFIX = /tftpboot/chaos
+PACKAGE = checksum
+
+# Compiler flags.
+
+CFLAGS = -Wall -W -Wshadow -Wpointer-arith -Waggregate-return \
+-Wstrict-prototypes -Wredundant-decls -Winline -Wmissing-prototypes \
+-Werror -Wcast-align -Wbad-function-cast -Wsign-compare \
+-Wmissing-declarations -Wmissing-noreturns -pipe \
+-Wnested-externs -O3 -fno-builtin -funsigned-char -g $(EXTRA_CFLAGS) $(DEFINES)
+
+INCLUDES = \
+-I.. \
+-I. -I$(PREFIX)/data/programming/c/headers
+
+ALL_OBJECTS = \
+./crc32.o \
+./md5.o
+
+STATIC_LIBRARY_PATH = $(PREFIX)/data/programming/libraries/static
+
+# Ideally, this would be -lwhatever, but we have not started patching
+# the GNU tools yet...
+
+LIBS =
+
+OBJECTS = \
+crc32.o \
+md5.o
+
+
+HEADERS = \
+checksum.h \
+defines.h \
+functions.h \
+types.h
+
+
+SOURCES = \
+crc32.c \
+md5.c
+
+HEADER_PATH = $(PREFIX)/data/programming/c/headers/$(PACKAGE)/.
+
+# TODO: Those should be overridable.
+
+CC = gcc-2.95
+NASM = nasm
+AR = ar
+RANLIB = ranlib
+GZIP = gzip -f
+
+%.o: %.c
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.S
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.asm
+ $(NASM) -o $(@) $< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+all: splash makefile library_checksum.a
+
+clean:
+ rm -f library_checksum.a
+ rm -f $(OBJECTS)
+ rm -f *.dep
+ -$(MAKE) clean-local
+makefile: configure
+ @./configure
+
+splash:
+ @echo -e "\n Compiling library: checksum...\n"
+
+configure: autochaos.rules
+ @autochaos
+
+
+LDFLAGS = $(PREFIX)/data/programming/c/startup/startup.o \
+-nostdlib -Wl,-T,$(PREFIX)/data/programming/linker/chaos.ld -lgcc $(EXTRA_LDFLAGS)
+
+library_checksum.a: $(OBJECTS)
+ @echo "Creating library..."
+ @$(AR) cru $(@) $(OBJECTS)
+ @$(RANLIB) $(@)
+
+install: all
+ @echo "Installing..."
+ @mkdir -p $(PREFIX)/data/programming/libraries/static
+ @cp library_checksum.a $(PREFIX)/data/programming/libraries/static
+ @mkdir -p $(PREFIX)/data/programming/c/headers/$(PACKAGE)
+ @for header in $(HEADERS) ; do cp $$header $(PREFIX)/data/programming/c/headers/$(PACKAGE) ; done
+
+package-source:
+ mkdir -p /home/per/Projects/Released/chaos-20001010/libraries/checksum/package-source/.
+ -cp -f autochaos.rules changelog configure COPYING README AUTHORS TODO INSTALL /home/per/Projects/Released/chaos-20001010/libraries/checksum/package-source/.
+ -cp -f makefile.template $(EXTRA_FILES) /home/per/Projects/Released/chaos-20001010/libraries/checksum/package-source/.
+ for header in $(HEADERS) ; do cp $$header /home/per/Projects/Released/chaos-20001010/libraries/checksum/package-source/. || exit ; done
+ for source in $(SOURCES) ; do cp $$source /home/per/Projects/Released/chaos-20001010/libraries/checksum/package-source/. || exit ; done
+package-check: package-source
+ cd package-source && ./configure $(ALL_ARGUMENTS) && $(MAKE) && $(MAKE) clean
+ find package-source -name makefile -exec rm {} ';'
+ rm package-source/config.h
+package: package-check
+ rm -rf checksum-0.0.1
+ mv package-source checksum-0.0.1
+ tar cvIf checksum-0.0.1.tar.bz2 checksum-0.0.1
+
+-include crc32.dep
+-include md5.dep
+
diff --git a/libraries/checksum/md5.c b/libraries/checksum/md5.c
new file mode 100644
index 00000000..322c3b9c
--- /dev/null
+++ b/libraries/checksum/md5.c
@@ -0,0 +1,347 @@
+/* $Id$ */
+/* Abstract: RSA Data Security, Inc., MD5 message-digest algorithm. */
+/* Author: Per Lundberg ,
+ Derived from the RSA Data Security, Inc. MD5
+ Message-Digest Algorithm. */
+
+/* Copyright 1991 RSA Data Security, Inc. */
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#include
+#include
+
+static void checksum_md5_transform (u32 state[4], const u8 block[64]);
+
+
+/* Check endianess. */
+/* FIXME: Have a define for the endianess instead of doing like this. */
+
+#ifdef i386
+#define encode memory_copy
+#define decode memory_copy
+#else /* i386 */
+
+/* Encodes input into output. Assumes length is a multiple of 4. */
+
+static void encode (u8 *output, const u32 *input, unsigned int length)
+{
+ unsigned int input_index, output_index;
+
+ for (input_index = 0, output_index = 0; output_index < length;
+ input_index++, output_index += 4)
+ {
+ output[output_index + 0] = (u8)((input[input_index] >> 0) & 0xFF);
+ output[output_index + 1] = (u8)((input[input_index] >> 8) & 0xFF);
+ output[output_index + 2] = (u8)((input[input_index] >> 16) & 0xFF);
+ output[output_index + 3] = (u8)((input[input_index] >> 24) & 0xFF);
+ }
+}
+
+/* Decodes input into output. Assumes length is a multiple of 4. */
+
+static void decode (u32 *output, const u8 *input, unsigned int length)
+{
+ unsigned int output_index, input_index;
+
+ for (output_index = 0, input_index = 0; input_index < length;
+ output_index++, input_index += 4)
+ {
+ output[output_index] = ((((u32) input[input_index + 0]) << 0) |
+ (((u32) input[input_index + 1]) << 8) |
+ (((u32) input[input_index + 2]) << 16) |
+ (((u32) input[input_index + 3]) << 24);
+ }
+}
+
+#endif /* i386 */
+
+static unsigned char PADDING[64] =
+{
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/* F, G, H and I are basic MD5 functions. */
+
+#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
+#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define I(x, y, z) ((y) ^ ((x) | (~z)))
+
+/* ROTATE_LEFT rotates x left n bits. */
+/* FIXME: This could be an inline function on i386 (using rol) */
+
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+
+/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
+ Rotation is separate from addition to prevent recomputation. */
+
+#define FF(a, b, c, d, x, s, ac) { \
+ (a) += F ((b), (c), (d)) + (x) + (u32) (ac); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ (a) += (b); \
+ }
+#define GG(a, b, c, d, x, s, ac) { \
+ (a) += G ((b), (c), (d)) + (x) + (u32) (ac); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ (a) += (b); \
+ }
+#define HH(a, b, c, d, x, s, ac) { \
+ (a) += H ((b), (c), (d)) + (x) + (u32) (ac); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ (a) += (b); \
+ }
+#define II(a, b, c, d, x, s, ac) { \
+ (a) += I ((b), (c), (d)) + (x) + (u32) (ac); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ (a) += (b); \
+ }
+
+/* MD5 initialization. Begins an MD5 operation, writing a new context. */
+
+static void checksum_md5_init (checksum_md5_context_type *context)
+{
+ context->count[0] = context->count[1] = 0;
+
+ /* Load magic initialization constants. */
+
+ context->state[0] = 0x67452301;
+ context->state[1] = 0xEFCDAB89;
+ context->state[2] = 0x98BADCFE;
+ context->state[3] = 0x10325476;
+}
+
+/* MD5 block update operation. Continues an MD5 message-digest
+ operation, processing another message block, and updating the
+ context. */
+
+static void checksum_md5_update
+ (checksum_md5_context_type *context, const u8 *input,
+ unsigned int input_length)
+{
+ unsigned int i, index, part_length;
+
+ /* Compute number of bytes mod 64 */
+
+ index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
+
+ /* Update number of bits */
+
+ context->count[0] += ((u32) input_length << 3);
+
+ if (context->count[0] < input_length << 3)
+ {
+ context->count[1]++;
+ }
+ context->count[1] += ((u32) input_length >> 29);
+
+ part_length = 64 - index;
+
+ /* Transform as many times as possible. */
+
+ if (input_length >= part_length)
+ {
+ memory_copy ((void *) &context->buffer[index],
+ (const void *) input, part_length);
+ checksum_md5_transform (context->state, context->buffer);
+
+ for (i = part_length; i + 63 < input_length; i += 64)
+ {
+ checksum_md5_transform (context->state, &input[i]);
+ }
+
+ index = 0;
+ }
+ else
+ {
+ i = 0;
+ }
+
+ /* Buffer remaining input */
+
+ memory_copy ((void *) &context->buffer[index], (const void *) &input[i],
+ input_length - i);
+}
+
+/* MD5 padding. Adds padding followed by original length. */
+
+static void checksum_md5_pad (checksum_md5_context_type *context)
+{
+ unsigned char bits[8];
+ unsigned int index, pad_length;
+
+ /* Save number of bits */
+
+ encode (bits, context->count, 8);
+
+ /* Pad out to 56 mod 64. */
+
+ index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
+ pad_length = (index < 56) ? (56 - index) : (120 - index);
+ checksum_md5_update (context, PADDING, pad_length);
+
+ /* Append length (before padding) */
+
+ checksum_md5_update (context, bits, 8);
+}
+
+/* MD5 finalization. Ends an MD5 message-digest operation, writing the
+ message digest and zeroizing the context. */
+
+static void checksum_md5_final
+ (checksum_md5_digest_type *digest, checksum_md5_context_type *context)
+{
+ /* Do padding. */
+
+ checksum_md5_pad (context);
+
+ /* Store state in digest */
+
+ encode (digest, context->state, 16);
+
+ /* Zeroize sensitive information. */
+
+ memory_set_u8 ((u8 *) context, 0, sizeof (checksum_md5_context_type));
+}
+
+/* MD5 basic transformation. Transforms state based on block. */
+
+static void checksum_md5_transform (u32 state[4], const u8 block[64])
+{
+ u32 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
+
+ decode (x, block, 64);
+
+ /* Round 1 */
+
+#define S11 7
+#define S12 12
+#define S13 17
+#define S14 22
+
+ FF (a, b, c, d, x[ 0], S11, 0xD76AA478); /* 1 */
+ FF (d, a, b, c, x[ 1], S12, 0xE8C7B756); /* 2 */
+ FF (c, d, a, b, x[ 2], S13, 0x242070DB); /* 3 */
+ FF (b, c, d, a, x[ 3], S14, 0xC1BDCEEE); /* 4 */
+ FF (a, b, c, d, x[ 4], S11, 0xF57C0FAF); /* 5 */
+ FF (d, a, b, c, x[ 5], S12, 0x4787C62A); /* 6 */
+ FF (c, d, a, b, x[ 6], S13, 0xA8304613); /* 7 */
+ FF (b, c, d, a, x[ 7], S14, 0xFD469501); /* 8 */
+ FF (a, b, c, d, x[ 8], S11, 0x698098D8); /* 9 */
+ FF (d, a, b, c, x[ 9], S12, 0x8B44F7AF); /* 10 */
+ FF (c, d, a, b, x[10], S13, 0xFFFF5BB1); /* 11 */
+ FF (b, c, d, a, x[11], S14, 0x895CD7BE); /* 12 */
+ FF (a, b, c, d, x[12], S11, 0x6B901122); /* 13 */
+ FF (d, a, b, c, x[13], S12, 0xFD987193); /* 14 */
+ FF (c, d, a, b, x[14], S13, 0xA679438E); /* 15 */
+ FF (b, c, d, a, x[15], S14, 0x49B40821); /* 16 */
+
+ /* Round 2 */
+
+#define S21 5
+#define S22 9
+#define S23 14
+#define S24 20
+
+ GG (a, b, c, d, x[ 1], S21, 0xF61E2562); /* 17 */
+ GG (d, a, b, c, x[ 6], S22, 0xC040B340); /* 18 */
+ GG (c, d, a, b, x[11], S23, 0x265E5A51); /* 19 */
+ GG (b, c, d, a, x[ 0], S24, 0xE9B6C7AA); /* 20 */
+ GG (a, b, c, d, x[ 5], S21, 0xD62F105D); /* 21 */
+ GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
+ GG (c, d, a, b, x[15], S23, 0xD8A1E681); /* 23 */
+ GG (b, c, d, a, x[ 4], S24, 0xE7D3FBC8); /* 24 */
+ GG (a, b, c, d, x[ 9], S21, 0x21E1CDE6); /* 25 */
+ GG (d, a, b, c, x[14], S22, 0xC33707D6); /* 26 */
+ GG (c, d, a, b, x[ 3], S23, 0xF4D50D87); /* 27 */
+ GG (b, c, d, a, x[ 8], S24, 0x455A14ED); /* 28 */
+ GG (a, b, c, d, x[13], S21, 0xA9E3E905); /* 29 */
+ GG (d, a, b, c, x[ 2], S22, 0xFCEFA3F8); /* 30 */
+ GG (c, d, a, b, x[ 7], S23, 0x676F02D9); /* 31 */
+ GG (b, c, d, a, x[12], S24, 0x8D2A4C8A); /* 32 */
+
+ /* Round 3 */
+
+#define S31 4
+#define S32 11
+#define S33 16
+#define S34 23
+
+ HH (a, b, c, d, x[ 5], S31, 0xFFFA3942); /* 33 */
+ HH (d, a, b, c, x[ 8], S32, 0x8771F681); /* 34 */
+ HH (c, d, a, b, x[11], S33, 0x6D9D6122); /* 35 */
+ HH (b, c, d, a, x[14], S34, 0xFDE5380C); /* 36 */
+ HH (a, b, c, d, x[ 1], S31, 0xA4BEEA44); /* 37 */
+ HH (d, a, b, c, x[ 4], S32, 0x4BDECFA9); /* 38 */
+ HH (c, d, a, b, x[ 7], S33, 0xF6BB4B60); /* 39 */
+ HH (b, c, d, a, x[10], S34, 0xBEBFBC70); /* 40 */
+ HH (a, b, c, d, x[13], S31, 0x289B7EC6); /* 41 */
+ HH (d, a, b, c, x[ 0], S32, 0xEAA127FA); /* 42 */
+ HH (c, d, a, b, x[ 3], S33, 0xD4EF3085); /* 43 */
+ HH (b, c, d, a, x[ 6], S34, 0x4881D05); /* 44 */
+ HH (a, b, c, d, x[ 9], S31, 0xD9D4D039); /* 45 */
+ HH (d, a, b, c, x[12], S32, 0xE6DB99E5); /* 46 */
+ HH (c, d, a, b, x[15], S33, 0x1FA27CF8); /* 47 */
+ HH (b, c, d, a, x[ 2], S34, 0xC4AC5665); /* 48 */
+
+ /* Round 4 */
+
+#define S41 6
+#define S42 10
+#define S43 15
+#define S44 21
+
+ II (a, b, c, d, x[ 0], S41, 0xF4292244); /* 49 */
+ II (d, a, b, c, x[ 7], S42, 0x432AFF97); /* 50 */
+ II (c, d, a, b, x[14], S43, 0xAB9423A7); /* 51 */
+ II (b, c, d, a, x[ 5], S44, 0xFC93A039); /* 52 */
+ II (a, b, c, d, x[12], S41, 0x655B59C3); /* 53 */
+ II (d, a, b, c, x[ 3], S42, 0x8F0CCC92); /* 54 */
+ II (c, d, a, b, x[10], S43, 0xFFEFF47D); /* 55 */
+ II (b, c, d, a, x[ 1], S44, 0x85845DD1); /* 56 */
+ II (a, b, c, d, x[ 8], S41, 0x6FA87E4F); /* 57 */
+ II (d, a, b, c, x[15], S42, 0xFE2CE6E0); /* 58 */
+ II (c, d, a, b, x[ 6], S43, 0xA3014314); /* 59 */
+ II (b, c, d, a, x[13], S44, 0x4E0811A1); /* 60 */
+ II (a, b, c, d, x[ 4], S41, 0xF7537E82); /* 61 */
+ II (d, a, b, c, x[11], S42, 0xBD3AF235); /* 62 */
+ II (c, d, a, b, x[ 2], S43, 0x2AD7D2BB); /* 63 */
+ II (b, c, d, a, x[ 9], S44, 0xEB86D391); /* 64 */
+
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+
+ /* Zeroize sensitive information. */
+
+ memory_set_u8 ((u8 *) x, 0, sizeof (x));
+}
+
+/* Wrapper function that does everything. */
+
+void checksum_md5
+ (void *input, unsigned int length, checksum_md5_digest_type *digest)
+{
+ checksum_md5_context_type context;
+
+ checksum_md5_init (&context);
+ checksum_md5_update (&context, input, length);
+ checksum_md5_final (digest, &context);
+}
diff --git a/libraries/checksum/md5.copyright b/libraries/checksum/md5.copyright
new file mode 100644
index 00000000..f5ecc5bd
--- /dev/null
+++ b/libraries/checksum/md5.copyright
@@ -0,0 +1,21 @@
+.\" $FreeBSD: src/lib/libmd/md5.copyright,v 1.5 1999/08/28 00:05:06 peter Exp $
+Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+rights reserved.
+.Pp
+License to copy and use this software is granted provided that it
+is identified as the "RSA Data Security, Inc. MD5 Message-Digest
+Algorithm" in all material mentioning or referencing this software
+or this function.
+.Pp
+License is also granted to make and use derivative works provided
+that such works are identified as "derived from the RSA Data
+Security, Inc. MD5 Message-Digest Algorithm" in all material
+mentioning or referencing the derived work.
+.Pp
+RSA Data Security, Inc. makes no representations concerning either
+the merchantability of this software or the suitability of this
+software for any particular purpose. It is provided "as is"
+without express or implied warranty of any kind.
+.Pp
+These notices must be retained in any copies of any part of this
+documentation and/or software.
diff --git a/libraries/checksum/types.h b/libraries/checksum/types.h
new file mode 100644
index 00000000..a14d3dee
--- /dev/null
+++ b/libraries/checksum/types.h
@@ -0,0 +1,48 @@
+/* $Id$ */
+/* Abstract: Checksum library types. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CHECKSUM_TYPES_H__
+#define __LIBRARY_CHECKSUM_TYPES_H__
+
+#include
+
+/* Type definitions. */
+
+/* MD5 context. */
+
+typedef struct
+{
+ /* State (ABCD). */
+
+ u32 state[4];
+
+ /* Number of bits, modulo 2^64 (lsb first). */
+
+ u32 count[2];
+
+ /* Input buffer. */
+
+ unsigned char buffer[64];
+} checksum_md5_context_type;
+
+typedef char checksum_md5_digest_type[CHECKSUM_MD5_DIGEST_LENGTH];
+
+#endif /* !__LIBRARY_CHECKSUM_TYPES_H__ */
diff --git a/libraries/console/autochaos.rules b/libraries/console/autochaos.rules
new file mode 100644
index 00000000..1ad39e0f
--- /dev/null
+++ b/libraries/console/autochaos.rules
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ makefile
+ ..
+
+
+
+
+ console.h
+ defines.h
+ functions.h
+ types.h
+ return_values.h
+
+
+
+
diff --git a/libraries/console/changelog b/libraries/console/changelog
new file mode 100644
index 00000000..09b11786
--- /dev/null
+++ b/libraries/console/changelog
@@ -0,0 +1,10 @@
+2000-07-22 Per Lundberg
+
+ * defines.h: Fixed some american typos.
+
+2000-07-16 Per Lundberg
+
+ * types.h: New header file.
+
+ * Fixed the package dependencies.
+
diff --git a/libraries/console/config.h b/libraries/console/config.h
new file mode 100644
index 00000000..39854562
--- /dev/null
+++ b/libraries/console/config.h
@@ -0,0 +1,11 @@
+/* Automatically generated by autochaos 0.2.1. Not intended to be
+ hand edited. */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define PACKAGE_NAME "console"
+#define PACKAGE_VERSION "0.0.1"
+
+
+#endif /* !__CONFIG_H__ */
\ No newline at end of file
diff --git a/libraries/console/configure b/libraries/console/configure
new file mode 100755
index 00000000..ff17f31f
--- /dev/null
+++ b/libraries/console/configure
@@ -0,0 +1,419 @@
+#! /usr/bin/perl -w
+
+# Abstract: Script for configuring this package.
+
+# Copyright 2000 chaos development. This script is in the public domain.
+
+# Please note that this script was automatically generated by
+# autochaos 0.2.1. It should not be modified. Do the changes you
+# want in autochaos instead.
+
+use strict;
+use POSIX;
+
+my $chaos_root = "/tftpboot/chaos";
+my @libraries = ();
+my @headers = ();
+my @sources = ();
+my @objects = ();
+my @deps = ();
+my $MAKEFILE;
+my $TEMPLATE;
+my $root_dir = getcwd ();
+my %options =
+(
+);
+
+my $install_prefix_flag = 0;
+
+foreach my $argument (@ARGV)
+{
+ if ($install_prefix_flag eq 1)
+ {
+ $chaos_root = $argument;
+ $install_prefix_flag = 0;
+ }
+ else
+ {
+ if ($argument eq '--install-prefix')
+ {
+ $install_prefix_flag = 1;
+ }
+ elsif ($argument =~ m/--enable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--enable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'TRUE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ elsif ($argument =~ m/--disable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--disable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'FALSE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+}
+
+if ($install_prefix_flag eq 1)
+{
+ print "Malformed --install-prefix command option. Value missing.\n";
+ exit 1;
+}
+
+print "\n Configuring library: console...\n\n";
+
+print ("Using chaos root... ($chaos_root)\n");
+
+
+my $all_arguments = "";
+foreach my $argument (@ARGV)
+{
+ $all_arguments .= $argument . " ";
+}
+
+print ("Checking for autochaos... ");
+my $autochaos = `autochaos --version 2> /dev/null`;
+
+my $has_autochaos;
+unless ($autochaos)
+{
+ print ("not found.\n");
+ $has_autochaos = undef;
+}
+else
+{
+ (my $version) = ($autochaos =~ m/ ([\d\.]+)$/);
+ print ("found (version $version).\n");
+ $has_autochaos = $version;
+}
+
+
+
+@headers = (
+'console.h',
+'defines.h',
+'functions.h',
+'types.h',
+'return_values.h',
+);
+
+@sources = (
+'console.c',
+);
+@objects = ('console.o',
+);
+@deps = ('console.dep',
+);
+ print "Writing ./makefile...
+";
+ open (MAKEFILE, '>' . "./makefile") or
+ die ("Could not write to ./makefile: $!\n");
+
+# Write the default rules we want.
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE "\n\nOBJECTS = ";
+ foreach my $object (@objects)
+ {
+ print MAKEFILE " \\\
+$object";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @headers > 0)
+ {
+ print MAKEFILE "\n\nHEADERS = ";
+ foreach my $header (@headers)
+ {
+ print MAKEFILE " \\\
+$header";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @sources > 0)
+ {
+ print MAKEFILE "\n\nSOURCES = ";
+ foreach my $source (@sources)
+ {
+ print MAKEFILE " \\\
+$source";
+ }
+ print MAKEFILE "\
+";
+
+ }
+
+ print (MAKEFILE < \$(*F).dep
+
+%.o: %.S
+ \@echo Compiling \$<...
+ \@\$(CC) -o \$(@) \$(CFLAGS) \$(INCLUDES) \$(DEFS) -c \$<
+ \@\$(CC) -M \$< \$(CFLAGS) \$(INCLUDES) \$(DEFS) > \$(*F).dep
+
+%.o: %.asm
+ \$(NASM) -o \$(@) \$< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+STOP
+
+ {
+ my $target = "library_console.a" if (scalar @objects);
+
+ unless ($target)
+ {
+ $target = "";
+ }
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE " rm -f \$(OBJECTS)
+";
+ }
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ foreach my $dep (@deps)
+ {
+ print (MAKEFILE "-include $dep\n");
+ }
+ }
+
+ print (MAKEFILE "\n");
+
+ if (open (TEMPLATE, "." . "/makefile.template"))
+ {
+ while ()
+ {
+ my $row = $_;
+
+ print (MAKEFILE $row);
+ }
+ }
+ close (MAKEFILE);
+
+
+ # Now, also write to the config.h
+
+ print "Writing config.h...\
+";
+ my $CONFIG;
+ open (CONFIG, '>config.h');
+ print (CONFIG <\n");
+ }
+
+ print (CONFIG "\n#endif /* !__CONFIG_H__ */");
+
+ close (CONFIG);
diff --git a/libraries/console/console.c b/libraries/console/console.c
new file mode 100644
index 00000000..83fa6618
--- /dev/null
+++ b/libraries/console/console.c
@@ -0,0 +1,388 @@
+/* $Id$ */
+/* Abstract: Console library. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+/* See The chaos Programming Reference Manual for more information
+ about the functions in this library. */
+
+#include
+#include
+#include
+#include
+
+#include "config.h"
+
+#define CONSOLE_MAILBOX_SIZE 32768
+
+/* Initialise a connection between the application and the console
+ service. */
+
+return_type console_init (console_structure_type *console_structure,
+ tag_type *tag, unsigned int connection_class)
+{
+ mailbox_id_type mailbox_id[10];
+ unsigned int services = 10;
+ message_parameter_type message_parameter;
+
+ console_structure->initialised = FALSE;
+
+ /* Try to resolve the console service. */
+
+ if (ipc_service_resolve ("console", mailbox_id, &services, 5, tag) !=
+ IPC_RETURN_SUCCESS)
+ {
+ return CONSOLE_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ console_structure->ipc_structure.output_mailbox_id = mailbox_id[0];
+
+ /* Connect to this service. */
+
+ if (ipc_service_connection_request (&console_structure->ipc_structure) !=
+ IPC_RETURN_SUCCESS)
+ {
+ return CONSOLE_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ console_structure->initialised = TRUE;
+
+ /* Send the connection class. */
+
+ message_parameter.protocol = IPC_PROTOCOL_CONSOLE;
+ message_parameter.message_class = IPC_CONSOLE_CONNECTION_CLASS_SET;
+ message_parameter.data = &connection_class;
+ message_parameter.length = sizeof (unsigned int);
+ message_parameter.block = TRUE;
+
+ system_call_mailbox_send (console_structure->ipc_structure.output_mailbox_id,
+ &message_parameter);
+
+ return CONSOLE_RETURN_SUCCESS;
+}
+
+/* Allocate and open a new console with the specified attributes. */
+/* FIXME: If input parameters are all zero (except for mode_type), a
+ default mode with the requested type should be set and the
+ attributes of that mode should be returned. */
+
+return_type console_open (console_structure_type *console_structure,
+ unsigned int width, unsigned int height,
+ unsigned int depth, int mode_type)
+{
+ message_parameter_type message_parameter;
+ ipc_console_attribute_type console_attribute;
+
+ if (!console_structure->initialised)
+ {
+ return CONSOLE_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ /* Try to open a console with the requested attributes. */
+ /* FIXME: Handle return values. */
+
+ console_attribute.width = width;
+ console_attribute.height = height;
+ console_attribute.depth = depth;
+ console_attribute.mode_type = mode_type;
+
+ message_parameter.protocol = IPC_PROTOCOL_CONSOLE;
+ message_parameter.length = sizeof (ipc_console_attribute_type);
+ message_parameter.message_class = IPC_CONSOLE_OPEN;
+ message_parameter.data = (void *) &console_attribute;
+ message_parameter.block = TRUE;
+
+ system_call_mailbox_send (console_structure->ipc_structure.output_mailbox_id,
+ &message_parameter);
+
+ /* FIXME: Wait for return value. */
+
+ return CONSOLE_RETURN_SUCCESS;
+}
+
+/* Change the attributes of the current console. */
+
+return_type console_mode_set (console_structure_type *console_structure,
+ unsigned int width, unsigned int height,
+ unsigned int depth, int mode_type)
+{
+ message_parameter_type message_parameter;
+ ipc_console_attribute_type console_attribute;
+
+ if (!console_structure->initialised)
+ {
+ return CONSOLE_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ console_attribute.width = width;
+ console_attribute.height = height;
+ console_attribute.depth = depth;
+ console_attribute.mode_type = mode_type;
+
+ message_parameter.protocol = IPC_PROTOCOL_CONSOLE;
+ message_parameter.length = sizeof (ipc_console_attribute_type);
+ message_parameter.message_class = IPC_CONSOLE_MODE_SET;
+ message_parameter.data = (void *) &console_attribute;
+ message_parameter.block = TRUE;
+
+ system_call_mailbox_send (console_structure->ipc_structure.output_mailbox_id,
+ &message_parameter);
+ return CONSOLE_RETURN_SUCCESS;
+}
+
+/* Change the size (text rows and columns, not mode!) of the current
+ console. */
+
+return_type console_resize (console_structure_type *console_structure,
+ unsigned int width, unsigned int height)
+{
+ ipc_console_resize_type ipc_console_resize;
+ message_parameter_type message_parameter;
+
+ if (!console_structure->initialised)
+ {
+ return CONSOLE_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ ipc_console_resize.width = width;
+ ipc_console_resize.height = height;
+
+ message_parameter.protocol = IPC_PROTOCOL_CONSOLE;
+ message_parameter.length = sizeof (ipc_console_resize_type);
+ message_parameter.message_class = IPC_CONSOLE_RESIZE;
+ message_parameter.data = (void *) &ipc_console_resize;
+ message_parameter.block = TRUE;
+
+ system_call_mailbox_send (console_structure->ipc_structure.output_mailbox_id,
+ &message_parameter);
+
+ return CONSOLE_RETURN_SUCCESS;
+}
+
+/* Tell the console server that we want input from the keyboard sent to us. */
+
+return_type console_use_keyboard (console_structure_type *console_structure,
+ bool which, int type)
+{
+ message_parameter_type message_parameter;
+
+ /* Shall we use the keyboard at all? */
+
+ message_parameter.block = TRUE;
+ message_parameter.protocol = IPC_PROTOCOL_CONSOLE;
+ message_parameter.message_class = which ? IPC_CONSOLE_ENABLE_KEYBOARD :
+ IPC_CONSOLE_DISABLE_KEYBOARD ;
+ message_parameter.length = 0;
+ message_parameter.data = NULL;
+ system_call_mailbox_send (console_structure->ipc_structure.output_mailbox_id,
+ &message_parameter);
+
+ /* Extended or normal target? */
+
+ switch (type)
+ {
+ case CONSOLE_KEYBOARD_NORMAL:
+ {
+ message_parameter.message_class = IPC_CONSOLE_KEYBOARD_NORMAL;
+ break;
+ }
+
+ case CONSOLE_KEYBOARD_EXTENDED:
+ {
+ message_parameter.message_class = IPC_CONSOLE_KEYBOARD_EXTENDED;
+ break;
+ }
+
+ default:
+ {
+ return CONSOLE_RETURN_INVALID_ARGUMENT;
+ }
+ }
+
+ system_call_mailbox_send (console_structure->ipc_structure.output_mailbox_id,
+ &message_parameter);
+ return CONSOLE_RETURN_SUCCESS;
+}
+
+/* Tell the console server that we want input from the mouse sent to us. */
+
+return_type console_use_mouse (console_structure_type *console_structure,
+ bool which)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.block = TRUE;
+ message_parameter.protocol = IPC_PROTOCOL_CONSOLE;
+ message_parameter.message_class = which ? IPC_CONSOLE_ENABLE_MOUSE :
+ IPC_CONSOLE_DISABLE_MOUSE ;
+ message_parameter.length = 0;
+ message_parameter.data = NULL;
+ system_call_mailbox_send (console_structure->ipc_structure.output_mailbox_id,
+ &message_parameter);
+ return CONSOLE_RETURN_SUCCESS;
+}
+
+/* Print a string to the console service. */
+
+return_type console_print (console_structure_type *console_structure,
+ const char *string)
+{
+ message_parameter_type message_parameter;
+
+ if (!console_structure->initialised)
+ {
+ return CONSOLE_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ message_parameter.protocol = IPC_PROTOCOL_CONSOLE;
+ message_parameter.length = string_length (string) + 1;
+ message_parameter.message_class = IPC_CONSOLE_OUTPUT;
+ message_parameter.data = (void *) string;
+ message_parameter.block = TRUE;
+
+ system_call_mailbox_send (console_structure->ipc_structure.output_mailbox_id,
+ &message_parameter);
+
+ return CONSOLE_RETURN_SUCCESS;
+}
+
+/* Prints the given data to the console, a la printf and friends. */
+
+return_type console_print_formatted (console_structure_type *console_structure,
+ const char *format_string, ...)
+{
+ va_list arguments;
+ return_type return_value;
+
+ /* FIXME! */
+
+ char output[1024];
+
+ if (format_string == NULL)
+ {
+ output[0] = '\0';
+ return CONSOLE_RETURN_INVALID_ARGUMENT;
+ }
+
+ va_start (arguments, format_string);
+ return_value = string_print_va (output, format_string, arguments);
+ va_end (arguments);
+
+ return console_print (console_structure, output);
+}
+
+return_type console_clear (console_structure_type *console_structure)
+{
+ return console_print (console_structure, "\e[2J\e[1;1H");
+}
+
+/* Move the cursor. Zero indexed!!! */
+
+return_type console_cursor_move (console_structure_type *console_structure,
+ unsigned int x, unsigned int y)
+{
+ /* FIXME: Should store the size of the console somewhere. */
+
+ if (x > 1000 || y > 1000)
+ {
+ return CONSOLE_RETURN_INVALID_ARGUMENT;
+ }
+ else
+ {
+ return console_print_formatted (console_structure,
+ "\e[%d;%dH", x + 1, y + 1);
+ }
+}
+
+/* Set the attributes. */
+/* FIXME: There should be a function for each of the attributes. */
+
+return_type console_attribute_set (console_structure_type *console_structure,
+ int foreground, int background,
+ int attributes)
+{
+ return console_print_formatted (console_structure, "\e[%d;%d;%dm",
+ attributes, foreground + 30,
+ background + 40);
+}
+
+/* Set the cursor appearance. */
+
+return_type console_cursor_appearance_set
+ (console_structure_type *console_structure, bool visibility, bool block)
+{
+ /* FIXME: Add ANSI commands for setting the console appearance. We
+ can not really _add_ ANSI commands, can we? ;) */
+
+ if (!visibility)
+ {
+ /* Hide the cursor. */
+
+ }
+ else if (block)
+ {
+ /* Make it a block one. */
+
+ }
+ else
+ {
+ /* Make it a thin line. */
+
+ }
+
+ console_structure = console_structure;
+
+ return CONSOLE_RETURN_SUCCESS;
+}
+
+/* Wait or check for an event on the console. Mouse or keyboard. */
+
+return_type console_event_wait (console_structure_type *console_structure,
+ void *event_data, int *type, bool block)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.block = block;
+
+ /* FIXME: Should be max_of_two (sizeof (console_mouse_event_type),
+ sizeof (console_keyboard_event_type); */
+
+ message_parameter.length = sizeof (keyboard_packet_type);
+ message_parameter.data = event_data;
+ message_parameter.protocol = IPC_PROTOCOL_CONSOLE;
+ message_parameter.message_class = IPC_CLASS_NONE;
+
+ system_call_mailbox_receive
+ (console_structure->ipc_structure.input_mailbox_id, &message_parameter);
+
+ if (message_parameter.message_class == IPC_CONSOLE_KEYBOARD_EVENT)
+ {
+ *type = CONSOLE_EVENT_KEYBOARD;
+ }
+ else if (message_parameter.message_class == IPC_CONSOLE_MOUSE_EVENT)
+ {
+ *type = CONSOLE_EVENT_MOUSE;
+ }
+ else
+ {
+ return CONSOLE_RETURN_BAD_DATA_RETURNED;
+ }
+
+ return CONSOLE_RETURN_SUCCESS;
+}
diff --git a/libraries/console/console.h b/libraries/console/console.h
new file mode 100644
index 00000000..9c885ced
--- /dev/null
+++ b/libraries/console/console.h
@@ -0,0 +1,31 @@
+/* $Id$ */
+/* Abstract: Function prototypes and structure definitions for the
+ console library. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CONSOLE_CONSOLE_H__
+#define __LIBRARY_CONSOLE_CONSOLE_H__
+
+#include
+#include
+#include
+#include
+
+#endif /* !__LIBRARY_CONSOLE_H__ */
diff --git a/libraries/console/defines.h b/libraries/console/defines.h
new file mode 100644
index 00000000..d3595e7d
--- /dev/null
+++ b/libraries/console/defines.h
@@ -0,0 +1,61 @@
+/* $Id$ */
+/* Abstract: Defines used by the console library. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CONSOLE_DEFINES_H__
+#define __LIBRARY_CONSOLE_DEFINES_H__
+
+/* Defines. */
+
+/* Welcome, to the Real World. In this, we use EGA colors in the year
+ of 2KAD... */
+
+enum
+{
+ CONSOLE_COLOUR_BLACK,
+ CONSOLE_COLOUR_RED,
+ CONSOLE_COLOUR_GREEN,
+ CONSOLE_COLOUR_CYAN,
+ CONSOLE_COLOUR_BLUE,
+ CONSOLE_COLOUR_PURPLE,
+ CONSOLE_COLOUR_BROWN,
+ CONSOLE_COLOUR_GRAY,
+};
+
+enum
+{
+ CONSOLE_ATTRIBUTE_RESET = 0,
+ CONSOLE_ATTRIBUTE_BRIGHT = 1,
+ CONSOLE_ATTRIBUTE_BLINK = 5,
+};
+
+enum
+{
+ CONSOLE_KEYBOARD_NORMAL,
+ CONSOLE_KEYBOARD_EXTENDED
+};
+
+enum
+{
+ CONSOLE_EVENT_KEYBOARD,
+ CONSOLE_EVENT_MOUSE
+};
+
+#endif /* !__LIBRARY_CONSOLE_DEFINES_H__ */
diff --git a/libraries/console/functions.h b/libraries/console/functions.h
new file mode 100644
index 00000000..58392b1a
--- /dev/null
+++ b/libraries/console/functions.h
@@ -0,0 +1,69 @@
+/* $Id$ */
+/* Abstract: Function definitions for the console library. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CONSOLE_FUNCTIONS_H__
+#define __LIBRARY_CONSOLE_FUNCTIONS_H__
+
+#include
+#include
+
+extern return_type console_init
+ (console_structure_type *console_structure, tag_type *tag,
+ unsigned int connection_class);
+
+extern return_type console_open
+ (console_structure_type *console_structure,
+ unsigned int width, unsigned int height,
+ unsigned int depth, int mode_type);
+
+extern return_type console_mode_set
+ (console_structure_type *console_structure,
+ unsigned int width, unsigned int height,
+ unsigned int depth, int mode_type);
+
+extern return_type console_resize
+ (console_structure_type *console_structure,
+ unsigned int width, unsigned int height);
+
+extern return_type console_print
+ (console_structure_type *console_structure,
+ const char *string);
+
+extern return_type console_print_formatted
+ (console_structure_type *console_structure, const char *string, ...);
+// __attribute__ ((format (printf, 1, 2)));
+extern return_type console_clear (console_structure_type *console_structure);
+extern return_type console_cursor_move
+ (console_structure_type *console_structure, unsigned int x, unsigned int y);
+extern return_type console_attribute_set
+ (console_structure_type *console_structure, int foreground, int background,
+ int attributes);
+extern return_type console_cursor_appearance_set
+ (console_structure_type *console_structure, bool visibility, bool block);
+extern return_type console_use_keyboard
+ (console_structure_type *console_structure, bool which, int type);
+extern return_type console_use_mouse
+ (console_structure_type *console_structure, bool which);
+extern return_type console_event_wait
+ (console_structure_type *console_structure, void *event_data, int *type,
+ bool block);
+
+#endif /* !__LIBRARY_CONSOLE_FUNCTIONS_H__ */
diff --git a/libraries/console/makefile b/libraries/console/makefile
new file mode 100644
index 00000000..d32af42c
--- /dev/null
+++ b/libraries/console/makefile
@@ -0,0 +1,119 @@
+# This makefile was generated by autochaos 0.2.1. Please do not
+# tamper with it unless you are very certain about what you are doing.
+
+ALL_ARGUMENTS = --install-prefix /tftpboot/chaos
+
+PREFIX = /tftpboot/chaos
+PACKAGE = console
+
+# Compiler flags.
+
+CFLAGS = -Wall -W -Wshadow -Wpointer-arith -Waggregate-return \
+-Wstrict-prototypes -Wredundant-decls -Winline -Wmissing-prototypes \
+-Werror -Wcast-align -Wbad-function-cast -Wsign-compare \
+-Wmissing-declarations -Wmissing-noreturns -pipe \
+-Wnested-externs -O3 -fno-builtin -funsigned-char -g $(EXTRA_CFLAGS) $(DEFINES)
+
+INCLUDES = \
+-I.. \
+-I. -I$(PREFIX)/data/programming/c/headers
+
+ALL_OBJECTS = \
+./console.o
+
+STATIC_LIBRARY_PATH = $(PREFIX)/data/programming/libraries/static
+
+# Ideally, this would be -lwhatever, but we have not started patching
+# the GNU tools yet...
+
+LIBS =
+
+OBJECTS = \
+console.o
+
+
+HEADERS = \
+console.h \
+defines.h \
+functions.h \
+types.h \
+return_values.h
+
+
+SOURCES = \
+console.c
+
+HEADER_PATH = $(PREFIX)/data/programming/c/headers/$(PACKAGE)/.
+
+# TODO: Those should be overridable.
+
+CC = gcc-2.95
+NASM = nasm
+AR = ar
+RANLIB = ranlib
+GZIP = gzip -f
+
+%.o: %.c
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.S
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.asm
+ $(NASM) -o $(@) $< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+all: splash makefile library_console.a
+
+clean:
+ rm -f library_console.a
+ rm -f $(OBJECTS)
+ rm -f *.dep
+ -$(MAKE) clean-local
+makefile: configure
+ @./configure
+
+splash:
+ @echo -e "\n Compiling library: console...\n"
+
+configure: autochaos.rules
+ @autochaos
+
+
+LDFLAGS = $(PREFIX)/data/programming/c/startup/startup.o \
+-nostdlib -Wl,-T,$(PREFIX)/data/programming/linker/chaos.ld -lgcc $(EXTRA_LDFLAGS)
+
+library_console.a: $(OBJECTS)
+ @echo "Creating library..."
+ @$(AR) cru $(@) $(OBJECTS)
+ @$(RANLIB) $(@)
+
+install: all
+ @echo "Installing..."
+ @mkdir -p $(PREFIX)/data/programming/libraries/static
+ @cp library_console.a $(PREFIX)/data/programming/libraries/static
+ @mkdir -p $(PREFIX)/data/programming/c/headers/$(PACKAGE)
+ @for header in $(HEADERS) ; do cp $$header $(PREFIX)/data/programming/c/headers/$(PACKAGE) ; done
+
+package-source:
+ mkdir -p /home/per/Projects/Released/chaos-20001010/libraries/console/package-source/.
+ -cp -f autochaos.rules changelog configure COPYING README AUTHORS TODO INSTALL /home/per/Projects/Released/chaos-20001010/libraries/console/package-source/.
+ -cp -f makefile.template $(EXTRA_FILES) /home/per/Projects/Released/chaos-20001010/libraries/console/package-source/.
+ for header in $(HEADERS) ; do cp $$header /home/per/Projects/Released/chaos-20001010/libraries/console/package-source/. || exit ; done
+ for source in $(SOURCES) ; do cp $$source /home/per/Projects/Released/chaos-20001010/libraries/console/package-source/. || exit ; done
+package-check: package-source
+ cd package-source && ./configure $(ALL_ARGUMENTS) && $(MAKE) && $(MAKE) clean
+ find package-source -name makefile -exec rm {} ';'
+ rm package-source/config.h
+package: package-check
+ rm -rf console-0.0.1
+ mv package-source console-0.0.1
+ tar cvIf console-0.0.1.tar.bz2 console-0.0.1
+
+-include console.dep
+
diff --git a/libraries/console/return_values.h b/libraries/console/return_values.h
new file mode 100644
index 00000000..7d4bf80a
--- /dev/null
+++ b/libraries/console/return_values.h
@@ -0,0 +1,51 @@
+/* $Id$ */
+/* Abstract: Return values used by the console library. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CONSOLE_RETURN_VALUES_H__
+#define __LIBRARY_CONSOLE_RETURN_VALUES_H__
+
+/* Console error codes. */
+
+enum
+{
+ /* The function completed successfully. */
+
+ CONSOLE_RETURN_SUCCESS,
+
+ /* One or more of the services required by this library was not
+ available. */
+
+ CONSOLE_RETURN_SERVICE_UNAVAILABLE,
+
+ /* One or more of the input arguments was invalid. */
+
+ CONSOLE_RETURN_INVALID_ARGUMENT,
+
+ /* The console server returned unrecognized data. */
+
+ CONSOLE_RETURN_BAD_DATA_RETURNED,
+
+ /* The given console structure was already initialised. */
+
+ CONSOLE_RETURN_ALREADY_INITIALISED,
+};
+
+#endif /* !__LIBRARY_CONSOLE_RETURN_VALUES_H__ */
diff --git a/libraries/console/types.h b/libraries/console/types.h
new file mode 100644
index 00000000..86afbbe9
--- /dev/null
+++ b/libraries/console/types.h
@@ -0,0 +1,38 @@
+/* $Id$ */
+/* Abstract: Console library types. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_CONSOLE_TYPES_H__
+#define __LIBRARY_CONSOLE_TYPES_H__
+
+#include
+
+typedef struct
+{
+ ipc_structure_type ipc_structure;
+ unsigned int width;
+ unsigned int height;
+ unsigned int depth;
+ unsigned int type;
+ bool initialised;
+ bool opened;
+} console_structure_type;
+
+#endif /* !__LIBRARY_CONSOLE_TYPES_H__ */
diff --git a/libraries/execute_elf/autochaos.rules b/libraries/execute_elf/autochaos.rules
new file mode 100644
index 00000000..d4d88c7c
--- /dev/null
+++ b/libraries/execute_elf/autochaos.rules
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ makefile
+ ..
+
+
+
+
+ execute_elf.h
+ return_values.h
+
+
+
+
\ No newline at end of file
diff --git a/libraries/execute_elf/config.h b/libraries/execute_elf/config.h
new file mode 100644
index 00000000..74693c0e
--- /dev/null
+++ b/libraries/execute_elf/config.h
@@ -0,0 +1,11 @@
+/* Automatically generated by autochaos 0.2.1. Not intended to be
+ hand edited. */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define PACKAGE_NAME "execute_elf"
+#define PACKAGE_VERSION "0.0.1"
+
+
+#endif /* !__CONFIG_H__ */
\ No newline at end of file
diff --git a/libraries/execute_elf/configure b/libraries/execute_elf/configure
new file mode 100755
index 00000000..1a818fa3
--- /dev/null
+++ b/libraries/execute_elf/configure
@@ -0,0 +1,416 @@
+#! /usr/bin/perl -w
+
+# Abstract: Script for configuring this package.
+
+# Copyright 2000 chaos development. This script is in the public domain.
+
+# Please note that this script was automatically generated by
+# autochaos 0.2.1. It should not be modified. Do the changes you
+# want in autochaos instead.
+
+use strict;
+use POSIX;
+
+my $chaos_root = "/tftpboot/chaos";
+my @libraries = ();
+my @headers = ();
+my @sources = ();
+my @objects = ();
+my @deps = ();
+my $MAKEFILE;
+my $TEMPLATE;
+my $root_dir = getcwd ();
+my %options =
+(
+);
+
+my $install_prefix_flag = 0;
+
+foreach my $argument (@ARGV)
+{
+ if ($install_prefix_flag eq 1)
+ {
+ $chaos_root = $argument;
+ $install_prefix_flag = 0;
+ }
+ else
+ {
+ if ($argument eq '--install-prefix')
+ {
+ $install_prefix_flag = 1;
+ }
+ elsif ($argument =~ m/--enable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--enable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'TRUE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ elsif ($argument =~ m/--disable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--disable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'FALSE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+}
+
+if ($install_prefix_flag eq 1)
+{
+ print "Malformed --install-prefix command option. Value missing.\n";
+ exit 1;
+}
+
+print "\n Configuring library: execute_elf...\n\n";
+
+print ("Using chaos root... ($chaos_root)\n");
+
+
+my $all_arguments = "";
+foreach my $argument (@ARGV)
+{
+ $all_arguments .= $argument . " ";
+}
+
+print ("Checking for autochaos... ");
+my $autochaos = `autochaos --version 2> /dev/null`;
+
+my $has_autochaos;
+unless ($autochaos)
+{
+ print ("not found.\n");
+ $has_autochaos = undef;
+}
+else
+{
+ (my $version) = ($autochaos =~ m/ ([\d\.]+)$/);
+ print ("found (version $version).\n");
+ $has_autochaos = $version;
+}
+
+
+
+@headers = (
+'execute_elf.h',
+'return_values.h',
+);
+
+@sources = (
+'execute_elf.c',
+);
+@objects = ('execute_elf.o',
+);
+@deps = ('execute_elf.dep',
+);
+ print "Writing ./makefile...
+";
+ open (MAKEFILE, '>' . "./makefile") or
+ die ("Could not write to ./makefile: $!\n");
+
+# Write the default rules we want.
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE "\n\nOBJECTS = ";
+ foreach my $object (@objects)
+ {
+ print MAKEFILE " \\\
+$object";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @headers > 0)
+ {
+ print MAKEFILE "\n\nHEADERS = ";
+ foreach my $header (@headers)
+ {
+ print MAKEFILE " \\\
+$header";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @sources > 0)
+ {
+ print MAKEFILE "\n\nSOURCES = ";
+ foreach my $source (@sources)
+ {
+ print MAKEFILE " \\\
+$source";
+ }
+ print MAKEFILE "\
+";
+
+ }
+
+ print (MAKEFILE < \$(*F).dep
+
+%.o: %.S
+ \@echo Compiling \$<...
+ \@\$(CC) -o \$(@) \$(CFLAGS) \$(INCLUDES) \$(DEFS) -c \$<
+ \@\$(CC) -M \$< \$(CFLAGS) \$(INCLUDES) \$(DEFS) > \$(*F).dep
+
+%.o: %.asm
+ \$(NASM) -o \$(@) \$< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+STOP
+
+ {
+ my $target = "library_execute_elf.a" if (scalar @objects);
+
+ unless ($target)
+ {
+ $target = "";
+ }
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE " rm -f \$(OBJECTS)
+";
+ }
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ foreach my $dep (@deps)
+ {
+ print (MAKEFILE "-include $dep\n");
+ }
+ }
+
+ print (MAKEFILE "\n");
+
+ if (open (TEMPLATE, "." . "/makefile.template"))
+ {
+ while ()
+ {
+ my $row = $_;
+
+ print (MAKEFILE $row);
+ }
+ }
+ close (MAKEFILE);
+
+
+ # Now, also write to the config.h
+
+ print "Writing config.h...\
+";
+ my $CONFIG;
+ open (CONFIG, '>config.h');
+ print (CONFIG <\n");
+ }
+
+ print (CONFIG "\n#endif /* !__CONFIG_H__ */");
+
+ close (CONFIG);
diff --git a/libraries/execute_elf/execute_elf.c b/libraries/execute_elf/execute_elf.c
new file mode 100644
index 00000000..9b78b99b
--- /dev/null
+++ b/libraries/execute_elf/execute_elf.c
@@ -0,0 +1,186 @@
+/* $Id$ */
+/* Abstract: ELF execution library. */
+/* Author: Henrik Hallin */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#include
+#include
+#include
+
+return_type execute_elf (elf_header_type *elf_header, char *parameter_string,
+ process_id_type *child_process_id)
+{
+ section_header_type *section_header;
+ int index;
+ u32 code_section_base = 0, data_section_base = 0, bss_section_base = 0;
+ u32 code_section_size = 0, data_section_size = 0, bss_section_size = 0;
+ void *code_section_address = NULL;
+ void *data_section_address = NULL;
+ process_create_type elf_process_create;
+ return_type return_value;
+
+ /* First of all, make sure this is an ELF image... */
+
+ if (!(elf_header->identification[0] == 0x7F &&
+ elf_header->identification[1] == 'E' &&
+ elf_header->identification[2] == 'L' &&
+ elf_header->identification[3] == 'F'))
+ {
+ return EXECUTE_ELF_RETURN_IMAGE_INVALID;
+ }
+
+ /* ...and a 32-bit one... */
+
+ if (elf_header->class != ELF_CLASS_32BIT)
+ {
+ return EXECUTE_ELF_RETURN_ELF_UNSUPPORTED;
+ }
+
+ /* ...big endian... */
+
+ if (elf_header->endian != ELF_ENDIAN_BIG)
+ {
+ return EXECUTE_ELF_RETURN_ELF_UNSUPPORTED;
+ }
+
+ /* ...executable... */
+
+ if (elf_header->type != ELF_TYPE_EXECUTABLE)
+ {
+ return EXECUTE_ELF_RETURN_ELF_UNSUPPORTED;
+ }
+
+ /* ...of the right ELF version. */
+
+ if (elf_header->version != ELF_VERSION_CURRENT)
+ {
+ return EXECUTE_ELF_RETURN_ELF_UNSUPPORTED;
+ }
+
+ /* Well, that was the identification block. Now for the real part of
+ the ELF header... */
+
+ /* Make sure it is for Intel 80386. */
+
+ if (elf_header->machine != ELF_MACHINE_386)
+ {
+ return EXECUTE_ELF_RETURN_ELF_UNSUPPORTED;
+ }
+
+ /* Start by finding the size of the eventual BSS section. The first
+ section is used to mark undefined section references, so we start
+ counting from one. */
+
+ for (index = 1; index < elf_header->section_header_entries; index++)
+ {
+ section_header = (section_header_type *)
+ ((u32) elf_header + elf_header->section_header_offset +
+ index * elf_header->section_header_entry_size);
+
+ if (section_header->flags ==
+ (ELF_SECTION_FLAG_WRITE | ELF_SECTION_FLAG_ALLOCATE) &&
+ section_header->type == ELF_SECTION_TYPE_NO_SPACE)
+ {
+ bss_section_size = section_header->size;
+ bss_section_base = section_header->address;
+ }
+ }
+
+ /* Go through the section header table to find out where to put
+ stuff. */
+
+ for (index = 1; index < elf_header->section_header_entries; index++)
+ {
+ section_header = (section_header_type *)
+ ((u32) elf_header + elf_header->section_header_offset +
+ index * elf_header->section_header_entry_size);
+
+ /* Check which type of section this is. */
+
+ switch (section_header->flags)
+ {
+ /* .data or .code */
+
+ case ELF_SECTION_FLAG_WRITE | ELF_SECTION_FLAG_ALLOCATE:
+ case ELF_SECTION_FLAG_ALLOCATE | ELF_SECTION_FLAG_EXECUTE:
+ {
+ if (section_header->type == ELF_SECTION_TYPE_NO_SPACE)
+ {
+ break;
+ }
+
+ switch (section_header->flags)
+ {
+ /* .data */
+
+ case ELF_SECTION_FLAG_WRITE | ELF_SECTION_FLAG_ALLOCATE:
+ {
+ data_section_size = section_header->size;
+ data_section_base = section_header->address;
+ data_section_address = (void *) ((u32) elf_header + section_header->offset);
+
+ break;
+ }
+
+ /* .code */
+
+ case ELF_SECTION_FLAG_ALLOCATE | ELF_SECTION_FLAG_EXECUTE:
+ {
+ code_section_size = section_header->size;
+ code_section_base = section_header->address;
+ code_section_address = (void *) ((u32) elf_header + section_header->offset);
+
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /* Let the kernel create us a process. */
+
+ elf_process_create.initial_eip = elf_header->entry_point;
+ elf_process_create.process_type = PROCESS_TYPE_SERVER;
+ elf_process_create.parameter_string = parameter_string;
+ elf_process_create.process_id = child_process_id;
+ elf_process_create.code_section_address = code_section_address;
+ elf_process_create.code_section_size = code_section_size;
+ elf_process_create.code_section_base = code_section_base;
+ elf_process_create.data_section_address = data_section_address;
+ elf_process_create.data_section_size = data_section_size;
+ elf_process_create.data_section_base = data_section_base;
+ elf_process_create.bss_section_size = bss_section_size;
+ elf_process_create.bss_section_base = bss_section_base;
+
+ return_value = system_call_process_create (&elf_process_create);
+
+ switch (return_value)
+ {
+ case STORM_RETURN_SUCCESS:
+ {
+ return EXECUTE_ELF_RETURN_SUCCESS;
+ }
+
+ default:
+ {
+ return EXECUTE_ELF_RETURN_FAILED;
+ }
+ }
+}
diff --git a/libraries/execute_elf/execute_elf.h b/libraries/execute_elf/execute_elf.h
new file mode 100644
index 00000000..35af0037
--- /dev/null
+++ b/libraries/execute_elf/execute_elf.h
@@ -0,0 +1,333 @@
+/* $Id$ */
+/* Abstract: ELF execution library header files. */
+/* Author: Henrik Hallin */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_EXECUTE_ELF_EXECUTE_ELF_H__
+#define __LIBRARY_EXECUTE_ELF_EXECUTE_ELF_H__
+
+#include
+#include
+
+/* More information about the ELF format can be found in the ELF
+ specification, as published by the Tool Interface Standards (TIS). */
+
+/* Enumerations. */
+
+/* File classes. */
+
+enum
+{
+ /* No class. Bad ELF. */
+
+ ELF_CLASS_NONE,
+
+ /* 32-bit ELF. */
+
+ ELF_CLASS_32BIT,
+
+ /* 64-bit ELF. */
+
+ ELF_CLASS_64BIT,
+};
+
+/* File types. */
+
+enum
+{
+ /* No file type. */
+
+ ELF_TYPE_NONE,
+
+ /* Relocatable file (i.e. position independant code, or PIC) */
+
+ ELF_TYPE_RELOCATABLE,
+
+ /* Executable file. */
+
+ ELF_TYPE_EXECUTABLE,
+
+ /* Shared object file. */
+
+ ELF_TYPE_DYNAMIC,
+
+ /* Core dump. */
+
+ ELF_TYPE_CORE,
+};
+
+/* Machine types. */
+
+enum
+{
+ /* No machne. */
+
+ ELF_MACHINE_NONE,
+
+ /* AT&T WE 32100 */
+
+ ELF_MACHINE_WE32100,
+
+ /* Sparc. */
+
+ ELF_MACHINE_SPARC,
+
+ /* Intel 80386. */
+
+ ELF_MACHINE_386,
+
+ /* Motorola 68000. */
+
+ ELF_MACHINE_68000,
+
+ /* Motorola 88000. */
+
+ ELF_MACHINE_88000,
+
+ /* Intel 80860. */
+
+ ELF_MACHINE_860,
+
+ /* MIPS RS3000. */
+
+ ELF_MACHINE_RS3000,
+};
+
+/* ELF versions. */
+
+enum
+{
+ /* Invalid version. */
+
+ ELF_VERSION_NONE,
+
+ /* Current version. */
+
+ ELF_VERSION_CURRENT,
+};
+
+/* Endianess. */
+
+enum
+{
+ /* No endian (invalid). */
+
+ ELF_ENDIAN_NONE,
+
+ /* Big endian. */
+
+ ELF_ENDIAN_BIG,
+
+ /* Little endian. */
+
+ ELF_ENDIAN_LITTLE,
+};
+
+/* Section types. */
+
+enum
+{
+ /* This section is inactive. */
+
+ ELF_SECTION_TYPE_NULL,
+
+ /* This section is used for something defined by the program
+ itself. */
+
+ ELF_SECTION_TYPE_UNDEFINED,
+
+ /* This section holds the symbol table. May only exist once in the
+ file. */
+
+ ELF_SECTION_TYPE_SYMBOL_TABLE,
+
+ /* This section holds the string table. May only exist once in the
+ file. */
+
+ ELF_SECTION_TYPE_STRING_TABLE,
+
+ /* This section holds relocation entries with explicit addends
+ (?). */
+
+ ELF_SECTION_TYPE_RELOCATION_ADDENDS,
+
+ /* This section holds a symbol hash table. */
+
+ ELF_SECTION_TYPE_SYMBOL_HASH_TABLE,
+
+ /* This section holds information for dynamic linking. */
+
+ ELF_SECTION_TYPE_DYNAMIC,
+
+ /* This section holds information that marks the file in some
+ way. */
+
+ ELF_SECTION_TYPE_NOTE,
+
+ /* This section does not take up any space in the ELF file. Most
+ often used for BSS sections. */
+
+ ELF_SECTION_TYPE_NO_SPACE,
+
+ /* This section holds relocation entries without explicit
+ addends. */
+
+ ELF_SECTION_TYPE_RELOCATION,
+
+ /* This section type is reserved by has unspecified
+ semantics. Programs that contain a section of this type does not
+ conform to the ABI. */
+
+ ELF_SECTION_TYPE_SHARED_LIBRARY,
+};
+
+/* Section flags. */
+
+enum
+{
+ /* This section contains data that should be writable during process
+ execution. */
+
+ ELF_SECTION_FLAG_WRITE = SYSTEM_BIT_VALUE (0),
+
+ /* This section occupies memory during process execution. */
+
+ ELF_SECTION_FLAG_ALLOCATE = SYSTEM_BIT_VALUE (1),
+
+ /* This section contains code that should be executable. */
+
+ ELF_SECTION_FLAG_EXECUTE = SYSTEM_BIT_VALUE (2),
+};
+
+/* Type definitions. */
+
+/* An ELF (Executable and linkable format) header. */
+
+typedef struct
+{
+ /* Must be 0x7F, 'E, 'L', 'F' in this order. */
+
+ u8 identification[4];
+
+ /* The class of this executable. ELF_CLASS_WHATEVER. */
+
+ u8 class;
+
+ /* The endianess of the data in this file. ELF_ENDIAN_* */
+
+ u8 endian;
+
+ /* Current version is ELF_VERSION_CURRENT. */
+
+ u8 version;
+
+ /* Should be zero. FreeBSD uses those to put 'FreeBSD' in the ELF
+ header. We could do the same... */
+
+ u8 pad[9];
+
+ /* The type of ELF. ELF_TYPE_WHATEVER. */
+
+ u16 type;
+
+ /* The machine type this ELF is designed to run
+ on. ELF_MACHINE_WHATEVER. */
+
+ u16 machine;
+
+ /* Current version is still ELF_VERSION_CURRENT. (Don't ask me why
+ they put the version ID in two places...) */
+
+ u32 version2;
+
+ /* The location of the program entry point. */
+
+ u32 entry_point;
+
+ /* Offset of program header table. */
+
+ u32 program_header_offset;
+
+ /* Offset of section header table. */
+
+ u32 section_header_offset;
+ u32 flags;
+
+ /* The size of the ELF header. */
+
+ u16 elf_header_size;
+
+ /* The size of a program header table entry. */
+
+ u16 program_header_entry_size;
+
+ /* The number of program header entries. */
+
+ u16 program_header_entries;
+
+ /* The size of a section header table entry. */
+
+ u16 section_header_entry_size;
+
+ /* The number of section header entries. */
+
+ u16 section_header_entries;
+
+ /* The section header table index of the section name string
+ table. */
+
+ u16 section_string_index;
+} __attribute__ ((packed)) elf_header_type;
+
+/* A section header entry. */
+
+typedef struct
+{
+ /* The name of the section (index of the string table). */
+
+ u32 name;
+ u32 type;
+ u32 flags;
+
+ /* The start of the section in memory. */
+
+ u32 address;
+
+ /* The start of the section in the file. */
+
+ u32 offset;
+
+ /* The size of the section. */
+
+ u32 size;
+ u32 link;
+ u32 info;
+ u32 address_align;
+
+ /* The size of each section entry. */
+
+ u32 entry_size;
+} __attribute__ ((packed)) section_header_type;
+
+/* Function prototypes. */
+
+return_type execute_elf (elf_header_type *elf_header, char *parameter_string,
+ process_id_type *child_process_id);
+
+#endif /* !__LIBRARY_EXECUTE_ELF_EXECUTE_ELF_H__ */
diff --git a/libraries/execute_elf/makefile b/libraries/execute_elf/makefile
new file mode 100644
index 00000000..41f4119e
--- /dev/null
+++ b/libraries/execute_elf/makefile
@@ -0,0 +1,116 @@
+# This makefile was generated by autochaos 0.2.1. Please do not
+# tamper with it unless you are very certain about what you are doing.
+
+ALL_ARGUMENTS = --install-prefix /tftpboot/chaos
+
+PREFIX = /tftpboot/chaos
+PACKAGE = execute_elf
+
+# Compiler flags.
+
+CFLAGS = -Wall -W -Wshadow -Wpointer-arith -Waggregate-return \
+-Wstrict-prototypes -Wredundant-decls -Winline -Wmissing-prototypes \
+-Werror -Wcast-align -Wbad-function-cast -Wsign-compare \
+-Wmissing-declarations -Wmissing-noreturns -pipe \
+-Wnested-externs -O3 -fno-builtin -funsigned-char -g $(EXTRA_CFLAGS) $(DEFINES)
+
+INCLUDES = \
+-I.. \
+-I. -I$(PREFIX)/data/programming/c/headers
+
+ALL_OBJECTS = \
+./execute_elf.o
+
+STATIC_LIBRARY_PATH = $(PREFIX)/data/programming/libraries/static
+
+# Ideally, this would be -lwhatever, but we have not started patching
+# the GNU tools yet...
+
+LIBS =
+
+OBJECTS = \
+execute_elf.o
+
+
+HEADERS = \
+execute_elf.h \
+return_values.h
+
+
+SOURCES = \
+execute_elf.c
+
+HEADER_PATH = $(PREFIX)/data/programming/c/headers/$(PACKAGE)/.
+
+# TODO: Those should be overridable.
+
+CC = gcc-2.95
+NASM = nasm
+AR = ar
+RANLIB = ranlib
+GZIP = gzip -f
+
+%.o: %.c
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.S
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.asm
+ $(NASM) -o $(@) $< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+all: splash makefile library_execute_elf.a
+
+clean:
+ rm -f library_execute_elf.a
+ rm -f $(OBJECTS)
+ rm -f *.dep
+ -$(MAKE) clean-local
+makefile: configure
+ @./configure
+
+splash:
+ @echo -e "\n Compiling library: execute_elf...\n"
+
+configure: autochaos.rules
+ @autochaos
+
+
+LDFLAGS = $(PREFIX)/data/programming/c/startup/startup.o \
+-nostdlib -Wl,-T,$(PREFIX)/data/programming/linker/chaos.ld -lgcc $(EXTRA_LDFLAGS)
+
+library_execute_elf.a: $(OBJECTS)
+ @echo "Creating library..."
+ @$(AR) cru $(@) $(OBJECTS)
+ @$(RANLIB) $(@)
+
+install: all
+ @echo "Installing..."
+ @mkdir -p $(PREFIX)/data/programming/libraries/static
+ @cp library_execute_elf.a $(PREFIX)/data/programming/libraries/static
+ @mkdir -p $(PREFIX)/data/programming/c/headers/$(PACKAGE)
+ @for header in $(HEADERS) ; do cp $$header $(PREFIX)/data/programming/c/headers/$(PACKAGE) ; done
+
+package-source:
+ mkdir -p /home/per/Projects/Released/chaos-20001010/libraries/execute_elf/package-source/.
+ -cp -f autochaos.rules changelog configure COPYING README AUTHORS TODO INSTALL /home/per/Projects/Released/chaos-20001010/libraries/execute_elf/package-source/.
+ -cp -f makefile.template $(EXTRA_FILES) /home/per/Projects/Released/chaos-20001010/libraries/execute_elf/package-source/.
+ for header in $(HEADERS) ; do cp $$header /home/per/Projects/Released/chaos-20001010/libraries/execute_elf/package-source/. || exit ; done
+ for source in $(SOURCES) ; do cp $$source /home/per/Projects/Released/chaos-20001010/libraries/execute_elf/package-source/. || exit ; done
+package-check: package-source
+ cd package-source && ./configure $(ALL_ARGUMENTS) && $(MAKE) && $(MAKE) clean
+ find package-source -name makefile -exec rm {} ';'
+ rm package-source/config.h
+package: package-check
+ rm -rf execute_elf-0.0.1
+ mv package-source execute_elf-0.0.1
+ tar cvIf execute_elf-0.0.1.tar.bz2 execute_elf-0.0.1
+
+-include execute_elf.dep
+
diff --git a/libraries/execute_elf/return_values.h b/libraries/execute_elf/return_values.h
new file mode 100644
index 00000000..ef5b6529
--- /dev/null
+++ b/libraries/execute_elf/return_values.h
@@ -0,0 +1,41 @@
+/* $Id$ */
+/* Abstract: ELF execution library return values. */
+/* Authors: Henrik Hallin
+ Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_EXECUTE_ELF_RETURN_VALUES_H__
+#define __LIBRARY_EXECUTE_ELF_RETURN_VALUES_H__
+
+/* Return values. */
+
+enum
+{
+ /* The function completed successfully. */
+
+ EXECUTE_ELF_RETURN_SUCCESS,
+ EXECUTE_ELF_RETURN_ELF_UNSUPPORTED,
+ EXECUTE_ELF_RETURN_IMAGE_INVALID,
+
+ /* FIXME */
+
+ EXECUTE_ELF_RETURN_FAILED
+};
+
+#endif /* !__LIBRARY_EXECUTE_ELF_RETURN_VALUES_H__ */
diff --git a/libraries/file/autochaos.rules b/libraries/file/autochaos.rules
new file mode 100644
index 00000000..dff11d82
--- /dev/null
+++ b/libraries/file/autochaos.rules
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ makefile
+ ..
+
+
+
+
+ defines.h
+ file.h
+ functions.h
+ return_values.h
+ types.h
+
+
+
+
diff --git a/libraries/file/changelog b/libraries/file/changelog
new file mode 100644
index 00000000..ce9ca281
--- /dev/null
+++ b/libraries/file/changelog
@@ -0,0 +1,18 @@
+2000-09-30 Per Lundberg
+
+ * file.c (file_init): Changed the timeout of the
+ ipc_service_resolve call, since it is no longer needed with the
+ process parent unblocking.
+
+2000-07-26 Per Lundberg
+
+ * file.c: Fixed an american typo.
+
+2000-07-19 Per Lundberg
+
+ * file.c (file_open): Fixed some of the semantics; a program who
+ wants to open a file shouldn't have to build up a data
+ structure. Thus, everything needed is now passed as arguments
+ instead.
+ (file_read): Likewise.
+
diff --git a/libraries/file/config.h b/libraries/file/config.h
new file mode 100644
index 00000000..e80732d0
--- /dev/null
+++ b/libraries/file/config.h
@@ -0,0 +1,11 @@
+/* Automatically generated by autochaos 0.2.1. Not intended to be
+ hand edited. */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define PACKAGE_NAME "file"
+#define PACKAGE_VERSION "0.0.1"
+
+
+#endif /* !__CONFIG_H__ */
\ No newline at end of file
diff --git a/libraries/file/configure b/libraries/file/configure
new file mode 100755
index 00000000..c9c97c5d
--- /dev/null
+++ b/libraries/file/configure
@@ -0,0 +1,419 @@
+#! /usr/bin/perl -w
+
+# Abstract: Script for configuring this package.
+
+# Copyright 2000 chaos development. This script is in the public domain.
+
+# Please note that this script was automatically generated by
+# autochaos 0.2.1. It should not be modified. Do the changes you
+# want in autochaos instead.
+
+use strict;
+use POSIX;
+
+my $chaos_root = "/tftpboot/chaos";
+my @libraries = ();
+my @headers = ();
+my @sources = ();
+my @objects = ();
+my @deps = ();
+my $MAKEFILE;
+my $TEMPLATE;
+my $root_dir = getcwd ();
+my %options =
+(
+);
+
+my $install_prefix_flag = 0;
+
+foreach my $argument (@ARGV)
+{
+ if ($install_prefix_flag eq 1)
+ {
+ $chaos_root = $argument;
+ $install_prefix_flag = 0;
+ }
+ else
+ {
+ if ($argument eq '--install-prefix')
+ {
+ $install_prefix_flag = 1;
+ }
+ elsif ($argument =~ m/--enable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--enable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'TRUE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ elsif ($argument =~ m/--disable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--disable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'FALSE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+}
+
+if ($install_prefix_flag eq 1)
+{
+ print "Malformed --install-prefix command option. Value missing.\n";
+ exit 1;
+}
+
+print "\n Configuring library: file...\n\n";
+
+print ("Using chaos root... ($chaos_root)\n");
+
+
+my $all_arguments = "";
+foreach my $argument (@ARGV)
+{
+ $all_arguments .= $argument . " ";
+}
+
+print ("Checking for autochaos... ");
+my $autochaos = `autochaos --version 2> /dev/null`;
+
+my $has_autochaos;
+unless ($autochaos)
+{
+ print ("not found.\n");
+ $has_autochaos = undef;
+}
+else
+{
+ (my $version) = ($autochaos =~ m/ ([\d\.]+)$/);
+ print ("found (version $version).\n");
+ $has_autochaos = $version;
+}
+
+
+
+@headers = (
+'defines.h',
+'file.h',
+'functions.h',
+'return_values.h',
+'types.h',
+);
+
+@sources = (
+'file.c',
+);
+@objects = ('file.o',
+);
+@deps = ('file.dep',
+);
+ print "Writing ./makefile...
+";
+ open (MAKEFILE, '>' . "./makefile") or
+ die ("Could not write to ./makefile: $!\n");
+
+# Write the default rules we want.
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE "\n\nOBJECTS = ";
+ foreach my $object (@objects)
+ {
+ print MAKEFILE " \\\
+$object";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @headers > 0)
+ {
+ print MAKEFILE "\n\nHEADERS = ";
+ foreach my $header (@headers)
+ {
+ print MAKEFILE " \\\
+$header";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @sources > 0)
+ {
+ print MAKEFILE "\n\nSOURCES = ";
+ foreach my $source (@sources)
+ {
+ print MAKEFILE " \\\
+$source";
+ }
+ print MAKEFILE "\
+";
+
+ }
+
+ print (MAKEFILE < \$(*F).dep
+
+%.o: %.S
+ \@echo Compiling \$<...
+ \@\$(CC) -o \$(@) \$(CFLAGS) \$(INCLUDES) \$(DEFS) -c \$<
+ \@\$(CC) -M \$< \$(CFLAGS) \$(INCLUDES) \$(DEFS) > \$(*F).dep
+
+%.o: %.asm
+ \$(NASM) -o \$(@) \$< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+STOP
+
+ {
+ my $target = "library_file.a" if (scalar @objects);
+
+ unless ($target)
+ {
+ $target = "";
+ }
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE " rm -f \$(OBJECTS)
+";
+ }
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ foreach my $dep (@deps)
+ {
+ print (MAKEFILE "-include $dep\n");
+ }
+ }
+
+ print (MAKEFILE "\n");
+
+ if (open (TEMPLATE, "." . "/makefile.template"))
+ {
+ while ()
+ {
+ my $row = $_;
+
+ print (MAKEFILE $row);
+ }
+ }
+ close (MAKEFILE);
+
+
+ # Now, also write to the config.h
+
+ print "Writing config.h...\
+";
+ my $CONFIG;
+ open (CONFIG, '>config.h');
+ print (CONFIG <\n");
+ }
+
+ print (CONFIG "\n#endif /* !__CONFIG_H__ */");
+
+ close (CONFIG);
diff --git a/libraries/file/defines.h b/libraries/file/defines.h
new file mode 100644
index 00000000..77adf7b2
--- /dev/null
+++ b/libraries/file/defines.h
@@ -0,0 +1,56 @@
+/* $Id$ */
+/* Abstract: Defines used by the file library. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_FILE_DEFINES_H__
+#define __LIBRARY_FILE_DEFINES_H__
+
+enum
+{
+ /* Open the file for reading. */
+
+ FILE_MODE_READ,
+
+ /* Open the file for writing (overwriting any previous contents). */
+
+ FILE_MODE_WRITE,
+};
+
+/* Directory entry types. */
+
+enum
+{
+ FILE_ENTRY_TYPE_DIRECTORY,
+ FILE_ENTRY_TYPE_FILE,
+ FILE_ENTRY_TYPE_SOFT_LINK,
+ FILE_ENTRY_TYPE_HARD_LINK,
+};
+
+/* The maxium number of ACL:s for one entity. */
+
+#define MAX_ACL 16
+
+/* The maximum number of elements in a path. */
+
+#define MAX_PATH_ELEMENTS 16
+
+#define PATH_NAME_SEPARATOR '/'
+
+#endif /* !__LIBRARY_FILE_DEFINES_H__ */
diff --git a/libraries/file/file.c b/libraries/file/file.c
new file mode 100644
index 00000000..e33d66af
--- /dev/null
+++ b/libraries/file/file.c
@@ -0,0 +1,168 @@
+/* $Id$ */
+/* Abstract: File library. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#include
+#include
+
+#include "config.h"
+
+/* Initialise the file library. */
+
+return_type file_init (ipc_structure_type *vfs_structure, tag_type *tag)
+{
+ mailbox_id_type mailbox_id[10];
+ unsigned int services = 10;
+
+ if (ipc_service_resolve ("virtual_file_system", mailbox_id, &services,
+ 0, tag) != IPC_RETURN_SUCCESS)
+ {
+ return FILE_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ vfs_structure->output_mailbox_id = mailbox_id[0];
+ if (ipc_service_connection_request (vfs_structure) != IPC_RETURN_SUCCESS)
+ {
+ return FILE_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ return FILE_RETURN_SUCCESS;
+}
+
+/* Read one or more entries from a directory in the file system. */
+
+return_type file_directory_entry_read
+ (ipc_structure_type *vfs_structure,
+ file_directory_entry_read_type *directory_entry)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_FILE;
+ message_parameter.message_class = IPC_FILE_DIRECTORY_ENTRY_READ;
+ message_parameter.data = directory_entry;
+ message_parameter.block = TRUE;
+
+ message_parameter.length = sizeof (file_directory_entry_read_type);
+ if (system_call_mailbox_send (vfs_structure->output_mailbox_id,
+ &message_parameter) != STORM_RETURN_SUCCESS)
+ {
+ return FILE_RETURN_SERVICE_UNAVAILABLE;
+ }
+ message_parameter.length = (sizeof (file_directory_entry_read_type) +
+ sizeof (file_directory_entry_type) *
+ directory_entry->entries);
+ if (system_call_mailbox_receive (vfs_structure->input_mailbox_id,
+ &message_parameter) != STORM_RETURN_SUCCESS)
+ {
+ return FILE_RETURN_SERVICE_UNAVAILABLE;
+ }
+ return FILE_RETURN_SUCCESS;
+}
+
+/* Get information about the given entity. */
+
+return_type file_get_info
+ (ipc_structure_type *vfs_structure,
+ file_verbose_directory_entry_type *directory_entry)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_FILE;
+ message_parameter.message_class = IPC_FILE_GET_INFO;
+ message_parameter.data = directory_entry;
+ message_parameter.block = TRUE;
+ message_parameter.length = sizeof (file_verbose_directory_entry_type);
+
+ system_call_mailbox_send (vfs_structure->output_mailbox_id,
+ &message_parameter);
+ system_call_mailbox_receive (vfs_structure->input_mailbox_id,
+ &message_parameter);
+
+ if (directory_entry->success)
+ {
+ return FILE_RETURN_SUCCESS;
+ }
+ else
+ {
+ return FILE_RETURN_FILE_ABSENT;
+ }
+}
+
+/* Open a file. */
+
+return_type file_open (ipc_structure_type *vfs_structure,
+ char *file_name, file_mode_type mode,
+ file_handle_type *handle)
+{
+ message_parameter_type message_parameter;
+ file_open_type open;
+
+ string_copy_max (open.file_name, file_name, MAX_PATH_NAME_LENGTH);
+ open.mode = mode;
+
+ message_parameter.protocol = IPC_PROTOCOL_FILE;
+ message_parameter.message_class = IPC_FILE_OPEN,
+ message_parameter.data = &open;
+ message_parameter.block = TRUE;
+ message_parameter.length = sizeof (file_open_type);
+
+ system_call_mailbox_send (vfs_structure->output_mailbox_id,
+ &message_parameter);
+
+ message_parameter.data = handle;
+ message_parameter.length = sizeof (file_handle_type);
+
+ system_call_mailbox_receive (vfs_structure->input_mailbox_id,
+ &message_parameter);
+ return FILE_RETURN_SUCCESS;
+}
+
+/* Seek in the given file. */
+
+// file_seek ()
+
+/* Read from a file. */
+
+return_type file_read (ipc_structure_type *vfs_structure,
+ file_handle_type file_handle, unsigned int length,
+ void *buffer)
+{
+ message_parameter_type message_parameter;
+ file_read_type read;
+
+ read.file_handle = file_handle;
+ read.bytes = length;
+
+ message_parameter.protocol = IPC_PROTOCOL_FILE;
+ message_parameter.message_class = IPC_FILE_READ,
+ message_parameter.data = &read;
+ message_parameter.block = TRUE;
+ message_parameter.length = sizeof (file_read_type);
+
+ system_call_mailbox_send (vfs_structure->output_mailbox_id,
+ &message_parameter);
+
+ message_parameter.data = buffer;
+ message_parameter.length = read.bytes;
+
+ system_call_mailbox_receive (vfs_structure->input_mailbox_id,
+ &message_parameter);
+ return FILE_RETURN_SUCCESS;
+}
diff --git a/libraries/file/file.h b/libraries/file/file.h
new file mode 100644
index 00000000..6b831b73
--- /dev/null
+++ b/libraries/file/file.h
@@ -0,0 +1,30 @@
+/* $Id$ */
+/* Abstract: File library. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_FILE_FILE_H__
+#define __LIBRARY_FILE_FILE_H__
+
+#include
+#include
+#include
+#include
+
+#endif /* !__LIBRARY_FILE_FILE_H__ */
diff --git a/libraries/file/functions.h b/libraries/file/functions.h
new file mode 100644
index 00000000..2a61f80d
--- /dev/null
+++ b/libraries/file/functions.h
@@ -0,0 +1,47 @@
+/* $Id$ */
+/* Abstract: File library functions. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_FILE_FUNCTIONS_H__
+#define __LIBRARY_FILE_FUNCTIONS_H__
+
+#include
+#include
+
+extern return_type file_init
+ (ipc_structure_type *vfs_structure, tag_type *tag);
+
+extern return_type file_directory_entry_read
+ (ipc_structure_type *vfs_structure,
+ file_directory_entry_read_type *directory_entry);
+
+extern return_type file_get_info
+ (ipc_structure_type *vfs_structure,
+ file_verbose_directory_entry_type *directory_entry);
+
+extern return_type file_open
+ (ipc_structure_type *vfs_structure, char *file_name, file_mode_type mode,
+ file_handle_type *handle);
+
+extern return_type file_read
+ (ipc_structure_type *vfs_structure, file_handle_type file_handle,
+ unsigned int length, void *buffer);
+
+#endif /* !__LIBRARY_FILE_FUNCTIONS_H__ */
diff --git a/libraries/file/makefile b/libraries/file/makefile
new file mode 100644
index 00000000..959c684d
--- /dev/null
+++ b/libraries/file/makefile
@@ -0,0 +1,119 @@
+# This makefile was generated by autochaos 0.2.1. Please do not
+# tamper with it unless you are very certain about what you are doing.
+
+ALL_ARGUMENTS = --install-prefix /tftpboot/chaos
+
+PREFIX = /tftpboot/chaos
+PACKAGE = file
+
+# Compiler flags.
+
+CFLAGS = -Wall -W -Wshadow -Wpointer-arith -Waggregate-return \
+-Wstrict-prototypes -Wredundant-decls -Winline -Wmissing-prototypes \
+-Werror -Wcast-align -Wbad-function-cast -Wsign-compare \
+-Wmissing-declarations -Wmissing-noreturns -pipe \
+-Wnested-externs -O3 -fno-builtin -funsigned-char -g $(EXTRA_CFLAGS) $(DEFINES)
+
+INCLUDES = \
+-I.. \
+-I. -I$(PREFIX)/data/programming/c/headers
+
+ALL_OBJECTS = \
+./file.o
+
+STATIC_LIBRARY_PATH = $(PREFIX)/data/programming/libraries/static
+
+# Ideally, this would be -lwhatever, but we have not started patching
+# the GNU tools yet...
+
+LIBS =
+
+OBJECTS = \
+file.o
+
+
+HEADERS = \
+defines.h \
+file.h \
+functions.h \
+return_values.h \
+types.h
+
+
+SOURCES = \
+file.c
+
+HEADER_PATH = $(PREFIX)/data/programming/c/headers/$(PACKAGE)/.
+
+# TODO: Those should be overridable.
+
+CC = gcc-2.95
+NASM = nasm
+AR = ar
+RANLIB = ranlib
+GZIP = gzip -f
+
+%.o: %.c
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.S
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.asm
+ $(NASM) -o $(@) $< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+all: splash makefile library_file.a
+
+clean:
+ rm -f library_file.a
+ rm -f $(OBJECTS)
+ rm -f *.dep
+ -$(MAKE) clean-local
+makefile: configure
+ @./configure
+
+splash:
+ @echo -e "\n Compiling library: file...\n"
+
+configure: autochaos.rules
+ @autochaos
+
+
+LDFLAGS = $(PREFIX)/data/programming/c/startup/startup.o \
+-nostdlib -Wl,-T,$(PREFIX)/data/programming/linker/chaos.ld -lgcc $(EXTRA_LDFLAGS)
+
+library_file.a: $(OBJECTS)
+ @echo "Creating library..."
+ @$(AR) cru $(@) $(OBJECTS)
+ @$(RANLIB) $(@)
+
+install: all
+ @echo "Installing..."
+ @mkdir -p $(PREFIX)/data/programming/libraries/static
+ @cp library_file.a $(PREFIX)/data/programming/libraries/static
+ @mkdir -p $(PREFIX)/data/programming/c/headers/$(PACKAGE)
+ @for header in $(HEADERS) ; do cp $$header $(PREFIX)/data/programming/c/headers/$(PACKAGE) ; done
+
+package-source:
+ mkdir -p /home/per/Projects/Released/chaos-20001010/libraries/file/package-source/.
+ -cp -f autochaos.rules changelog configure COPYING README AUTHORS TODO INSTALL /home/per/Projects/Released/chaos-20001010/libraries/file/package-source/.
+ -cp -f makefile.template $(EXTRA_FILES) /home/per/Projects/Released/chaos-20001010/libraries/file/package-source/.
+ for header in $(HEADERS) ; do cp $$header /home/per/Projects/Released/chaos-20001010/libraries/file/package-source/. || exit ; done
+ for source in $(SOURCES) ; do cp $$source /home/per/Projects/Released/chaos-20001010/libraries/file/package-source/. || exit ; done
+package-check: package-source
+ cd package-source && ./configure $(ALL_ARGUMENTS) && $(MAKE) && $(MAKE) clean
+ find package-source -name makefile -exec rm {} ';'
+ rm package-source/config.h
+package: package-check
+ rm -rf file-0.0.1
+ mv package-source file-0.0.1
+ tar cvIf file-0.0.1.tar.bz2 file-0.0.1
+
+-include file.dep
+
diff --git a/libraries/file/return_values.h b/libraries/file/return_values.h
new file mode 100644
index 00000000..7f82cef6
--- /dev/null
+++ b/libraries/file/return_values.h
@@ -0,0 +1,40 @@
+/* $Id$ */
+/* Abstract: Return values for the file library. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_FILE_RETURN_VALUES_H__
+#define __LIBRARY_FILE_RETURN_VALUES_H__
+
+enum
+{
+ /* The call returned successfully. */
+
+ FILE_RETURN_SUCCESS,
+
+ /* The file/directory did not exist. */
+
+ FILE_RETURN_FILE_ABSENT,
+
+ /* The requested service was not available. */
+
+ FILE_RETURN_SERVICE_UNAVAILABLE,
+};
+
+#endif /* !__LIBRARY_FILE_RETURN_VALUES_H__ */
diff --git a/libraries/file/types.h b/libraries/file/types.h
new file mode 100644
index 00000000..00e61cc4
--- /dev/null
+++ b/libraries/file/types.h
@@ -0,0 +1,113 @@
+/* $Id$ */
+/* Abstract: File library types.*/
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_FILE_TYPES_H__
+#define __LIBRARY_FILE_TYPES_H__
+
+#include
+#include
+
+typedef unsigned int file_entry_type;
+typedef unsigned int file_mode_type;
+
+typedef struct
+{
+ /* The full path name of this file. */
+
+ char file_name[MAX_PATH_NAME_LENGTH];
+
+ /* In which mode do we want to open this file? */
+
+ file_mode_type mode;
+} file_open_type;
+
+typedef struct
+{
+ file_handle_type file_handle;
+
+ /* The amount of data we want. */
+
+ unsigned int bytes;
+} file_read_type;
+
+typedef struct
+{
+ file_entry_type type;
+ char name[MAX_FILE_NAME_LENGTH];
+} file_directory_entry_type;
+
+typedef struct
+{
+ /* The name of the directory to get information about. */
+
+ char path_name[MAX_PATH_NAME_LENGTH];
+
+ /* The directory entry to start at. */
+
+ unsigned int start_entry;
+
+ /* This boolean is set when we've reached the end of the given
+ directory. */
+
+ bool end_reached;
+
+ /* The maximum number of entries to write to the entry array on input, and
+ the actual number of written entries on output. */
+
+ unsigned int entries;
+
+ /* This magic lets us allocate this structure as sizeof
+ (file_system_directory_entry_read_type) + sizeof
+ (file_system_directory_entry_type) * entries. */
+
+ file_directory_entry_type entry[0];
+} file_directory_entry_read_type;
+
+/* A verbose directory entry. Returned by
+ IPC_FILE_SYSTEM_FILE_GET_INFO. */
+
+typedef struct
+{
+ /* Input parameters. */
+ /* The full path name of the entity to get information about. */
+
+ char path_name[MAX_PATH_NAME_LENGTH];
+
+ /* Output parameters. */
+ /* Did the command succed? */
+
+ bool success;
+
+ /* The type of entity. */
+
+ file_entry_type type;
+
+ /* Specified as chaos time. */
+
+ time_type time;
+
+ /* Entity size. If a file or link, in bytes. If a directory, the
+ number of files in the directory. */
+
+ u32 size;
+} file_verbose_directory_entry_type;
+
+#endif /* !__LIBRARY_FILE_TYPES_H__ */
diff --git a/libraries/ipc/autochaos.rules b/libraries/ipc/autochaos.rules
new file mode 100644
index 00000000..6796de0c
--- /dev/null
+++ b/libraries/ipc/autochaos.rules
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ makefile
+ ..
+
+
+
+
+ block.h
+ console.h
+ defines.h
+ ethernet.h
+ file.h
+ functions.h
+ general.h
+ ipc.h
+ ipv4.h
+ keyboard.h
+ log.h
+ mouse.h
+ pci.h
+ protocols.h
+ return_values.h
+ serial.h
+ sound.h
+ types.h
+ video.h
+
+
+
+
diff --git a/libraries/ipc/block.h b/libraries/ipc/block.h
new file mode 100644
index 00000000..9880b48b
--- /dev/null
+++ b/libraries/ipc/block.h
@@ -0,0 +1,53 @@
+/* $Id$ */
+/* Abstract: Protocol used for communicating with block devices. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_BLOCK_H__
+#define __LIBRARY_IPC_BLOCK_H__
+
+#include
+
+enum
+{
+ IPC_BLOCK_READ = (IPC_PROTOCOL_BLOCK << 16),
+ IPC_BLOCK_WRITE,
+ IPC_BLOCK_GET_INFO,
+};
+
+/* This structure is passed into IPC_BLOCK_READ. */
+
+typedef struct
+{
+ unsigned int start_block_number;
+ unsigned int number_of_blocks;
+} ipc_block_read_type;
+
+/* IPC_BLOCK_GET_INFO returns this structure. */
+
+typedef struct
+{
+ unsigned int block_size;
+ unsigned int number_of_blocks;
+ bool writable;
+ bool readable;
+ char label[64];
+} ipc_block_info_type;
+
+#endif /* !__LIBRARY_IPC_BLOCK_H__ */
diff --git a/libraries/ipc/changelog b/libraries/ipc/changelog
new file mode 100644
index 00000000..f76477c4
--- /dev/null
+++ b/libraries/ipc/changelog
@@ -0,0 +1,41 @@
+2000-09-12 Per Lundberg
+
+ * ipv4.h (ipv4_interface_type): New field: 'identification'.
+
+2000-08-29 Per Lundberg
+
+ * log.h (ipc_log_print_type): Changed the name of 'class' to
+ log_class.
+
+2000-08-14 Per Lundberg
+
+ * ipc.c (ipc_service_resolve ): Changed number_of_mailbox_ids to
+ be of a pointer type.
+
+2000-08-05 Per Lundberg
+
+ * video.h (VIDEO_FONT_SET): New define.
+
+2000-07-26 Per Lundberg
+
+ * ipc.c (ipc_connection_close): New function.
+
+2000-07-25 Per Lundberg
+
+ * ipc.c (ipc_receive): Added a parameter 'buffer_size', which is
+ updated when the buffer is reallocated.
+
+2000-07-24 Per Lundberg
+
+ * ipv4.h: Added some new preliminary message classes for reading
+ and writing to network sockets.
+
+ * return_values.h: Added some new return values. Changed
+ IPC_RETURN_PARAMETER_INVALID to IPC_RETURN_INVALID_ARGUMENT, to
+ encompass a well-standardised return value naming scheme.
+
+ * ipc.c (ipc_send): New function.
+ (ipc_receive): New function.
+
+ * Started writing this change log.
+
diff --git a/libraries/ipc/config.h b/libraries/ipc/config.h
new file mode 100644
index 00000000..2c8793be
--- /dev/null
+++ b/libraries/ipc/config.h
@@ -0,0 +1,11 @@
+/* Automatically generated by autochaos 0.2.1. Not intended to be
+ hand edited. */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define PACKAGE_NAME "ipc"
+#define PACKAGE_VERSION "0.0.1"
+
+
+#endif /* !__CONFIG_H__ */
\ No newline at end of file
diff --git a/libraries/ipc/configure b/libraries/ipc/configure
new file mode 100755
index 00000000..1c3f2d22
--- /dev/null
+++ b/libraries/ipc/configure
@@ -0,0 +1,433 @@
+#! /usr/bin/perl -w
+
+# Abstract: Script for configuring this package.
+
+# Copyright 2000 chaos development. This script is in the public domain.
+
+# Please note that this script was automatically generated by
+# autochaos 0.2.1. It should not be modified. Do the changes you
+# want in autochaos instead.
+
+use strict;
+use POSIX;
+
+my $chaos_root = "/tftpboot/chaos";
+my @libraries = ();
+my @headers = ();
+my @sources = ();
+my @objects = ();
+my @deps = ();
+my $MAKEFILE;
+my $TEMPLATE;
+my $root_dir = getcwd ();
+my %options =
+(
+);
+
+my $install_prefix_flag = 0;
+
+foreach my $argument (@ARGV)
+{
+ if ($install_prefix_flag eq 1)
+ {
+ $chaos_root = $argument;
+ $install_prefix_flag = 0;
+ }
+ else
+ {
+ if ($argument eq '--install-prefix')
+ {
+ $install_prefix_flag = 1;
+ }
+ elsif ($argument =~ m/--enable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--enable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'TRUE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ elsif ($argument =~ m/--disable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--disable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'FALSE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+}
+
+if ($install_prefix_flag eq 1)
+{
+ print "Malformed --install-prefix command option. Value missing.\n";
+ exit 1;
+}
+
+print "\n Configuring library: ipc...\n\n";
+
+print ("Using chaos root... ($chaos_root)\n");
+
+
+my $all_arguments = "";
+foreach my $argument (@ARGV)
+{
+ $all_arguments .= $argument . " ";
+}
+
+print ("Checking for autochaos... ");
+my $autochaos = `autochaos --version 2> /dev/null`;
+
+my $has_autochaos;
+unless ($autochaos)
+{
+ print ("not found.\n");
+ $has_autochaos = undef;
+}
+else
+{
+ (my $version) = ($autochaos =~ m/ ([\d\.]+)$/);
+ print ("found (version $version).\n");
+ $has_autochaos = $version;
+}
+
+
+
+@headers = (
+'block.h',
+'console.h',
+'defines.h',
+'ethernet.h',
+'file.h',
+'functions.h',
+'general.h',
+'ipc.h',
+'ipv4.h',
+'keyboard.h',
+'log.h',
+'mouse.h',
+'pci.h',
+'protocols.h',
+'return_values.h',
+'serial.h',
+'sound.h',
+'types.h',
+'video.h',
+);
+
+@sources = (
+'ipc.c',
+);
+@objects = ('ipc.o',
+);
+@deps = ('ipc.dep',
+);
+ print "Writing ./makefile...
+";
+ open (MAKEFILE, '>' . "./makefile") or
+ die ("Could not write to ./makefile: $!\n");
+
+# Write the default rules we want.
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE "\n\nOBJECTS = ";
+ foreach my $object (@objects)
+ {
+ print MAKEFILE " \\\
+$object";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @headers > 0)
+ {
+ print MAKEFILE "\n\nHEADERS = ";
+ foreach my $header (@headers)
+ {
+ print MAKEFILE " \\\
+$header";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @sources > 0)
+ {
+ print MAKEFILE "\n\nSOURCES = ";
+ foreach my $source (@sources)
+ {
+ print MAKEFILE " \\\
+$source";
+ }
+ print MAKEFILE "\
+";
+
+ }
+
+ print (MAKEFILE < \$(*F).dep
+
+%.o: %.S
+ \@echo Compiling \$<...
+ \@\$(CC) -o \$(@) \$(CFLAGS) \$(INCLUDES) \$(DEFS) -c \$<
+ \@\$(CC) -M \$< \$(CFLAGS) \$(INCLUDES) \$(DEFS) > \$(*F).dep
+
+%.o: %.asm
+ \$(NASM) -o \$(@) \$< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+STOP
+
+ {
+ my $target = "library_ipc.a" if (scalar @objects);
+
+ unless ($target)
+ {
+ $target = "";
+ }
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE " rm -f \$(OBJECTS)
+";
+ }
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ foreach my $dep (@deps)
+ {
+ print (MAKEFILE "-include $dep\n");
+ }
+ }
+
+ print (MAKEFILE "\n");
+
+ if (open (TEMPLATE, "." . "/makefile.template"))
+ {
+ while ()
+ {
+ my $row = $_;
+
+ print (MAKEFILE $row);
+ }
+ }
+ close (MAKEFILE);
+
+
+ # Now, also write to the config.h
+
+ print "Writing config.h...\
+";
+ my $CONFIG;
+ open (CONFIG, '>config.h');
+ print (CONFIG <\n");
+ }
+
+ print (CONFIG "\n#endif /* !__CONFIG_H__ */");
+
+ close (CONFIG);
diff --git a/libraries/ipc/console.h b/libraries/ipc/console.h
new file mode 100644
index 00000000..be8d1d05
--- /dev/null
+++ b/libraries/ipc/console.h
@@ -0,0 +1,82 @@
+/* $Id$ */
+/* Abstract: Console server IPC message types. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_CONSOLE_H__
+#define __LIBRARY_IPC_CONSOLE_H__
+
+/* Message types. */
+
+enum
+{
+ IPC_CONSOLE_CONNECTION_CLASS_SET = (IPC_PROTOCOL_CONSOLE << 16),
+ IPC_CONSOLE_CURSOR_MOVE,
+ IPC_CONSOLE_OPEN,
+ IPC_CONSOLE_MODE_SET,
+ IPC_CONSOLE_CLOSE,
+ IPC_CONSOLE_OUTPUT,
+ IPC_CONSOLE_RESIZE,
+ IPC_CONSOLE_ENABLE_KEYBOARD,
+ IPC_CONSOLE_DISABLE_KEYBOARD,
+ IPC_CONSOLE_KEYBOARD_EXTENDED,
+ IPC_CONSOLE_KEYBOARD_NORMAL,
+ IPC_CONSOLE_ENABLE_MOUSE,
+ IPC_CONSOLE_DISABLE_MOUSE,
+
+ /* An input event on the keyboard. */
+
+ IPC_CONSOLE_KEYBOARD_EVENT,
+
+ /* A mouse event. */
+
+ IPC_CONSOLE_MOUSE_EVENT
+};
+
+/* Connection classes. */
+
+enum
+{
+ IPC_CONSOLE_CONNECTION_CLASS_NONE,
+ IPC_CONSOLE_CONNECTION_CLASS_PROVIDER_KEYBOARD,
+ IPC_CONSOLE_CONNECTION_CLASS_PROVIDER_MOUSE,
+ IPC_CONSOLE_CONNECTION_CLASS_PROVIDER_JOYSTICK,
+ IPC_CONSOLE_CONNECTION_CLASS_PROVIDER_VIDEO,
+ IPC_CONSOLE_CONNECTION_CLASS_CLIENT,
+};
+
+/* Resize the current console. */
+
+typedef struct
+{
+ unsigned int width;
+ unsigned int height;
+} ipc_console_resize_type;
+
+/* Physical console attribute type. */
+
+typedef struct
+{
+ unsigned int width;
+ unsigned int height;
+ unsigned int depth;
+ unsigned int mode_type;
+} ipc_console_attribute_type;
+
+#endif /* !__LIBRARY_IPC_CONSOLE_H__ */
diff --git a/libraries/ipc/defines.h b/libraries/ipc/defines.h
new file mode 100644
index 00000000..be56f3aa
--- /dev/null
+++ b/libraries/ipc/defines.h
@@ -0,0 +1,30 @@
+/* $Id$ */
+/* Abstract: Defines. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_DEFINES_H__
+#define __LIBRARY_IPC_DEFINES_H__
+
+/* If you put this in message_parameter->class, you will accept
+ messages of all classes. */
+
+#define IPC_CLASS_NONE (MAX_U32)
+
+#endif /* !__LIBRARY_IPC_DEFINES_H__ */
diff --git a/libraries/ipc/ethernet.h b/libraries/ipc/ethernet.h
new file mode 100644
index 00000000..ba802d6d
--- /dev/null
+++ b/libraries/ipc/ethernet.h
@@ -0,0 +1,35 @@
+/* $Id$ */
+/* Abstract: Protocol used by Ethernet servers. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_ETHERNET_H__
+#define __LIBRARY_IPC_ETHERNET_H__
+
+#include
+
+enum
+{
+ IPC_ETHERNET_REGISTER_TARGET = (IPC_PROTOCOL_ETHERNET << 16),
+ IPC_ETHERNET_PACKET_SEND,
+ IPC_ETHERNET_PACKET_RECEIVED,
+ IPC_ETHERNET_ADDRESS_GET,
+};
+
+#endif /* !__IPC_LIBRARY_ETHERNET_H__ */
diff --git a/libraries/ipc/file.h b/libraries/ipc/file.h
new file mode 100644
index 00000000..c6a56aeb
--- /dev/null
+++ b/libraries/ipc/file.h
@@ -0,0 +1,142 @@
+/* $Id$ */
+/* Abstract: File protocol. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_FILE_H__
+#define __LIBRARY_IPC_FILE_H__
+
+/* Limits. */
+/* FIXME: Remove these. */
+
+#define MAX_PATH_NAME_LENGTH 1024
+#define MAX_FILE_NAME_LENGTH 256
+
+enum
+{
+ /* Return a status code. */
+
+ IPC_FILE_RETURN_VALUE = (IPC_PROTOCOL_FILE << 16),
+
+ /* Open a file and assign a file handle. */
+
+ IPC_FILE_OPEN,
+
+ /* Close the given file handle. */
+
+ IPC_FILE_CLOSE,
+
+ /* Get information about the given file. (somewhat like 'stat' in
+ UNIX) */
+
+ IPC_FILE_GET_INFO,
+
+ /* Seek to the given position in the given file handle. */
+
+ IPC_FILE_SEEK,
+
+ /* Read from the given file. */
+
+ IPC_FILE_READ,
+
+ /* Write to the given file. */
+
+ IPC_FILE_WRITE,
+
+ /* Read a number of directory entries. */
+
+ IPC_FILE_DIRECTORY_ENTRY_READ,
+
+ /* Read the ACL:s for the given file name. */
+
+ IPC_FILE_ACL_READ,
+
+ /* Write the ACL:s for the given file name. */
+
+ IPC_FILE_ACL_WRITE,
+
+ /* Mount this volume in the logical tree. Only non-removable devices
+ need to be mounted; removable devices are treated in some kind of
+ magic way. :-) */
+
+ IPC_FILE_MOUNT_VOLUME,
+
+ /* Unmount this volume from the logical tree. */
+
+ IPC_FILE_UNMOUNT_VOLUME,
+
+ /* Assign this volume in the logical tree. */
+
+ IPC_FILE_ASSIGN_VOLUME,
+
+ /* De-assign the volume from the given "assign" point. */
+
+ IPC_FILE_DEASSIGN_VOLUME,
+
+ /* Detect if the file system contained in the supplied mailbox ID
+ (to a block service) is supported by this service. */
+
+ IPC_FILE_DETECT_VOLUME,
+};
+
+enum
+{
+ /* The call returned successfully. */
+
+ IPC_RETURN_FILE_SUCCESS,
+
+ /* The requested function is not supported on this file system. */
+
+ IPC_RETURN_FILE_FUNCTION_UNSUPPORTED,
+};
+
+typedef unsigned int file_handle_type;
+
+typedef struct
+{
+ /* The full path name of this file. */
+
+ char file_name[MAX_PATH_NAME_LENGTH];
+
+ /* In which mode do we want to open this file? */
+
+ int mode;
+
+ /* The file handle for this file. File handles are common for all
+ processes. */
+
+ file_handle_type file_handle;
+} ipc_file_open_type;
+
+/* Type definitions. */
+
+typedef struct
+{
+ /* The location where we want this volume to be mounted. */
+
+ char location[MAX_PATH_NAME_LENGTH];
+} file_mount_type;
+
+typedef struct
+{
+ char meta_location[MAX_PATH_NAME_LENGTH];
+ char location[MAX_PATH_NAME_LENGTH];
+} file_assign_type;
+
+#endif /* !__LIBRARY_IPC_FILE_H__ */
diff --git a/libraries/ipc/file_system.h b/libraries/ipc/file_system.h
new file mode 100644
index 00000000..c2064f67
--- /dev/null
+++ b/libraries/ipc/file_system.h
@@ -0,0 +1,108 @@
+/* $Id$ */
+/* Abstract: File system protocol. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_FILE_SYSTEM_H__
+#define __LIBRARY_IPC_FILE_SYSTEM_H__
+
+enum
+{
+ /* Return a status code. */
+
+ IPC_FILE_SYSTEM_RETURN_VALUE = (IPC_PROTOCOL_FILE_SYSTEM << 16),
+
+ /* Open a file and assign a file handle. */
+
+ IPC_FILE_SYSTEM_FILE_OPEN,
+
+ /* Close the given file handle. */
+
+ IPC_FILE_SYSTEM_FILE_CLOSE,
+
+ /* Get information about the given file. (somewhat like 'stat' in
+ UNIX) */
+
+ IPC_FILE_SYSTEM_FILE_GET_INFO,
+
+ /* Seek to the given position in the given file handle. */
+
+ IPC_FILE_SYSTEM_FILE_SEEK,
+
+ /* Read from the given file. */
+
+ IPC_FILE_SYSTEM_FILE_READ,
+
+ /* Write to the given file. */
+
+ IPC_FILE_SYSTEM_FILE_WRITE,
+
+ /* Read a number of directory entries. */
+
+ IPC_FILE_SYSTEM_DIRECTORY_ENTRY_READ,
+
+ /* Read the ACL:s for the given file name. */
+
+ IPC_FILE_SYSTEM_ACL_READ,
+
+ /* Write the ACL:s for the given file name. */
+
+ IPC_FILE_SYSTEM_ACL_WRITE,
+
+ /* Mount this volume in the logical tree. Only non-removable devices
+ need to be mounted; removable devices are treated in some kind of
+ magic way. :-) */
+
+ IPC_FILE_SYSTEM_MOUNT,
+
+ /* Unmount this volume from the logical tree. */
+
+ IPC_FILE_SYSTEM_UNMOUNT,
+};
+
+enum
+{
+ /* The call returned successfully. */
+
+ IPC_RETURN_FILE_SYSTEM_SUCCESS,
+
+ /* The requested function is not supported on this file system. */
+
+ IPC_RETURN_FILE_SYSTEM_FUNCTION_UNSUPPORTED,
+};
+
+typedef unsigned int file_handle_type;
+
+typedef struct
+{
+ /* The full path name of this file. */
+
+ char file_name[MAX_PATH_NAME_LENGTH];
+
+ /* In which mode do we want to open this file? */
+
+ int mode;
+
+ /* The file handle for this file. File handles are common for all
+ processes. */
+
+ file_handle_type file_handle;
+} ipc_file_system_open_type;
+
+#endif /* !__LIBRARY_IPC_FILE_SYSTEM_H__ */
diff --git a/libraries/ipc/functions.h b/libraries/ipc/functions.h
new file mode 100644
index 00000000..1569f657
--- /dev/null
+++ b/libraries/ipc/functions.h
@@ -0,0 +1,57 @@
+/* $Id$ */
+/* Abstract: IPC library functions. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_FUNCTIONS_H__
+#define __LIBRARY_IPC_FUNCTIONS_H__
+
+#include
+
+extern return_type ipc_send
+ (mailbox_id_type mailbox_id,
+ message_parameter_type *message_parameter);
+
+extern return_type ipc_receive
+ (mailbox_id_type mailbox_id,
+ message_parameter_type *message_parameter,
+ unsigned int *buffer_size);
+
+extern return_type ipc_service_create
+ (const char *service_name,
+ ipc_structure_type *ipc_structure, tag_type *tag);
+
+extern return_type ipc_service_connection_wait
+ (ipc_structure_type *ipc_structure);
+
+extern return_type ipc_service_connection_request
+ (ipc_structure_type *ipc_structure);
+
+extern return_type ipc_service_resolve
+ (const char *service_name, mailbox_id_type *mailbox_id,
+ unsigned int *number_of_mailbox_ids, time_type timeout,
+ tag_type *tag);
+
+extern return_type ipc_connection_establish
+ (ipc_structure_type *ipc_structure);
+
+extern return_type ipc_connection_close
+ (ipc_structure_type *ipc_structure, bool notify);
+
+#endif /* !__LIBRARY_IPC_FUNCTIONS_H__ */
diff --git a/libraries/ipc/general.h b/libraries/ipc/general.h
new file mode 100644
index 00000000..c51cf0bf
--- /dev/null
+++ b/libraries/ipc/general.h
@@ -0,0 +1,37 @@
+/* $Id$ */
+/* Abstract: General IPC messages. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_GENERAL_H__
+#define __LIBRARY_IPC_GENERAL_H__
+
+enum
+{
+ IPC_GENERAL_ECHO_REQUEST,
+ IPC_GENERAL_ECHO_REPLY,
+ IPC_GENERAL_IDENTIFY_REQUEST,
+ IPC_GENERAL_IDENTIFY_REPLY,
+ IPC_GENERAL_CONNECTION_REQUEST,
+ IPC_GENERAL_CONNECTION_REPLY,
+ IPC_GENERAL_CONNECTION_REFUSED,
+ IPC_GENERAL_CONNECTION_CLOSE,
+};
+
+#endif /* !__LIBRARY_IPC_GENERAL_H__ */
diff --git a/libraries/ipc/ipc.c b/libraries/ipc/ipc.c
new file mode 100644
index 00000000..bf94c3dc
--- /dev/null
+++ b/libraries/ipc/ipc.c
@@ -0,0 +1,477 @@
+/* $Id$ */
+/* Abstract: IPC library. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#include
+#include
+#include
+#include
+#include
+
+#include "config.h"
+
+/* FIXME: Use more defines. */
+
+/* Create a service. */
+
+return_type ipc_service_create
+ (const char *service_name, ipc_structure_type *ipc_structure,
+ tag_type *tag)
+{
+ switch (system_call_service_create
+ (service_name, &ipc_structure->input_mailbox_id, tag))
+ {
+ case STORM_RETURN_OUT_OF_MEMORY:
+ {
+ return IPC_RETURN_OUT_OF_MEMORY;
+ }
+
+ case STORM_RETURN_SUCCESS:
+ {
+ return IPC_RETURN_SUCCESS;
+ }
+
+ default:
+ {
+ return IPC_RETURN_UNKNOWN_ERROR;
+ }
+ }
+}
+
+/* Resolve the given service and put a maximum of
+ 'number_of_mailbox_ids' mailbox ID:s into mailbox_id. */
+/* FIXME: number_of_mailbox_ids should be a pointer to an int, where
+ we store the number of available service handlers. */
+
+return_type ipc_service_resolve
+ (const char *service_name, mailbox_id_type *mailbox_id,
+ unsigned int *number_of_mailbox_ids, time_type timeout,
+ tag_type *tag)
+{
+ service_parameter_type service_parameter;
+ unsigned int time = 0;
+
+ service_parameter.max_services = *number_of_mailbox_ids;
+ service_parameter.mailbox_id = mailbox_id;
+
+ do
+ {
+ switch (system_call_service_get (service_name, &service_parameter, tag))
+ {
+ case STORM_RETURN_TOO_MANY_SERVICES:
+ {
+ *number_of_mailbox_ids = service_parameter.max_services;
+ return IPC_RETURN_TOO_MANY_SERVICES;
+ }
+
+ case STORM_RETURN_PROTOCOL_UNAVAILABLE:
+ {
+ break;
+ }
+
+ case STORM_RETURN_SUCCESS:
+ {
+ *number_of_mailbox_ids = service_parameter.max_services;
+ return IPC_RETURN_SUCCESS;
+ }
+ }
+
+ /* If timeout is 0 we never block. If it is MAX_TIME, we block as
+ long as we like. */
+
+ if (timeout != 0)
+ {
+ system_sleep (1000);
+ }
+ time++;
+ } while (time <= timeout || timeout == MAX_TIME);
+
+
+ return IPC_RETURN_SERVICE_UNAVAILABLE;
+}
+
+/* Wait for a connection request. */
+
+return_type ipc_service_connection_wait (ipc_structure_type *ipc_structure)
+{
+ message_parameter_type message_parameter;
+ u8 *buffer;
+ unsigned int buffer_size = 1024;
+
+ memory_allocate ((void **) &buffer, buffer_size);
+
+ /* Check the input parameter. */
+
+ if (ipc_structure == NULL)
+ {
+ return IPC_RETURN_INVALID_ARGUMENT;
+ }
+
+ message_parameter.data = buffer;
+ message_parameter.protocol = IPC_PROTOCOL_GENERAL;
+
+ while (TRUE)
+ {
+ message_parameter.message_class = IPC_CLASS_NONE;
+ message_parameter.length = buffer_size;
+ message_parameter.block = TRUE;
+
+ switch (ipc_receive (ipc_structure->input_mailbox_id,
+ &message_parameter, NULL))
+ {
+ case STORM_RETURN_MAILBOX_UNAVAILABLE:
+ case STORM_RETURN_ACCESS_DENIED:
+ {
+ memory_deallocate ((void **) &buffer);
+ return IPC_RETURN_INVALID_ARGUMENT;
+ }
+
+ /* The message didn't fit into this mailbox. General IPC
+ messages must fit into 1024 bytes, so it was probably some
+ bogus message. We ignore it. */
+
+ case STORM_RETURN_MAILBOX_MESSAGE_TOO_LARGE:
+ {
+ continue;
+ }
+
+ case STORM_RETURN_SUCCESS:
+ {
+ mailbox_id_type reply_mailbox_id =
+ *(mailbox_id_type *) message_parameter.data;
+
+ switch (message_parameter.message_class)
+ {
+ case IPC_GENERAL_ECHO_REQUEST:
+ {
+ message_parameter.message_class = IPC_GENERAL_ECHO_REPLY;
+ message_parameter.length = 0;
+ message_parameter.block = TRUE;
+
+ ipc_send (reply_mailbox_id, &message_parameter);
+ break;
+ }
+
+ case IPC_GENERAL_IDENTIFY_REQUEST:
+ {
+ message_parameter.message_class = IPC_GENERAL_IDENTIFY_REPLY;
+
+ /* FIXME: Fill in better stuff here! */
+
+ string_copy ((char *) message_parameter.data,
+ PACKAGE_NAME " " PACKAGE_VERSION);
+
+ message_parameter.length =
+ string_length ((char *) message_parameter.data);
+
+ system_call_mailbox_send (reply_mailbox_id, &message_parameter);
+ break;
+ }
+
+ case IPC_GENERAL_CONNECTION_REQUEST:
+ {
+ ipc_structure->output_mailbox_id =
+ *(mailbox_id_type *) message_parameter.data;
+ {
+ memory_deallocate ((void **) &buffer);
+ return IPC_RETURN_CONNECTION_REQUESTED;
+ }
+
+ break;
+ }
+
+ /* Unknown command. Just ignore it for now. */
+
+ default:
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+/* Request a connection to a service. */
+
+return_type ipc_service_connection_request (ipc_structure_type *ipc_structure)
+{
+ message_parameter_type message_parameter;
+ u8 data[100];
+
+ /* FIXME: Make it possible to specify the size of the mailbox. For
+ now, we just set it to one meg and hope it's enough. */
+
+ if (system_call_mailbox_create
+ (&ipc_structure->input_mailbox_id, 1 * MB, PROCESS_ID_NONE,
+ CLUSTER_ID_NONE, THREAD_ID_NONE) != STORM_RETURN_SUCCESS)
+ {
+ /* FIXME: Handle the possible causes of this. */
+
+ return IPC_RETURN_UNKNOWN_ERROR;
+ }
+
+ message_parameter.length = sizeof (mailbox_id_type);
+ message_parameter.protocol = IPC_PROTOCOL_GENERAL;
+ message_parameter.message_class = IPC_GENERAL_CONNECTION_REQUEST;
+ message_parameter.data = &data;
+ message_parameter.block = TRUE;
+ *(mailbox_id_type *) message_parameter.data =
+ ipc_structure->input_mailbox_id;
+
+ switch (system_call_mailbox_send (ipc_structure->output_mailbox_id,
+ &message_parameter))
+ {
+ case STORM_RETURN_MAILBOX_UNAVAILABLE:
+ case STORM_RETURN_ACCESS_DENIED:
+ {
+ return IPC_RETURN_INVALID_ARGUMENT;
+ }
+
+ case STORM_RETURN_SUCCESS:
+ {
+ break;
+ }
+ }
+
+ message_parameter.protocol = IPC_PROTOCOL_GENERAL;
+ message_parameter.message_class = IPC_CLASS_NONE;
+ message_parameter.length = 50;
+ message_parameter.block = TRUE;
+
+ switch (system_call_mailbox_receive (ipc_structure->input_mailbox_id,
+ &message_parameter))
+ {
+ case STORM_RETURN_MAILBOX_UNAVAILABLE:
+ case STORM_RETURN_ACCESS_DENIED:
+ {
+ return IPC_RETURN_INVALID_ARGUMENT;
+ }
+
+ case STORM_RETURN_SUCCESS:
+ {
+ if (message_parameter.message_class == IPC_GENERAL_CONNECTION_REPLY)
+ {
+ ipc_structure->output_mailbox_id =
+ *(mailbox_id_type *) message_parameter.data;
+ return IPC_RETURN_SUCCESS;
+ }
+ else
+ {
+ return IPC_RETURN_FAILED_MAILBOX_RECEIVE;
+ }
+ }
+
+ default:
+ {
+ return IPC_RETURN_UNKNOWN_ERROR;
+ }
+ }
+}
+
+/* Establish the connection. */
+
+return_type ipc_connection_establish (ipc_structure_type *ipc_structure)
+{
+ message_parameter_type message_parameter;
+
+ /* Create an input mailbox which we will use to get data from this
+ connection. */
+ /* FIXME: Make the size dynamic. */
+
+ if (system_call_mailbox_create
+ (&ipc_structure->input_mailbox_id, 1 * MB,
+ PROCESS_ID_NONE, CLUSTER_ID_NONE, THREAD_ID_NONE) !=
+ STORM_RETURN_SUCCESS)
+ {
+ message_parameter.message_class = IPC_GENERAL_CONNECTION_REFUSED;
+ message_parameter.length = 0;
+ system_call_mailbox_send (ipc_structure->output_mailbox_id,
+ &message_parameter);
+ return IPC_RETURN_FAILED_MAILBOX_CREATE;
+ }
+
+ message_parameter.protocol = IPC_PROTOCOL_GENERAL;
+ message_parameter.message_class = IPC_GENERAL_CONNECTION_REPLY;
+ message_parameter.data = &ipc_structure->input_mailbox_id;
+ message_parameter.length = sizeof (mailbox_id_type);
+ message_parameter.block = TRUE;
+
+ if (system_call_mailbox_send (ipc_structure->output_mailbox_id,
+ &message_parameter) != STORM_RETURN_SUCCESS)
+ {
+ return IPC_RETURN_FAILED_MAILBOX_SEND;
+ }
+
+ return IPC_RETURN_SUCCESS;
+}
+
+/* FIXME: Write an ipc_connection_deny which denies the connection. */
+
+/* Send an IPC message. The reason for having this wrapper is to make
+ the implementation of shared memory regions totally transparent to
+ the programs. */
+
+return_type ipc_send (mailbox_id_type mailbox_id,
+ message_parameter_type *message_parameter)
+{
+ return_type return_value = system_call_mailbox_send (mailbox_id,
+ message_parameter);
+ switch (return_value)
+ {
+ case STORM_RETURN_SUCCESS:
+ {
+ return IPC_RETURN_SUCCESS;
+ }
+
+ case STORM_RETURN_INVALID_ARGUMENT:
+ {
+ return IPC_RETURN_INVALID_ARGUMENT;
+ }
+
+ case STORM_RETURN_MAILBOX_UNAVAILABLE:
+ {
+ return IPC_RETURN_MAILBOX_UNAVAILABLE;
+ }
+
+ case STORM_RETURN_MAILBOX_MESSAGE_TOO_LARGE:
+ {
+ return IPC_RETURN_MESSAGE_TOO_LARGE;
+ }
+
+ case STORM_RETURN_MAILBOX_FULL:
+ {
+ return IPC_RETURN_MAILBOX_FULL;
+ }
+
+ /* This should normally not happen. If it does, it means someone
+ has added a return case in mailbox.c in the kernel, without
+ adding it here. Thus, if you get this, please fix this library
+ and send us a patch. */
+
+ default:
+ {
+ return IPC_RETURN_FAILED_MAILBOX_SEND;
+ }
+ }
+}
+
+/* Receive an IPC message. The reason for having this is the same as
+ for ipc_send. */
+
+return_type ipc_receive
+ (mailbox_id_type mailbox_id, message_parameter_type *message_parameter,
+ unsigned int *buffer_size)
+{
+ return_type return_value = system_call_mailbox_receive
+ (mailbox_id, message_parameter);
+
+ switch (return_value)
+ {
+ case STORM_RETURN_SUCCESS:
+ {
+ return IPC_RETURN_SUCCESS;
+ }
+
+ case STORM_RETURN_MAILBOX_UNAVAILABLE:
+ {
+ return IPC_RETURN_MAILBOX_UNAVAILABLE;
+ }
+
+ case STORM_RETURN_ACCESS_DENIED:
+ {
+ return IPC_RETURN_ACCESS_DENIED;
+ }
+
+ case STORM_RETURN_MAILBOX_EMPTY:
+ {
+ return IPC_RETURN_MAILBOX_EMPTY;
+ }
+
+ case STORM_RETURN_MAILBOX_MESSAGE_TOO_LARGE:
+ {
+ /* This interpretation of the 'block' flag might not be entirely
+ orthodox, but I choose to it like this anyway... */
+
+ if (!message_parameter->block || buffer_size == NULL)
+ {
+ return IPC_RETURN_MESSAGE_TOO_LARGE;
+ }
+
+ /* This might not be entirely beautiful, but I think it is a
+ pretty elegant solution. */
+
+ *buffer_size = message_parameter->length;
+ // memory_deallocate (&message_parameter->data);
+ memory_allocate (&message_parameter->data, *buffer_size);
+ system_call_mailbox_receive (mailbox_id, message_parameter);
+
+ return IPC_RETURN_SUCCESS;
+ }
+
+ /* This should normally not happen. If it does, it means someone
+ has added a return case in mailbox.c in the kernel, without
+ adding it here. Thus, if you get this, please fix this library
+ and send us a patch. */
+
+ default:
+ {
+ return IPC_RETURN_FAILED_MAILBOX_RECEIVE;
+ }
+ }
+}
+
+#if 0
+ipc_protocol_get (ipc_structure_type *ipc_structure)
+{
+}
+
+#endif
+
+/* Close a connection. */
+
+return_type ipc_connection_close (ipc_structure_type *ipc_structure,
+ bool notify)
+{
+ message_parameter_type message_parameter;
+
+ if (notify)
+ {
+ /* Tell the other side we are closing the connection. */
+
+ message_parameter.protocol = IPC_PROTOCOL_GENERAL;
+ message_parameter.message_class = IPC_GENERAL_CONNECTION_CLOSE;
+ message_parameter.length = 0;
+ message_parameter.data = NULL;
+
+ system_call_mailbox_send (ipc_structure->output_mailbox_id,
+ &message_parameter);
+ }
+
+ system_call_mailbox_destroy (ipc_structure->input_mailbox_id);
+
+ /* The other end must do this:
+
+ system_call_mailbox_destroy (ipc_structure->input_mailbox_id);
+
+ */
+
+ return IPC_RETURN_SUCCESS;
+}
diff --git a/libraries/ipc/ipc.h b/libraries/ipc/ipc.h
new file mode 100644
index 00000000..a1e6d48c
--- /dev/null
+++ b/libraries/ipc/ipc.h
@@ -0,0 +1,31 @@
+/* $Id$ */
+/* Abstract: IPC library interface. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_IPC_H__
+#define __LIBRARY_IPC_IPC_H__
+
+#include
+#include
+#include
+#include
+#include
+
+#endif /* !__LIBRARY_IPC_IPC_H__ */
diff --git a/libraries/ipc/ipv4.h b/libraries/ipc/ipv4.h
new file mode 100644
index 00000000..ee64c094
--- /dev/null
+++ b/libraries/ipc/ipv4.h
@@ -0,0 +1,60 @@
+/* $Id$ */
+/* Abstract: IPv4 protocol */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_IPV4_H__
+#define __LIBRARY_IPC_IPV4_H__
+
+enum
+{
+ IPC_IPV4_INTERFACE_CONFIGURE = (IPC_PROTOCOL_IPV4 << 16),
+ IPC_IPV4_INTERFACE_QUERY,
+
+ /* FIXME: Think about how this should really work. */
+
+ IPC_IPV4_CONNECT,
+ IPC_IPV4_RECONNECT,
+ IPC_IPV4_LISTEN,
+ IPC_IPV4_SEND,
+ IPC_IPV4_RECEIVE,
+ IPC_IPV4_SET_HOST_NAME,
+ IPC_IPV4_GET_HOST_NAME,
+ IPC_IPV4_INTERFACE_GET_AMOUNT,
+ IPC_IPV4_INTERFACE_GET_NUMBER,
+ IPC_IPV4_SET_FLAGS,
+ IPC_IPV4_GET_FLAGS,
+ IPC_IPV4_ARP_GET_AMOUNT,
+ IPC_IPV4_ARP_GET_NUMBER,
+};
+
+enum
+{
+ IPC_IPV4_PROTOCOL_UDP,
+ IPC_IPV4_PROTOCOL_TCP
+};
+
+/* Flags. */
+
+enum
+{
+ IPC_IPV4_FLAG_FORWARD = (1 << 0),
+};
+
+#endif /* !__LIBRARY_IPC_IPV4_H__ */
diff --git a/libraries/ipc/keyboard.h b/libraries/ipc/keyboard.h
new file mode 100644
index 00000000..0ba1ea27
--- /dev/null
+++ b/libraries/ipc/keyboard.h
@@ -0,0 +1,136 @@
+/* $Id$ */
+/* Abstract: Protocol used when communicating with keyboard
+ servers. */
+/* Authors: Per Lundberg
+ Henrik Hallin */
+
+/* Copyright chaos development 1999. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_KEYBOARD_H__
+#define __LIBRARY_IPC_KEYBOARD_H__
+
+#include
+
+/* Keyboard IPC messages. */
+
+enum
+{
+ IPC_KEYBOARD_REGISTER_TARGET = (IPC_PROTOCOL_KEYBOARD << 16),
+ IPC_KEYBOARD_UNREGISTER_TARGET,
+ IPC_KEYBOARD_EVENT,
+};
+
+/* "Special keys" are keys that don't generate printable UTF-8
+ sequences (like F1, Escape etc). Note that in chaos, some keys that
+ generate printable characters in other systems (for example Tab)
+ are treated differently. */
+
+enum
+{
+ IPC_KEYBOARD_SPECIAL_KEY_ESCAPE,
+ IPC_KEYBOARD_SPECIAL_KEY_BACK_SPACE,
+ IPC_KEYBOARD_SPECIAL_KEY_TAB,
+ IPC_KEYBOARD_SPECIAL_KEY_ENTER,
+ IPC_KEYBOARD_SPECIAL_KEY_CONTROL,
+ IPC_KEYBOARD_SPECIAL_KEY_LEFT_SHIFT,
+ IPC_KEYBOARD_SPECIAL_KEY_RIGHT_SHIFT,
+ IPC_KEYBOARD_SPECIAL_KEY_PRINT_SCREEN,
+ IPC_KEYBOARD_SPECIAL_KEY_ALT,
+ IPC_KEYBOARD_SPECIAL_KEY_SPACE_BAR,
+ IPC_KEYBOARD_SPECIAL_KEY_CAPS_LOCK,
+ IPC_KEYBOARD_SPECIAL_KEY_F1,
+ IPC_KEYBOARD_SPECIAL_KEY_F2,
+ IPC_KEYBOARD_SPECIAL_KEY_F3,
+ IPC_KEYBOARD_SPECIAL_KEY_F4,
+ IPC_KEYBOARD_SPECIAL_KEY_F5,
+ IPC_KEYBOARD_SPECIAL_KEY_F6,
+ IPC_KEYBOARD_SPECIAL_KEY_F7,
+ IPC_KEYBOARD_SPECIAL_KEY_F8,
+ IPC_KEYBOARD_SPECIAL_KEY_F9,
+ IPC_KEYBOARD_SPECIAL_KEY_F10,
+ IPC_KEYBOARD_SPECIAL_KEY_F11,
+ IPC_KEYBOARD_SPECIAL_KEY_F12,
+ IPC_KEYBOARD_SPECIAL_KEY_NUM_LOCK,
+ IPC_KEYBOARD_SPECIAL_KEY_SCROLL_LOCK,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_7,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_8,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_9,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_MINUS,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_4,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_5,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_6,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_PLUS,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_1,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_2,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_3,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_0,
+ IPC_KEYBOARD_SPECIAL_KEY_NUMERIC_DELETE,
+ IPC_KEYBOARD_SPECIAL_KEY_LEFT_WINDOWS,
+ IPC_KEYBOARD_SPECIAL_KEY_RIGHT_WINDOWS,
+ IPC_KEYBOARD_SPECIAL_KEY_MENU
+
+#if FALSE
+ IPC_KEYBOARD_SPECIAL_KEY_HOME,
+ IPC_KEYBOARD_SPECIAL_KEY_END,
+ IPC_KEYBOARD_SPECIAL_KEY_INSERT
+#endif
+};
+
+/* A keyboard packet is what gets sent whenever a key is pressed or
+ released. */
+
+typedef struct
+{
+ /* Does this packet contain a character code? If not, it is just one
+ of the shift states that has been modified, or perhaps a 'special
+ key'. */
+
+ bool has_character_code;
+
+ /* Is this a special key? */
+
+ bool has_special_key;
+
+ /* Was the key pressed or released? */
+
+ bool key_pressed;
+
+ /* The shift states. */
+
+ bool left_shift_down;
+ bool right_shift_down;
+ bool left_alt_down;
+ bool right_alt_down;
+ bool left_control_down;
+ bool right_control_down;
+ bool left_windows_down;
+ bool right_windows_down;
+ bool task_list_down;
+
+ /* If has_special_key is TRUE, this field contains the key code for
+ this key. */
+
+ u32 special_key;
+
+ /* Eight bytes for the character code, encoded with
+ UTF-8. */
+
+ u8 character_code[6];
+} keyboard_packet_type;
+
+#endif /* !__LIBRARY_IPC_KEYBOARD_H__ */
diff --git a/libraries/ipc/log.h b/libraries/ipc/log.h
new file mode 100644
index 00000000..23d23521
--- /dev/null
+++ b/libraries/ipc/log.h
@@ -0,0 +1,53 @@
+/* $Id$ */
+/* Abstract: Log protocol. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_LOG_H__
+#define __LIBRARY_IPC_LOG_H__
+
+#include
+
+/* Defines and enumerations. */
+
+#define IPC_LOG_MAX_MESSAGE_LENGTH 256
+#define IPC_LOG_MAX_CLASS_LENGTH 256
+
+enum
+{
+ /* Print a message to the log. The type of the message is specified in
+ ipc_log_print_type. */
+
+ IPC_LOG_PRINT = (IPC_PROTOCOL_LOG << 16),
+};
+
+/* Type definitions. */
+
+typedef struct
+{
+ char message[IPC_LOG_MAX_MESSAGE_LENGTH];
+ char log_class[IPC_LOG_MAX_CLASS_LENGTH];
+
+ /* How urgent is this log message? 0 is most urgent, and higher
+ numbers are of less importance. */
+
+ unsigned int urgency;
+} ipc_log_print_type;
+
+#endif /* !__LIBRARY_IPC_LOG_H__ */
diff --git a/libraries/ipc/makefile b/libraries/ipc/makefile
new file mode 100644
index 00000000..e6845b7a
--- /dev/null
+++ b/libraries/ipc/makefile
@@ -0,0 +1,133 @@
+# This makefile was generated by autochaos 0.2.1. Please do not
+# tamper with it unless you are very certain about what you are doing.
+
+ALL_ARGUMENTS = --install-prefix /tftpboot/chaos
+
+PREFIX = /tftpboot/chaos
+PACKAGE = ipc
+
+# Compiler flags.
+
+CFLAGS = -Wall -W -Wshadow -Wpointer-arith -Waggregate-return \
+-Wstrict-prototypes -Wredundant-decls -Winline -Wmissing-prototypes \
+-Werror -Wcast-align -Wbad-function-cast -Wsign-compare \
+-Wmissing-declarations -Wmissing-noreturns -pipe \
+-Wnested-externs -O3 -fno-builtin -funsigned-char -g $(EXTRA_CFLAGS) $(DEFINES)
+
+INCLUDES = \
+-I.. \
+-I. -I$(PREFIX)/data/programming/c/headers
+
+ALL_OBJECTS = \
+./ipc.o
+
+STATIC_LIBRARY_PATH = $(PREFIX)/data/programming/libraries/static
+
+# Ideally, this would be -lwhatever, but we have not started patching
+# the GNU tools yet...
+
+LIBS =
+
+OBJECTS = \
+ipc.o
+
+
+HEADERS = \
+block.h \
+console.h \
+defines.h \
+ethernet.h \
+file.h \
+functions.h \
+general.h \
+ipc.h \
+ipv4.h \
+keyboard.h \
+log.h \
+mouse.h \
+pci.h \
+protocols.h \
+return_values.h \
+serial.h \
+sound.h \
+types.h \
+video.h
+
+
+SOURCES = \
+ipc.c
+
+HEADER_PATH = $(PREFIX)/data/programming/c/headers/$(PACKAGE)/.
+
+# TODO: Those should be overridable.
+
+CC = gcc-2.95
+NASM = nasm
+AR = ar
+RANLIB = ranlib
+GZIP = gzip -f
+
+%.o: %.c
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.S
+ @echo Compiling $<...
+ @$(CC) -o $(@) $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
+ @$(CC) -M $< $(CFLAGS) $(INCLUDES) $(DEFS) > $(*F).dep
+
+%.o: %.asm
+ $(NASM) -o $(@) $< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+all: splash makefile library_ipc.a
+
+clean:
+ rm -f library_ipc.a
+ rm -f $(OBJECTS)
+ rm -f *.dep
+ -$(MAKE) clean-local
+makefile: configure
+ @./configure
+
+splash:
+ @echo -e "\n Compiling library: ipc...\n"
+
+configure: autochaos.rules
+ @autochaos
+
+
+LDFLAGS = $(PREFIX)/data/programming/c/startup/startup.o \
+-nostdlib -Wl,-T,$(PREFIX)/data/programming/linker/chaos.ld -lgcc $(EXTRA_LDFLAGS)
+
+library_ipc.a: $(OBJECTS)
+ @echo "Creating library..."
+ @$(AR) cru $(@) $(OBJECTS)
+ @$(RANLIB) $(@)
+
+install: all
+ @echo "Installing..."
+ @mkdir -p $(PREFIX)/data/programming/libraries/static
+ @cp library_ipc.a $(PREFIX)/data/programming/libraries/static
+ @mkdir -p $(PREFIX)/data/programming/c/headers/$(PACKAGE)
+ @for header in $(HEADERS) ; do cp $$header $(PREFIX)/data/programming/c/headers/$(PACKAGE) ; done
+
+package-source:
+ mkdir -p /home/per/Projects/Released/chaos-20001010/libraries/ipc/package-source/.
+ -cp -f autochaos.rules changelog configure COPYING README AUTHORS TODO INSTALL /home/per/Projects/Released/chaos-20001010/libraries/ipc/package-source/.
+ -cp -f makefile.template $(EXTRA_FILES) /home/per/Projects/Released/chaos-20001010/libraries/ipc/package-source/.
+ for header in $(HEADERS) ; do cp $$header /home/per/Projects/Released/chaos-20001010/libraries/ipc/package-source/. || exit ; done
+ for source in $(SOURCES) ; do cp $$source /home/per/Projects/Released/chaos-20001010/libraries/ipc/package-source/. || exit ; done
+package-check: package-source
+ cd package-source && ./configure $(ALL_ARGUMENTS) && $(MAKE) && $(MAKE) clean
+ find package-source -name makefile -exec rm {} ';'
+ rm package-source/config.h
+package: package-check
+ rm -rf ipc-0.0.1
+ mv package-source ipc-0.0.1
+ tar cvIf ipc-0.0.1.tar.bz2 ipc-0.0.1
+
+-include ipc.dep
+
diff --git a/libraries/ipc/mouse.h b/libraries/ipc/mouse.h
new file mode 100644
index 00000000..3d2172d0
--- /dev/null
+++ b/libraries/ipc/mouse.h
@@ -0,0 +1,48 @@
+/* $Id$ */
+/* Abstract: Protocol used for communicating with mouse hardware
+ servers. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_MOUSE_H__
+#define __LIBRARY_IPC_MOUSE_H__
+
+enum
+{
+ /* The mouse position or button state was changed. */
+
+ IPC_MOUSE_EVENT = (IPC_PROTOCOL_MOUSE << 16),
+
+ /* Register ourselves as receiver of mouse events. */
+
+ IPC_MOUSE_REGISTER_TARGET,
+
+ /* Unregister ourselves as receiver of mouse events. */
+
+ IPC_MOUSE_UNREGISTER_TARGET,
+};
+
+typedef struct
+{
+ unsigned int x;
+ unsigned int y;
+ unsigned int button;
+} ipc_mouse_event_type;
+
+#endif /* !__LIBRARY_IPC_MOUSE_H__ */
diff --git a/libraries/ipc/pci.h b/libraries/ipc/pci.h
new file mode 100644
index 00000000..cf35e4e4
--- /dev/null
+++ b/libraries/ipc/pci.h
@@ -0,0 +1,123 @@
+/* $Id$ */
+/* Abstract: Protocol for commuicating with the PCI server. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_PCI_H__
+#define __LIBRARY_IPC_PCI_H__
+
+#include
+
+enum
+{
+ /* Used for functions wishing to return a return value. */
+
+ IPC_PCI_RETURN_VALUE = (IPC_PROTOCOL_PCI << 16),
+
+ /* Check if a device with the given vendor and device ID exists. */
+
+ IPC_PCI_DEVICE_EXISTS,
+
+ /* Get the amount of PCI devices in this system. */
+
+ IPC_PCI_DEVICE_GET_AMOUNT,
+
+ /* Get brief information about all devices in the system. */
+
+ IPC_PCI_DEVICE_GET_INFO,
+
+ /* Get state for a given device. */
+
+ IPC_PCI_DEVICE_GET_STATE,
+
+ /* Set PCI configuration state. */
+
+ IPC_PCI_DEVICE_SET_STATE,
+};
+
+/* Return values. */
+
+enum
+{
+ /* One or more devices of the specified type exists in the
+ system. */
+
+ IPC_PCI_RETURN_DEVICE_EXISTS,
+
+ /* No device of the given type could be found. */
+
+ IPC_PCI_RETURN_DEVICE_ABSENT,
+};
+
+/* Miscellaneous defines. */
+
+#define PCI_NUMBER_OF_RESOURCES 12
+#define PCI_NUMBER_OF_REGULAR_RESOURCES 6
+
+/* IO resources have these defined flags. */
+/* Bus-specific bits. */
+
+#define PCI_RESOURCE_BITS 0x000000FF
+
+/* Resource type. */
+
+#define PCI_RESOURCE_IO 0x00000100
+#define PCI_RESOURCE_MEMORY 0x00000200
+#define PCI_RESOURCE_IRQ 0x00000400
+#define PCI_RESOURCE_DMA 0x00000800
+
+/* No side effects. */
+
+#define PCI_RESOURCE_PREFETCH 0x00001000
+#define PCI_RESOURCE_READONLY 0x00002000
+#define PCI_RESOURCE_CACHEABLE 0x00004000
+#define PCI_RESOURCE_RANGELENGTH 0x00008000
+#define PCI_RESOURCE_SHADOWABLE 0x00010000
+
+#define PCI_RESOURCE_UNSET 0x20000000
+#define PCI_RESOURCE_AUTO 0x40000000
+
+/* Driver has marked this resource busy. */
+
+#define PCI_RESOURCE_BUSY 0x80000000
+
+/* This structure is passed into IPC_PCI_DEVICE_EXISTS. */
+
+typedef struct
+{
+ u16 vendor_id;
+ u16 device_id;
+} pci_device_probe_type;
+
+/* Resources are tree-like, allowing nesting etc.. */
+
+typedef struct
+{
+ const char *name;
+ unsigned long start, end;
+ unsigned long flags;
+} pci_resource_type;
+
+typedef struct
+{
+ unsigned int irq;
+ pci_resource_type resource[PCI_NUMBER_OF_RESOURCES];
+} pci_device_info_type;
+
+#endif /* !__LIBRARY_IPC_PCI_H__ */
diff --git a/libraries/ipc/protocols.h b/libraries/ipc/protocols.h
new file mode 100644
index 00000000..98fcac9b
--- /dev/null
+++ b/libraries/ipc/protocols.h
@@ -0,0 +1,72 @@
+/* $Id$ */
+/* Abstract: Definition of the protocol types used in the chaos
+ system. Also define all the message types those protocols
+ support. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_PROTOCOLS_H__
+#define __LIBRARY_IPC_PROTOCOLS_H__
+
+/* Those are in chronologic order. When adding protocols, it must of
+ course be put at the end to avoid recompiling everything... */
+
+enum
+{
+ /* No protocol. */
+
+ IPC_PROTOCOL_NONE,
+
+ /* The general IPC protocol is used for communicating with the
+ service mailboxes. */
+
+ IPC_PROTOCOL_GENERAL,
+
+ IPC_PROTOCOL_MOUSE,
+ IPC_PROTOCOL_KEYBOARD,
+ IPC_PROTOCOL_CONSOLE,
+ IPC_PROTOCOL_VIDEO,
+ IPC_PROTOCOL_PCI,
+ IPC_PROTOCOL_ETHERNET,
+ IPC_PROTOCOL_IPV4,
+ IPC_PROTOCOL_BLOCK,
+ IPC_PROTOCOL_FILE,
+ IPC_PROTOCOL_LOG,
+ IPC_PROTOCOL_SERIAL,
+ IPC_PROTOCOL_SOUND
+};
+
+/* Ugly, but those rely on the previous defines... so we can't do in a
+ nicer way. */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#endif /* !__LIBRARY_IPC_PROTOCOLS_H__ */
diff --git a/libraries/ipc/return_values.h b/libraries/ipc/return_values.h
new file mode 100644
index 00000000..05578f39
--- /dev/null
+++ b/libraries/ipc/return_values.h
@@ -0,0 +1,99 @@
+/* $Id$ */
+/* Abstract: IPC library return values. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_RETURN_VALUES__
+#define __LIBRARY_IPC_RETURN_VALUES__
+
+enum
+{
+ /* The function call completed successfully. */
+
+ IPC_RETURN_SUCCESS,
+
+ /* The system call ran out of memory. */
+
+ IPC_RETURN_OUT_OF_MEMORY,
+
+ /* One or more of the input arguments was invalid. */
+
+ IPC_RETURN_INVALID_ARGUMENT,
+
+ /* A connection to this service was requested. */
+
+ IPC_RETURN_CONNECTION_REQUESTED,
+
+ /* The services didn't fit into the data
+ structure. (ipc_service_resolv) */
+
+ IPC_RETURN_TOO_MANY_SERVICES,
+
+ /* We failed on a
+ system_call_mailbox_create. (ipc_service_establish) */
+
+ IPC_RETURN_FAILED_MAILBOX_CREATE,
+
+ /* We failed on a system_call_mailbox_send. (ipc_service_establish) */
+
+ IPC_RETURN_FAILED_MAILBOX_SEND,
+
+ /* We failed on a
+ system_call_mailbox_receive. (ipc_service_connection_request) */
+
+ IPC_RETURN_FAILED_MAILBOX_RECEIVE,
+
+ /* No service of the given type was found. (ipc_service_resolve) */
+
+ IPC_RETURN_SERVICE_UNAVAILABLE,
+
+ /* The requested operation was not allowed. */
+
+ IPC_RETURN_ACCESS_DENIED,
+
+ /* The given mailbox was not available. */
+
+ IPC_RETURN_MAILBOX_UNAVAILABLE,
+
+ /* We did a non-blocking ipc_receive (), and the only data that was
+ available was too large. */
+
+ IPC_RETURN_MESSAGE_TOO_LARGE,
+
+ /* We did a non-blocking ipc_receive (), and there was no data in
+ the mailbox. */
+
+ IPC_RETURN_MAILBOX_EMPTY,
+
+ /* We did a non-blocking ipc_send (), and the mailbox we addressed
+ was full. */
+
+ IPC_RETURN_MAILBOX_FULL,
+
+ /* We got an unknown IPC command and could thus not proceed. */
+
+ IPC_RETURN_UNKNOWN_COMMAND,
+
+ /* Something went wrong, and we could not figure out what. (probably
+ because of an unimplemented kernel return value). */
+
+ IPC_RETURN_UNKNOWN_ERROR,
+};
+
+#endif /* !__LIBRARY_IPC_RETURN_VALUES__ */
diff --git a/libraries/ipc/serial.h b/libraries/ipc/serial.h
new file mode 100644
index 00000000..4c8f1ca9
--- /dev/null
+++ b/libraries/ipc/serial.h
@@ -0,0 +1,35 @@
+/* $Id$ */
+/* Abstract: Serial server IPC message types. */
+/* Author: Martin Alvarez */
+
+/* Copyright 2000 chaos development */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_SERIAL_H__
+#define __LIBRARY_IPC_SERIAL_H__
+
+/* Message types. */
+
+enum
+{
+ IPC_SERIAL_READ,
+ IPC_SERIAL_WRITE,
+ IPC_SERIAL_CONFIG_READ,
+ IPC_SERIAL_CONFIG_WRITE,
+};
+
+#endif /* !__LIBRARY_IPC_SERIAL_H__ */
diff --git a/libraries/ipc/sound.h b/libraries/ipc/sound.h
new file mode 100644
index 00000000..249cb175
--- /dev/null
+++ b/libraries/ipc/sound.h
@@ -0,0 +1,37 @@
+/* $Id$ */
+/* Abstract: sound server IPC message types. */
+/* Author: Erik Moren */
+
+/* Copyright 2000 chaos development */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_SOUND_H__
+#define __LIBRARY_IPC_SOUND_H__
+
+/* Message types. */
+
+enum
+{
+ IPC_SOUND_REGISTER,
+ IPC_SOUND_UNREGISTER,
+ IPC_SOUND_CONFIGURE_PLAYMODE,
+ IPC_SOUND_PLAY_SAMPLE,
+ IPC_SOUND_PLAY_STREAM,
+ IPC_SOUND_STOP
+};
+
+#endif /* !__LIBRARY_IPC_SOUND_H__ */
diff --git a/libraries/ipc/types.h b/libraries/ipc/types.h
new file mode 100644
index 00000000..076703aa
--- /dev/null
+++ b/libraries/ipc/types.h
@@ -0,0 +1,38 @@
+/* $Id$ */
+/* Abstract: IPC library types. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_TYPES_H__
+#define __LIBRARY_IPC_TYPES_H__
+
+#include
+
+/* Type definitions. */
+
+typedef struct
+{
+ mailbox_id_type input_mailbox_id;
+ mailbox_id_type output_mailbox_id;
+
+ /* FIXME: Fields for vendor stuff and service ID. */
+
+} ipc_structure_type;
+
+#endif /* !__LIBRARY_IPC_TYPES_H__ */
diff --git a/libraries/ipc/video.h b/libraries/ipc/video.h
new file mode 100644
index 00000000..48fb3997
--- /dev/null
+++ b/libraries/ipc/video.h
@@ -0,0 +1,82 @@
+/* $Id$ */
+/* Abstract: Video protocol. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_VIDEO_H__
+#define __LIBRARY_IPC_VIDEO_H__
+
+enum
+{
+ /* Set the specified video mode. */
+
+ IPC_VIDEO_MODE_SET = (IPC_PROTOCOL_VIDEO << 16),
+
+ /* Place the cursor on the given position. */
+
+ IPC_VIDEO_CURSOR_PLACE,
+
+ /* Set the full 256 color palette. */
+
+ IPC_VIDEO_PALETTE_SET,
+
+ /* Get the full 256 color palette. */
+
+ IPC_VIDEO_PALETTE_GET,
+
+ /* Set the font. */
+
+ IPC_VIDEO_FONT_SET,
+};
+
+/* IPC structures for video. */
+
+typedef struct
+{
+ unsigned int x;
+ unsigned int y;
+} video_cursor_type;
+
+typedef struct
+{
+ u8 red;
+ u8 green;
+ u8 blue;
+} video_palette_type;
+
+/* Videomode set flags. */
+
+enum
+{
+ VIDEO_MODE_TYPE_TEXT,
+ VIDEO_MODE_TYPE_GRAPHIC
+};
+
+enum
+{
+ /* The call completed successfully. */
+
+ IPC_VIDEO_RETURN_SUCCESS,
+
+ /* The requested mode could not be set. */
+
+ IPC_VIDEO_RETURN_MODE_UNAVAILABLE,
+};
+
+#endif /* !__LIBRARY_IPC_VIDEO_H__ */
diff --git a/libraries/ipc/virtual_file_system.h b/libraries/ipc/virtual_file_system.h
new file mode 100644
index 00000000..d80cecd6
--- /dev/null
+++ b/libraries/ipc/virtual_file_system.h
@@ -0,0 +1,114 @@
+/* $Id$ */
+/* Abstract: Virtual file system protocol. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPC_VIRTUAL_FILE_SYSTEM_H__
+#define __LIBRARY_IPC_VIRTUAL_FILE_SYSTEM_H__
+
+enum
+{
+ /* Open a file and assign a file handle. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_FILE_OPEN = (IPC_PROTOCOL_VIRTUAL_FILE_SYSTEM << 16),
+
+ /* Close the given file handle. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_FILE_CLOSE,
+
+ /* Get information about the given file. (somewhat like 'stat' in
+ UNIX) */
+
+ IPC_VIRTUAL_FILE_SYSTEM_FILE_GET_INFO,
+
+ /* Seek to the given position in the given file handle. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_FILE_SEEK,
+
+ /* Read from the given file. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_FILE_READ,
+
+ /* Write to the given file. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_FILE_WRITE,
+
+ /* Read a number of directory entries. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_DIRECTORY_ENTRY_READ,
+
+ /* Read the ACL:s for the given file name. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_ACL_READ,
+
+ /* Write the ACL:s for the given file name. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_ACL_WRITE,
+
+ /* Mount this volume in the logical tree. Only non-removable devices
+ need to be mounted; removable devices are treated in some kind of
+ magic way. :-) */
+
+ IPC_VIRTUAL_FILE_SYSTEM_MOUNT,
+
+ /* Unmount this volume from the logical tree. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_UNMOUNT,
+
+ /* Assign this volume in the logical tree. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_ASSIGN,
+
+ /* De-assign the volume from the given "assign" point. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_DEASSIGN,
+
+ /* Detect if the file system contained in the supplied mailbox ID
+ (to a block service) is supported by this service. */
+
+ IPC_VIRTUAL_FILE_SYSTEM_DETECT,
+};
+
+enum
+{
+ /* The call returned successfully. */
+
+ IPC_RETURN_VIRTUAL_FILE_SYSTEM_SUCCESS,
+
+ /* The requested function is not supported on this file system. */
+
+ IPC_RETURN_VIRTUAL_FILE_SYSTEM_FUNCTION_UNSUPPORTED,
+};
+
+/* Type definitions. */
+
+typedef struct
+{
+ /* The location where we want this volume to be mounted. */
+
+ char location[MAX_PATH_NAME_LENGTH];
+} virtual_file_system_mount_type;
+
+typedef struct
+{
+ char meta_location[MAX_PATH_NAME_LENGTH];
+ char location[MAX_PATH_NAME_LENGTH];
+} virtual_file_system_assign_type;
+
+#endif /* !__LIBRARY_IPC_VIRTUAL_FILE_SYSTEM_H__ */
diff --git a/libraries/ipv4/autochaos.rules b/libraries/ipv4/autochaos.rules
new file mode 100644
index 00000000..3e16925e
--- /dev/null
+++ b/libraries/ipv4/autochaos.rules
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ makefile
+ ..
+
+
+
+
+ defines.h
+ ethernet.h
+ functions.h
+ ipv4.h
+ return_values.h
+ types.h
+
+
+
+
\ No newline at end of file
diff --git a/libraries/ipv4/changelog b/libraries/ipv4/changelog
new file mode 100644
index 00000000..f96b369a
--- /dev/null
+++ b/libraries/ipv4/changelog
@@ -0,0 +1,33 @@
+2000-10-20 Per Lundberg
+
+ * ipv4.c (ipv4_address_to_string): New function.
+
+ * Renamed the library from network to ipv4.
+
+2000-09-30 Per Lundberg
+
+ * network.c (network_init): Changed the timeout of the
+ ipc_service_resolve call, since it is no longer needed with the
+ process parent unblocking.
+
+2000-09-17 Per Lundberg
+
+ * network.c (network_send): New function.
+ (network_connect): Likewise.
+
+2000-09-12 Per Lundberg
+
+ * network.c (network_string_to_binary_ip_address): New function.
+
+2000-08-24 Per Lundberg
+
+ * network.c: New file.
+ (network_get_host_name): New function.
+ (network_init): Likewise.
+
+2000-08-04 Per Lundberg
+
+ * ethernet.h: Renamed some things to comply with our nomenclature.
+
+ * Started writing this changelog.
+
diff --git a/libraries/ipv4/config.h b/libraries/ipv4/config.h
new file mode 100644
index 00000000..ced23109
--- /dev/null
+++ b/libraries/ipv4/config.h
@@ -0,0 +1,11 @@
+/* Automatically generated by autochaos 0.2.1. Not intended to be
+ hand edited. */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define PACKAGE_NAME "ipv4"
+#define PACKAGE_VERSION "0.0.1"
+
+
+#endif /* !__CONFIG_H__ */
\ No newline at end of file
diff --git a/libraries/ipv4/configure b/libraries/ipv4/configure
new file mode 100755
index 00000000..0a3b2755
--- /dev/null
+++ b/libraries/ipv4/configure
@@ -0,0 +1,420 @@
+#! /usr/bin/perl -w
+
+# Abstract: Script for configuring this package.
+
+# Copyright 2000 chaos development. This script is in the public domain.
+
+# Please note that this script was automatically generated by
+# autochaos 0.2.1. It should not be modified. Do the changes you
+# want in autochaos instead.
+
+use strict;
+use POSIX;
+
+my $chaos_root = "/tftpboot/chaos";
+my @libraries = ();
+my @headers = ();
+my @sources = ();
+my @objects = ();
+my @deps = ();
+my $MAKEFILE;
+my $TEMPLATE;
+my $root_dir = getcwd ();
+my %options =
+(
+);
+
+my $install_prefix_flag = 0;
+
+foreach my $argument (@ARGV)
+{
+ if ($install_prefix_flag eq 1)
+ {
+ $chaos_root = $argument;
+ $install_prefix_flag = 0;
+ }
+ else
+ {
+ if ($argument eq '--install-prefix')
+ {
+ $install_prefix_flag = 1;
+ }
+ elsif ($argument =~ m/--enable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--enable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'TRUE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ elsif ($argument =~ m/--disable-.*$/)
+ {
+ (my $option) = ($argument =~ m/--disable-(.*)$/);
+
+ if ($options{$option})
+ {
+ $options{$option} = 'FALSE';
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+ else
+ {
+ print "Unrecognised command line option.\n";
+ exit 1;
+ }
+ }
+}
+
+if ($install_prefix_flag eq 1)
+{
+ print "Malformed --install-prefix command option. Value missing.\n";
+ exit 1;
+}
+
+print "\n Configuring library: ipv4...\n\n";
+
+print ("Using chaos root... ($chaos_root)\n");
+
+
+my $all_arguments = "";
+foreach my $argument (@ARGV)
+{
+ $all_arguments .= $argument . " ";
+}
+
+print ("Checking for autochaos... ");
+my $autochaos = `autochaos --version 2> /dev/null`;
+
+my $has_autochaos;
+unless ($autochaos)
+{
+ print ("not found.\n");
+ $has_autochaos = undef;
+}
+else
+{
+ (my $version) = ($autochaos =~ m/ ([\d\.]+)$/);
+ print ("found (version $version).\n");
+ $has_autochaos = $version;
+}
+
+
+
+@headers = (
+'defines.h',
+'ethernet.h',
+'functions.h',
+'ipv4.h',
+'return_values.h',
+'types.h',
+);
+
+@sources = (
+'ipv4.c',
+);
+@objects = ('ipv4.o',
+);
+@deps = ('ipv4.dep',
+);
+ print "Writing ./makefile...
+";
+ open (MAKEFILE, '>' . "./makefile") or
+ die ("Could not write to ./makefile: $!\n");
+
+# Write the default rules we want.
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE "\n\nOBJECTS = ";
+ foreach my $object (@objects)
+ {
+ print MAKEFILE " \\\
+$object";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @headers > 0)
+ {
+ print MAKEFILE "\n\nHEADERS = ";
+ foreach my $header (@headers)
+ {
+ print MAKEFILE " \\\
+$header";
+ }
+ print MAKEFILE "\
+";
+ }
+
+ if (scalar @sources > 0)
+ {
+ print MAKEFILE "\n\nSOURCES = ";
+ foreach my $source (@sources)
+ {
+ print MAKEFILE " \\\
+$source";
+ }
+ print MAKEFILE "\
+";
+
+ }
+
+ print (MAKEFILE < \$(*F).dep
+
+%.o: %.S
+ \@echo Compiling \$<...
+ \@\$(CC) -o \$(@) \$(CFLAGS) \$(INCLUDES) \$(DEFS) -c \$<
+ \@\$(CC) -M \$< \$(CFLAGS) \$(INCLUDES) \$(DEFS) > \$(*F).dep
+
+%.o: %.asm
+ \$(NASM) -o \$(@) \$< -f elf
+
+.PHONY: splash all clean install package-source package-check package
+
+STOP
+
+ {
+ my $target = "library_ipv4.a" if (scalar @objects);
+
+ unless ($target)
+ {
+ $target = "";
+ }
+
+ print (MAKEFILE < 0)
+ {
+ print MAKEFILE " rm -f \$(OBJECTS)
+";
+ }
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ print (MAKEFILE < 0)
+ {
+ foreach my $dep (@deps)
+ {
+ print (MAKEFILE "-include $dep\n");
+ }
+ }
+
+ print (MAKEFILE "\n");
+
+ if (open (TEMPLATE, "." . "/makefile.template"))
+ {
+ while ()
+ {
+ my $row = $_;
+
+ print (MAKEFILE $row);
+ }
+ }
+ close (MAKEFILE);
+
+
+ # Now, also write to the config.h
+
+ print "Writing config.h...\
+";
+ my $CONFIG;
+ open (CONFIG, '>config.h');
+ print (CONFIG <\n");
+ }
+
+ print (CONFIG "\n#endif /* !__CONFIG_H__ */");
+
+ close (CONFIG);
diff --git a/libraries/ipv4/defines.h b/libraries/ipv4/defines.h
new file mode 100644
index 00000000..916fef29
--- /dev/null
+++ b/libraries/ipv4/defines.h
@@ -0,0 +1,31 @@
+/* $Id$ */
+/* Abstract: IPv4 defines. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPV4_DEFINES_H__
+#define __LIBRARY_IPV4_DEFINES_H__
+
+/* FIXME: Use a tag item for this one. */
+
+#define IPV4_HOST_NAME_LENGTH 32
+
+#define IPV4_INTERFACE_IDENTIFICATION_LENGTH 32
+
+#endif /* !__LIBRARY_IPV4_DEFINES_H__ */
diff --git a/libraries/ipv4/ethernet.h b/libraries/ipv4/ethernet.h
new file mode 100644
index 00000000..adf4c307
--- /dev/null
+++ b/libraries/ipv4/ethernet.h
@@ -0,0 +1,62 @@
+/* $Id$ */
+/* Abstract: Ethernet library type defintions and function
+ prototypes. */
+/* Author: Per Lundberg */
+
+/* Copyright 1999-2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPV4_ETHERNET_H__
+#define __LIBRARY_IPV4_ETHERNET_H__
+
+#include
+
+/* IEEE 802.3 ethernet magic constants. The frame sizes omit the
+ preamble and FCS/CRC (frame check sequence). */
+
+#define IPV4_ETHERNET_ADDRESS_LENGTH 6
+#define IPV4_ETHERNET_HEADER_LENGTH 14
+
+/* Min. octets in frame minus FCS. */
+
+#define IPV4_ETHERNET_MINIMUM_LENGTH 60
+
+/* Max. octets in payload. */
+
+#define IPV4_ETHERNET_DATA_LENGTH 1500
+
+/* Max. octets in frame minus FCS. */
+
+#define IPV4_ETHERNET_FRAME_LENGTH 1514
+
+/* These are the protocol ID's we support. */
+
+#define IPV4_ETHERNET_PROTOCOL_IPV4 0x0800
+#define IPV4_ETHERNET_PROTOCOL_ARP 0x0806
+#define IPV4_ETHERNET_PROTOCOL_IPV6 0x86DD
+
+/* This is an ethernet frame header. */
+
+typedef struct
+{
+ u8 destination_address[IPV4_ETHERNET_ADDRESS_LENGTH];
+ u8 source_address[IPV4_ETHERNET_ADDRESS_LENGTH];
+ u16 protocol_type;
+ u8 data[0];
+} __attribute__ ((packed)) ipv4_ethernet_header_type;
+
+#endif /* !__LIBRARY_IPV4_ETHERNET_H__ */
diff --git a/libraries/ipv4/functions.h b/libraries/ipv4/functions.h
new file mode 100644
index 00000000..e7c86468
--- /dev/null
+++ b/libraries/ipv4/functions.h
@@ -0,0 +1,60 @@
+/* $Id$ */
+/* Abstract: IPv4 library function prototypes. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPV4_FUNCTIONS_H__
+#define __LIBRARY_IPV4_FUNCTIONS_H__
+
+#include
+#include
+
+extern return_type ipv4_init
+ (ipc_structure_type *ipv4_structure, tag_type *tag);
+
+extern return_type ipv4_host_name_get
+ (ipc_structure_type *ipv4_structure, char *host_name);
+
+extern return_type ipv4_string_to_binary_ip_address
+ (u8 *string, u32 *ip_address);
+
+extern return_type ipv4_connect
+ (ipc_structure_type *ipv4_structure, ipv4_connect_type *ipv4_connect,
+ ipv4_socket_id_type *socket_id);
+
+return_type ipv4_reconnect
+ (ipc_structure_type *ipv4_structure, ipv4_reconnect_type *connect);
+
+extern return_type ipv4_send
+ (ipc_structure_type *ipv4_structure, ipv4_send_type *ipv4_send);
+
+extern return_type ipv4_receive
+ (ipc_structure_type *ipv4_structure, ipv4_receive_type *receive,
+ ipv4_socket_id_type socket_id, void **data, unsigned int *length);
+
+extern return_type ipv4_set_flags
+ (ipc_structure_type *ipv4_structure, unsigned int flags);
+
+extern return_type ipv4_get_flags
+ (ipc_structure_type *ipv4_structure, unsigned int *flags);
+
+extern return_type ipv4_address_to_string
+ (char *string, u32 ipv4_address);
+
+#endif /* !__LIBRARY_IPV4_FUNCTIONS_H__ */
diff --git a/libraries/ipv4/ipv4.c b/libraries/ipv4/ipv4.c
new file mode 100644
index 00000000..85879a9f
--- /dev/null
+++ b/libraries/ipv4/ipv4.c
@@ -0,0 +1,289 @@
+/* $Id$ */
+/* Abstract: IPv4 library. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#include
+#include
+#include
+
+/* Initialise the IPv4 support (by contacting the IPv4 server). */
+
+return_type ipv4_init (ipc_structure_type *ipv4_structure, tag_type *tag)
+{
+ mailbox_id_type mailbox_id[10];
+ unsigned int services = 10;
+
+ /* Try to resolve the IPv4 service. */
+
+ if (ipc_service_resolve ("ipv4", mailbox_id, &services, 0, tag) !=
+ IPC_RETURN_SUCCESS)
+ {
+ return IPV4_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ ipv4_structure->output_mailbox_id = mailbox_id[0];
+
+ /* Connect to this service. */
+
+ if (ipc_service_connection_request (ipv4_structure) != IPC_RETURN_SUCCESS)
+ {
+ return IPV4_RETURN_SERVICE_UNAVAILABLE;
+ }
+
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Get the host name of the system. */
+
+return_type ipv4_host_name_get
+ (ipc_structure_type *ipv4_structure, char *host_name)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_IPV4;
+ message_parameter.message_class = IPC_IPV4_GET_HOST_NAME;
+ message_parameter.data = host_name;
+ message_parameter.length = 0;
+ ipc_send (ipv4_structure->output_mailbox_id, &message_parameter);
+
+ message_parameter.length = IPV4_HOST_NAME_LENGTH;
+ ipc_receive (ipv4_structure->input_mailbox_id, &message_parameter,
+ NULL);
+
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Convert a string-based IP address to the binary notation. */
+
+return_type ipv4_string_to_binary_ip_address (u8 *string, u32 *ip_address)
+{
+ unsigned int characters;
+ unsigned int a, b, c, d;
+ unsigned int position = 0;
+ unsigned int length = string_length (string);
+
+ if (string_to_number (string + position, &a, &characters) !=
+ STRING_RETURN_SUCCESS)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ if (a > 255)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ position += characters + 1;
+
+ if (position > length)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ if (string_to_number (string + position, &b, &characters) !=
+ STRING_RETURN_SUCCESS)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ if (b > 255)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ position += characters + 1;
+
+ if (position > length)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ if (string_to_number (string + position, &c, &characters) !=
+ STRING_RETURN_SUCCESS)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ if (c > 255)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ position += characters + 1;
+
+ if (position > length)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ if (string_to_number (string + position, &d, &characters) !=
+ STRING_RETURN_SUCCESS)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ if (d > 255)
+ {
+ return IPV4_RETURN_INVALID_ARGUMENT;
+ }
+
+ *ip_address = a + (b << 8) + (c << 16) + (d << 24);
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Connect to a remote host (in the case of TCP), or just bind the
+ port (in the case of UDP). */
+
+return_type ipv4_connect
+ (ipc_structure_type *ipv4_structure, ipv4_connect_type *connect,
+ ipv4_socket_id_type *socket_id)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_IPV4;
+ message_parameter.message_class = IPC_IPV4_CONNECT;
+ message_parameter.data = connect;
+ message_parameter.length = sizeof (ipv4_connect_type);
+ message_parameter.block = TRUE;
+ ipc_send (ipv4_structure->output_mailbox_id, &message_parameter);
+
+ message_parameter.data = socket_id;
+ message_parameter.length = sizeof (ipv4_socket_id_type);
+ message_parameter.block = TRUE;
+ ipc_receive (ipv4_structure->input_mailbox_id, &message_parameter, NULL);
+
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Reconnect the given socket. Only works for UDP datagram streams. */
+
+return_type ipv4_reconnect
+ (ipc_structure_type *ipv4_structure, ipv4_reconnect_type *connect)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_IPV4;
+ message_parameter.message_class = IPC_IPV4_RECONNECT;
+ message_parameter.data = connect;
+ message_parameter.length = sizeof (ipv4_reconnect_type);
+ message_parameter.block = TRUE;
+ ipc_send (ipv4_structure->output_mailbox_id, &message_parameter);
+
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Send data on the given socket. */
+
+return_type ipv4_send
+ (ipc_structure_type *ipv4_structure, ipv4_send_type *send)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_IPV4;
+ message_parameter.message_class = IPC_IPV4_SEND;
+ message_parameter.data = send;
+ message_parameter.length = sizeof (ipv4_send_type) + send->length;
+ message_parameter.block = TRUE;
+ ipc_send (ipv4_structure->output_mailbox_id, &message_parameter);
+
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Receive data on the given socket. */
+
+return_type ipv4_receive
+ (ipc_structure_type *ipv4_structure, ipv4_receive_type *receive,
+ ipv4_socket_id_type socket_id, void **data, unsigned int *length)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_IPV4;
+ message_parameter.message_class = IPC_IPV4_RECEIVE;
+ message_parameter.data = &socket_id;
+ message_parameter.length = sizeof (ipv4_socket_id_type);
+ message_parameter.block = TRUE;
+ ipc_send (ipv4_structure->output_mailbox_id, &message_parameter);
+
+ message_parameter.length = *length;
+ message_parameter.data = *data;
+ ipc_receive (ipv4_structure->input_mailbox_id, &message_parameter,
+ length);
+ *data = message_parameter.data;
+ *length = message_parameter.length;
+
+ message_parameter.data = receive;
+ message_parameter.length = sizeof (ipv4_receive_type);
+ ipc_receive (ipv4_structure->input_mailbox_id, &message_parameter,
+ NULL);
+
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Set flags. */
+
+return_type ipv4_set_flags
+ (ipc_structure_type *ipv4_structure, unsigned int flags)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_IPV4;
+ message_parameter.message_class = IPC_IPV4_SET_FLAGS;
+ message_parameter.data = &flags;
+ message_parameter.length = sizeof (unsigned int);
+ message_parameter.block = TRUE;
+ ipc_send (ipv4_structure->output_mailbox_id, &message_parameter);
+
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Get flags. */
+
+return_type ipv4_get_flags
+ (ipc_structure_type *ipv4_structure, unsigned int *flags)
+{
+ message_parameter_type message_parameter;
+
+ message_parameter.protocol = IPC_PROTOCOL_IPV4;
+ message_parameter.message_class = IPC_IPV4_GET_FLAGS;
+ message_parameter.data = flags;
+ message_parameter.length = 0;
+ message_parameter.block = TRUE;
+ ipc_send (ipv4_structure->output_mailbox_id, &message_parameter);
+
+ message_parameter.length = sizeof (unsigned int);
+ ipc_receive (ipv4_structure->input_mailbox_id, &message_parameter,
+ NULL);
+
+ return IPV4_RETURN_SUCCESS;
+}
+
+/* Convert an IPv4 address to string form. */
+
+return_type ipv4_address_to_string (char *string, u32 ipv4_address)
+{
+ string_print (string, "%lu.%lu.%lu.%lu",
+ (ipv4_address >> 0) & 0xFF,
+ (ipv4_address >> 8) & 0xFF,
+ (ipv4_address >> 16) & 0xFF,
+ (ipv4_address >> 24) & 0xFF);
+
+ return IPV4_RETURN_SUCCESS;
+}
+
diff --git a/libraries/ipv4/ipv4.h b/libraries/ipv4/ipv4.h
new file mode 100644
index 00000000..9f35d981
--- /dev/null
+++ b/libraries/ipv4/ipv4.h
@@ -0,0 +1,31 @@
+/* $Id$ */
+/* Abstract: IPv4 library functions. */
+/* Author: Per Lundberg */
+
+/* Copyright 2000 chaos development. */
+
+/* This 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 of
+ the License, or (at your option) any later version.
+
+ This 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef __LIBRARY_IPV4_IPV4_H__
+#define __LIBRARY_IPV4_IPV4_H__
+
+#include
+#include
+#include
+#include