1
Notes on plib configuration
2
---------------------------
4
There are two configuration files:
6
config.h - #defines for source code in plib/*/*.[ch]
7
../../Make.cfg - Makefile definitions required to compile or load
8
(common to all packages)
10
Both of these can hopefully be computed by the config.sh script; if
11
not, you may be able to do the job by hand.
13
------------------------------------------------------------------------
14
_POSIX_SOURCE, _XOPEN_SOURCE_EXTENDED, _HPUX_SOURCE macros:
16
I want to try to use the POSIX standard whenever possible and
17
applicable. System header files known to be affected on some systems
19
<signal.h>, <dirent.h>, <sys/types.h>, <unistd.h>, <pwd.h>, <time.h>
21
The files files.c and ugetc.c need _POSIX_SOURCE before <stdio.h> in
22
order to get the fileno macro declared. The dir.c, pathnm.c,
23
usernm.c, and uinbg.c files use explicitly POSIX functions and also
26
A few plib features are implemented using non-POSIX functions. At
27
these places in the source code, I undef _POSIX_SOURCE. The timers
28
gettimeofday (timew.c) and getrusage (timeu.c) are the only examples
29
so far; HPUX additionally needs _HPUX_SOURCE in the former case.
31
The poll/select functions in uevent.c and upoll.c are the other
32
non-POSIX routines and have caused some problems. HPUX wants
33
_HPUX_SOURCE defined, and Digital UNIX wants _XOPEN_SOURCE_EXTENDED
34
defined in order to pick up the poll.h header correctly.
36
A yorick package using a specifically POSIX feature should declare
37
_POSIX_SOURCE before any other includes. If a specifically non-ANSI
38
feature is used, _POSIX_SOURCE should be undef'd after config.h but
39
before any system headers are included (note that pstdio.h and
40
pstdlib.h indirectly include system headers).
41
------------------------------------------------------------------------
49
------------------------------------------------------------------------
50
On systems which have the BSD getrusage function, it generally provides
51
the most accurate CPU timer (much better than the POSIX times often).
52
The POSIX times function is an alternative; if neither is defined, the
53
timeu.c source falls back to the ANSI clock function.
54
------------------------------------------------------------------------
56
/* plib/unix/timew.c- specify which wall timing function to use
57
* - gettimeofday needs <sys/time.h>
58
* - if undefined, will use ANSI C time and difftime functions */
59
#define USE_GETTIMEOFDAY
63
------------------------------------------------------------------------
64
The BSD gettimeofday routine is the preferred wall clock timer; it is
65
the one used universally by the X11 library, so you ought to get
66
agreement between X server times and p_wall_secs with it. The
67
fallback in timew.c if USE_GETTIMEOFDAY is not defined is the ANSI C
68
time and difftime functions.
69
------------------------------------------------------------------------
75
------------------------------------------------------------------------
76
The POSIX getlogin, getpwuid, and getuid functions permit expansion of
77
~user/... pathnames (pathnm.c). If these functions are not present,
78
define NO_PASSWD and that functionality will be disabled. This also
79
affects the p_getuser function (usernm.c), which falls back to the
80
deprecated cuserid function if NO_PASSWD is defined.
81
------------------------------------------------------------------------
85
#define USE_TIOCGPGRP_IOCTL <sys/termios.h>
87
#define USE_TIOCGPGRP_IOCTL <sgtty.h>
89
------------------------------------------------------------------------
90
If the POSIX tcgetpgrp function is missing (used to determine whether
91
the program is running as a background task in uinbg.c), define
92
USE_TIOCGPGRP_IOCTL as the name of the system header file which
93
defines the TIOCGPGRP ioctl.
94
------------------------------------------------------------------------
98
/* plib/unix/dir.c- use getwd instead of POSIX getcwd */
101
------------------------------------------------------------------------
102
If the POSIX getcwd function is missing (used to find current working
103
directory in dir.c), define USE_GETWD to use getwd instead.
104
------------------------------------------------------------------------
108
#define DIRENT_HEADER <sys/dir.h>
110
#define DIRENT_HEADER <sys/ndir.h>
112
#define DIRENT_HEADER <ndir.h>
114
------------------------------------------------------------------------
115
If the POSIX dirent.h header is missing or broken, define DIRENT_HEADER
116
as the name of the system header file containing the directory handling
117
functions. See dir.c more more.
118
------------------------------------------------------------------------
122
#define USE_SYS_POLL_H
130
#define HAVE_SYS_SELECT_H
131
-or none, one, or both of-
132
#define NO_SYS_TIME_H
133
#define NEED_SELECT_PROTO
135
------------------------------------------------------------------------
136
To handle multiple input sources, you need either the poll function or
137
the select function. I prefer the poll interface (and select was
138
apparently broken on at least one IRIX system). If <poll.h> exists,
139
you don't need any defines; if <sys/poll.h> exists, define
142
If poll is missing or you need to use select instead (upoll.c implements
143
a barebones poll in terms of select), define USE_SELECT. In that case,
144
define HAVE_SYS_SELECT_H if <sys/select.h> is present; otherwise you
145
may need to define NO_SYS_TIME_H (you will need either <sys/time.h> or
146
<time.h>). You may also need to define NEED_SELECT_PROTO.
148
See uevent.c and upoll.c for more.
149
------------------------------------------------------------------------
160
#define FPU_ALPHA_LINUX
162
#define FPU_GCC_POWERPC
163
#define FPU_GCC_SPARC
175
------------------------------------------------------------------------
176
UNIX systems usually do not deliver SIGFPE (floating point exception
177
signals) by default. The code to turn on SIGFPE delivery is highly
178
system dependent. You must define exactly one of the above symbols
179
in order to compile fpuset.c. The fputest.c program will tell you if
180
you have succeeded in turning on SIGFPE delivery (config.sh runs it).
182
FPU_HPUX, FPU_SUN4, and FPU_UNICOS require routines in libm (-lm).
184
FPU_SUN4 may require libsunmath (-lsunmath), and FPU_IRIX requires
185
libfpe (-lfpe). In these two cases, the config.mak file will set the
186
FPELIB flag to the required loader option. Otherwise, FPELIB will be
188
------------------------------------------------------------------------
194
XINC = -Ipath_to_X11/Xlib.h
200
XLIB = -Lpath_to_libX11
202
------------------------------------------------------------------------
203
The X11 headers and libraries may be hidden from the compiler without
204
appropriate -I and -L options, which are written into config.mak.
205
------------------------------------------------------------------------