Porting JACK

The JACK Audio Connection Kit is designed to be portable to any system supporting the relevant POSIX and C language standards. It currently works with GNU/Linux and Mac OS X on several different processor architectures. This document describes the steps needed to port JACK to another platform, and the methods used to provide portability.



JACK relies on two types of platform-specific headers:

OS-specific headers take precedence over CPU-specific headers.

The JACK configure.host script and its system-dependent header directories were adapted from the libstdc++-v3 component of the GNU Compiler Collective, http://gcc.gnu.org.

C Language Dependencies

JACK is written to conform with C99, as defined in International Standard ISO/IEC 9899:1999. Because many existing compilers do not fully support this standard, some new features should be avoided for portablility reasons. For example, variables should not be declared in the middle of a compound statement, because many compilers still cannot handle that language extension.

Operating System Dependencies

JACK is written for a POSIX environment compliant with IEEE Std 1003.1-2001, ISO/IEC 9945:2003, including the POSIX Threads Extension (1003.1c-1995) and the Realtime and Realtime Threads feature groups. When some needed POSIX feature is missing on a platform, the preferred solution is to provide a substitute, as with the fakepoll.c implementation for Mac OS X.

Whenever possible, OS dependencies should be auto-detected by configure. Sometimes they can be isolated in OS-specific header files, found in subdirectories of config/os and referenced with a <sysdeps/xxx.h> name.

If conditional compilation must be used in mainline platform-independent code, avoid using the system name. Instead, #define a descriptive name in <config.h>, and test it like this:

allocate_mach_serverport(engine, client);
client->running = FALSE;

Be sure to place any generic implementation alternative in the #else or use an #ifndef, so no other code needs to know your conditional labels.

Issues Not Addressed