From 19fcd209c75df389602869520a67ee065fd5cfbf Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 21 Dec 2008 12:40:27 +0100 Subject: more docu cleanup --- docs/port/README | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ docs/port/README.SunPro | 5 +++++ 2 files changed, 63 insertions(+) create mode 100644 docs/port/README create mode 100644 docs/port/README.SunPro (limited to 'docs/port') diff --git a/docs/port/README b/docs/port/README new file mode 100644 index 0000000..9c13a99 --- /dev/null +++ b/docs/port/README @@ -0,0 +1,58 @@ +How to support a new operating system, platform or version thereof? +------------------------------------------------------------------- + +Make sure 'port/guess_env' reliably detects the version of your +new operating system. If you have a new operating system choose +a new label for the platform like 'SUNOS'. + +Never port for the future with 'OS_MINOR_VERSION >= 5', make sure +you check the new version first. + +We try to follow the X-Open group if possible (and POSIX). Try +to avoid BSD emulations of functions on SysV systems and vice +versa. + +Defines in 'port/sys.h' +----------------------- + +Don't port using '#ifdef LINUX'! Instead use the platform flags +only in 'port/sys.h' and define descriptive macros for features +of the system like 'HAVE_VSNPRINTF'. + +Currently there are the following definitions which must be set: +- HAVE_STDBOOL_H and HAVE_ENUM_BOOL: + HAVE_STDBOOL_H whether the platform has a C99 bool type in stdbool.h + HAVE_ENUM_BOOL for platforms which define an internal _Bool somewhere + but not the official bool data type +- HAVE_VSNPRINTF, HAVE_SNPRINTF: vsnprintf and snprintf, there + is a stub implementation if this function doesn't exist or + is buggy (see http://www.jhweiss.de/software/snprintf.html) +- HAVE_STRDUP: a string duplication function (there is a stub for + really old platforms) +- HAVE_STRERROR_R: whether we have a reentrant strerror function +- HAVE_LOCKF: whether we have a POSIX lockf interface. A stub implemented + with fcntl is available for platform which don't have a lockf function. + +Currently tested on: +-------------------- + +- x86 Linux 2.6.x +- x86 FreeBSD 6.2 +- x86 OpenBSD 4.2 +- x86 Solaris 10 +- SPARC Solaris 8 + +How to use the porting layer in your code +----------------------------------------- + +Don't include system header files if there is a similar file in the +'ports' subdir: + +#include "port/limits.h" +#include "port/stdbool.h" +#include "port/stdio.h" +#include "port/string.h" +#include "port/unistd.h" + +You also may to have new such stubs when porting to new platforms +or when you start to use new features. diff --git a/docs/port/README.SunPro b/docs/port/README.SunPro new file mode 100644 index 0000000..6808732 --- /dev/null +++ b/docs/port/README.SunPro @@ -0,0 +1,5 @@ +Sun C 5.9: +gmake \ + CC=/opt/SUNWspro/bin/c99 COMPILE_FLAGS="-I. -O2 -mt -v" \ + MAKEDEPEND="/opt/SUNWspro/bin/c99 -xM1" clean all + -- cgit v1.2.3-54-g00ecf