standards.info: System Portability

Go forward to CPU Portability
Go backward to Names
Go up to Writing C
Go to the top op standards

Portability between System Types

   In the Unix world, "portability" refers to porting to different Unix
versions.  For a GNU program, this kind of portability is desirable, but
not paramount.
   The primary purpose of GNU software is to run on top of the GNU
kernel, compiled with the GNU C compiler, on various types of CPU.  The
amount and kinds of variation among GNU systems on different CPUs will
be comparable to the variation among Linux-based GNU systems or among
BSD systems today.  So the kinds of portability that are absolutely
necessary are quite limited.
   But many users do run GNU software on non-GNU Unix or Unix-like
systems.  So supporting a variety of Unix-like systems is desirable,
although not paramount.
   The easiest way to achieve portability to most Unix-like systems is
to use Autoconf.  It's unlikely that your program needs to know more
information about the host platform than Autoconf can provide, simply
because most of the programs that need such knowledge have already been
written.
   Avoid using the format of semi-internal data bases (e.g.,
directories) when there is a higher-level alternative (`readdir').
   As for systems that are not like Unix, such as MSDOS, Windows, the
Macintosh, VMS, and MVS, supporting them is usually so much work that it
is better if you don't.
   The planned GNU kernel is not finished yet, but you can tell which
facilities it will provide by looking at the GNU C Library Manual.  The
GNU kernel is based on Mach, so the features of Mach will also be
available.  However, if you use Mach features, you'll probably have
trouble debugging your program today.