Building New X Clients

# 9 Building New X Clients

Contents of this section

The easiest way to build a new client (X application) is to use `xmkmf` if an `Imakefile` is included in the sources. Type ```xmkmf -a`'' to create the Makefiles, check the configuration if necessary and type ```make`''. Whenever you install additional man pages you should update `whatis.db` by running ```makewhatis /usr/X11R6/man`''.

To avoid the ``Virtual memory exhausted'' message from cc while compiling, increase the data and stack size limits (in csh type ```limit datasize 32M`'' and ```limit stacksize 16M`'').

Note: Starting with XFree86 2.1 and NetBSD 0.9A, the symbol __386BSD__ no longer gets defined either by the compiler or via the X config files for *BSD systems. When porting clients to *BSD systems, make use of the symbol BSD for code which is truly BSD-specific. The value of the symbol can be used to distinguish different BSD releases. For example, code specific to the Net-2 and later releases can use:

> `#if (BSD >= 199103)`

To ensure that this symbol is correctly defined, include `<sys/param.h>` in the source that requires it. Note that the symbol CSRG_BASED is defined for *BSD systems in XFree86 3.1.1 and later. This should be used to protect the inclusion of `<sys/param.h>`.

For code that really is specific to a particular i386 BSD port, use __FreeBSD__ for FreeBSD, __NetBSD__ for NetBSD, __386BSD__ for 386BSD, and __bsdi__ for BSD/386.

Another note: If you get the message:

> `ld.so: undefined symbol _XtCvtStringToFont`

at run-time, you've stumbled on a semantic weakness of NetBSD 1.0 dynamic linker. Applications that use libXmu also need libXt. If the client uses a standard `Imakefile`, this dependency will probably by included in the Makefile automagically -- you'll not see the problem. Otherwise, just add ```-lXt`'' to your library list in the Imakefile or Makefile and relink.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter