standards: System Portability
1
1 5.5 Portability between System Types
1 ====================================
1
1 In the Unix world, "portability" refers to porting to different Unix
1 versions. For a GNU program, this kind of portability is desirable, but
1 not paramount.
1
1 The primary purpose of GNU software is to run on top of the GNU
1 kernel, compiled with the GNU C compiler, on various types of CPU. So
1 the kinds of portability that are absolutely necessary are quite
1 limited. But it is important to support Linux-based GNU systems, since
1 they are the form of GNU that is popular.
1
1 Beyond that, it is good to support the other free operating systems
1 (*BSD), and it is nice to support other Unix-like systems if you want
1 to. Supporting a variety of Unix-like systems is desirable, although
1 not paramount. It is usually not too hard, so you may as well do it.
1 But you don't have to consider it an obligation, if it does turn out to
1 be hard.
1
1 The easiest way to achieve portability to most Unix-like systems is
1 to use Autoconf. It's unlikely that your program needs to know more
1 information about the host platform than Autoconf can provide, simply
1 because most of the programs that need such knowledge have already been
1 written.
1
1 Avoid using the format of semi-internal data bases (e.g.,
1 directories) when there is a higher-level alternative ('readdir').
1
1 As for systems that are not like Unix, such as MSDOS, Windows, VMS,
1 MVS, and older Macintosh systems, supporting them is often a lot of
1 work. When that is the case, it is better to spend your time adding
1 features that will be useful on GNU and GNU/Linux, rather than on
1 supporting other incompatible systems.
1
1 If you do support Windows, please do not abbreviate it as "win". In
1 hacker terminology, calling something a "win" is a form of praise.
1 You're free to praise Microsoft Windows on your own if you want, but
1 please don't do this in GNU packages. Instead of abbreviating "Windows"
1 to "win", you can write it in full or abbreviate it to "woe" or "w". In
1 GNU Emacs, for instance, we use 'w32' in file names of Windows-specific
1 files, but the macro for Windows conditionals is called 'WINDOWSNT'.
1
1 It is a good idea to define the "feature test macro" '_GNU_SOURCE'
1 when compiling your C files. When you compile on GNU or GNU/Linux, this
1 will enable the declarations of GNU library extension functions, and
1 that will usually give you a compiler error message if you define the
1 same function names in some other way in your program. (You don't have
1 to actually _use_ these functions, if you prefer to make the program
1 more portable to other systems.)
1
1 But whether or not you use these GNU extensions, you should avoid
1 using their names for any other meanings. Doing so would make it hard
1 to move your code into other GNU programs.
1