Here are some of the cpp macros used, together with some short explanation
of their use.  Feel free to add more macros and more categories.
Most of these are from config.in, so it's probably better to put the
explanations in that file.  Ideally, everything would be defined and
documented in config.in, and this file would not be necessary.


** Distinguishing OSes **

AIX
_AIX
CYGWIN		Compiling the Cygwin port.
__CYGWIN__	Ditto
GNU_LINUX
HPUX
IRIX6_5
MSDOS		Compiling the MS-DOS port.
__MSDOS__	Ditto.
__DJGPP_MINOR__ Minor version number of the DJGPP library; used only in msdos.c and dosfns.c.
DOS_NT		Compiling for either the MS-DOS or native MS-Windows port.
WINDOWSNT	Compiling the native MS-Windows (W32) port.
__MINGW32__	Compiling the W32 port with the MinGW or MinGW-w64 ports of GCC.
_MSC_VER	Compiling the W32 port with the Microsoft C compiler.
MINGW_W64	Compiling the W32 port with the MinGW-w64 port of GCC.
DARWIN_OS	Compiling on Mac OS X or pure Darwin (and using s/darwin.h).
SOLARIS2
USG
USG5_4

** Distinguishing GUIs **

HAVE_NTGUI	Use the native W32 GUI for windows, frames, menus&scrollbars.
HAVE_NS		Use the NeXT/OpenStep/Cocoa UI under Mac OS X or GNUstep.
NS_IMPL_GNUSTEP	Compile support for GNUstep implementation of NS GUI API.
NS_IMPL_COCOA	Compile support for Cocoa (Apple) implementation of NS GUI API.
HAVE_X11	Compile support for the X11 GUI.
HAVE_X_WINDOWS	Compile support for X Window system
  (It looks like, nowadays, if HAVE_X11 is set, HAVE_X_WINDOWS must
   be, and vice versa.  At least, this is true for configure, and
   msdos; not sure about nt.)
HAVE_X11R6
HAVE_X11R6_XIM
HAVE_X11XTR6
USE_LUCID	Use the Lucid toolkit for menus&scrollbars.  Requires HAVE_X11.
USE_MOTIF	Use the Motif toolkit for menus&scrollbars.  Requires HAVE_X11.
USE_GTK		Use the Gtk   toolkit for menus&scrollbars.  Requires HAVE_X11.

** Frame types **

FRAME_TERMCAP_P	A tty (character terminal) frame.
FRAME_X_P	A frame on X Window system.
FRAME_MSDOS_P	An MS-DOS frame (used only by the DOS port).
FRAME_W32_P	A frame using native MS-Windows GUI.
FRAME_WINDOW_P	A GUI frame (like X, w32, etc.)

** Support for accessing other processes on the system **

HAVE_PROCFS     The /proc filesystem is supported.

** Compile-time options **

REL_ALLOC	Compile in the relocatable memory allocator ralloc.c.
SYSTEM_MALLOC	Use the system library's malloc.
subprocesses    System can use subprocesses (for M-x shell for example).
                Defined by default, only MSDOS undefines it.
DEBUG_LISP_OBJECT_TYPE Define it in lisp.h enable compile time checks
                       on Lisp_Object use.

** System specific macros
FIRST_PTY_LETTER
HAVE_PTYS
INTERRUPT_INPUT
NARROWPROTO
SEPCHAR
SYSTEM_TYPE

** Misc macros
USER_FULL_NAME   If defined, overrides the default pw->pw_gecos for
getting at the full user name.  Only MSDOS overrides the default.

** Miscellaneous defines.  Some of these might not be used in the code
anymore, so they can be removed.

AMPERSAND_FULL_NAME
BROKEN_DATAGRAM_SOCKETS
BROKEN_FIONREAD
BROKEN_GET_CURRENT_DIR_NAME
BROKEN_PTY_READ_AFTER_EAGAIN
DEFAULT_SOUND_DEVICE
DEVICE_SEP
DIRECTORY_SEP
DONT_REOPEN_PTY
DOUG_LEA_MALLOC
EMACS_CONFIGURATION
EMACS_CONFIG_OPTIONS
EMACS_INT
EMACS_UINT
GC_MARK_SECONDARY_STACK
GC_MARK_STACK
GC_SETJMP_WORKS
GNU_MALLOC
HAVE_AIX_SMT_EXP
HAVE_ALARM
HAVE_ALLOCA
HAVE_ALLOCA_H
HAVE_ALSA
HAVE_ATTRIBUTE_ALIGNED
HAVE_BDFFONT
HAVE_BOXES
HAVE_C99_STRTOLD
HAVE_CFMAKERAW
HAVE_CFSETSPEED
HAVE_CLOCK_GETTIME
HAVE_CLOCK_SETTIME
HAVE_COFF_H
HAVE_COM_ERR_H
HAVE_COPYSIGN
HAVE_DBUS
HAVE_DBUS_TYPE_IS_VALID
HAVE_DBUS_VALIDATE_BUS_NAME
HAVE_DBUS_VALIDATE_INTERFACE
HAVE_DBUS_VALIDATE_MEMBER
HAVE_DBUS_VALIDATE_PATH
HAVE_DBUS_WATCH_GET_UNIX_FD
HAVE_DECL_GETENV
HAVE_DECL_LOCALTIME_R
HAVE_DECL_STRMODE
HAVE_DECL_STRTOIMAX
HAVE_DECL_STRTOLL
HAVE_DECL_STRTOULL
HAVE_DECL_STRTOUMAX
HAVE_DECL_SYS_SIGLIST
HAVE_DECL_TZNAME
HAVE_DECL___SYS_SIGLIST
HAVE_DIALOGS
HAVE_DIFFTIME
HAVE_DUP2
HAVE_ENDGRENT
HAVE_ENDPWENT
HAVE_ENVIRON_DECL
HAVE_EUIDACCESS
HAVE_FORK
HAVE_FREEIFADDRS
HAVE_FREETYPE
HAVE_FSEEKO
HAVE_FUTIMENS
HAVE_FUTIMES
HAVE_FUTIMESAT
HAVE_GAI_STRERROR
HAVE_GCONF
HAVE_GETADDRINFO
HAVE_GETDELIM
HAVE_GETGRENT
HAVE_GETHOSTNAME
HAVE_GETIFADDRS
HAVE_GETLINE
HAVE_GETLOADAVG
HAVE_GETOPT_H
HAVE_GETOPT_LONG_ONLY
HAVE_GETPAGESIZE
HAVE_GETPEERNAME
HAVE_GETPT
HAVE_GETPWENT
HAVE_GETRLIMIT
HAVE_GETRUSAGE
HAVE_GETSOCKNAME
HAVE_GETTIMEOFDAY
HAVE_GET_CURRENT_DIR_NAME
HAVE_GHOSTSCRIPT
HAVE_GIF
HAVE_GNUTLS
HAVE_GPM
HAVE_GRANTPT
HAVE_GSETTINGS
HAVE_GTK3
HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
HAVE_GTK_DIALOG_GET_ACTION_AREA
HAVE_GTK_FILE_SELECTION_NEW
HAVE_GTK_MAIN
HAVE_GTK_MULTIDISPLAY
HAVE_GTK_ORIENTABLE_SET_ORIENTATION
HAVE_GTK_WIDGET_GET_MAPPED
HAVE_GTK_WIDGET_GET_SENSITIVE
HAVE_GTK_WIDGET_GET_WINDOW
HAVE_GTK_WIDGET_SET_HAS_WINDOW
HAVE_GTK_WINDOW_SET_HAS_RESIZE_G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E_SYS_LOADAVG_H
HAVE_SYS_PARAM_H
HAVE_SYS_RESOURCE_H
HAVE_SYS_SELECT_H
HAVE_SYS_SOCKET_H
HAVE_SYS_SOUNDCARD_H
HAVE_SYS_STAT_H
HAVE_SYS_SYSTEMINFO_H
HAVE_SYS_TIMEB_H
HAVE_SYS_TIME_H
HAVE_SYS_TYPES_H
HAVE_SYS_UN_H
HAVE_SYS_UTSNAME_H
HAVE_SYS_VLIMIT_H
HAVE_SYS_WAIT_H
HAVE_TCATTR
HAVE_TERM_H
HAVE_TIFF
HAVE_TIMEVAL
HAVE_TM_GMTOFF
HAVE_TM_ZONE
HAVE_TOUCHLOCK
HAVE_TZNAME
HAVE_TZSET
HAVE_UNSIGNED_LONG_LONG_INT
HAVE_UTIL_H
HAVE_UTIMENSAT
HAVE_UTIMES
HAVE_UTIME_H
HAVE_UTMP_H
HAVE_VFORK
HAVE_VFORK_H
HAVE_WCHAR_H
HAVE_WCHAR_T
HAVE_WINDOW_SYSTEM
HAVE_WINSOCK2_H
HAVE_WORKING_FORK
HAVE_WORKING_UTIMES
HAVE_WORKING_VFORK
HAVE_WS2TCPIP_H
HAVE_XAW3D
HAVE_XFT
HAVE_XIM
HAVE_XPM
HAVE_XRMSETDATABASE
HAVE_XSCREENNUMBEROFSCREEN
HAVE_XSCREENRESOURCESTRING
HAVE_X_I18N
HAVE_X_MENU
HAVE_X_SM
HAVE_X_WINDOWS
HAVE__BOOL
HAVE__FTIME
HAVE___BUILTIN_UNWIND_INIT
HAVE___EXECUTABLE_START
HAVE___FPENDING
INTERNAL_TERMINAL
IS_ANY_SEP
IS_DIRECTORY_SEP
MAIL_USE_FLOCK
MAIL_USE_LOCKF
MAIL_USE_POP
MAIL_USE_SYSTEM_LOCK
MAXPATHLEN
NLIST_STRUCT
NO_EDITRES
NSIG
NSIG_MINIMUM
NULL_DEVICE
PAGESIZE
PREFER_VSUSP
PTY_ITERATION
PTY_NAME_SPRINTF
PTY_OPEN
PTY_TTY_NAME_SPRINTF
PURESIZE
RUN_TIME_REMAP
SETUP_SLAVE_PTY
SIGNALS_VIA_CHARACTERS
STDC_HEADERS
SYSTEM_PURESIZE_EXTRA
SYSTEM_MALLOC
TAB3
TABDLY
TERM
TIME_WITH_SYS_TIME
TIOCSIGSEND
TM_IN_SYS_TIME
UNIX98_PTYS
USE_TOOLKIT_SCROLL_BARS
USG_SUBTTY_WORKS
VALBITS
XOS_NEEDS_TIME_H
_FILE_OFFSET_BITS
_LP64
_longjmp
_setjmp
abort
alloca
close
emacs
free
gmtime
localtime
malloc
random
read
realloc
select
umask
vfork


src/sysdep.c:
write

src/syssignal.h:
signal
sigmask
sigsetmask


lib/dup2.c:
dup2

lib/signal.h:
signal

lib/stdio.h:
fdopen
fopen
fwrite
popen
rename

lib/stdlib.h:
calloc
srandom     (conf_post.h may undo)

lib/strftime.c:
tzname
tzset

lib/sys/stat.h:
mkdir

lib/unistd.h:
chown
dup
dup2
ftruncate
isatty
link
lseek
pipe
rmdir
sleep
unlink


MS DOS stuff:

_NAIVE_DOS_REGS


MS stuff:

USE_CRT_DLL

ms-w32.h:
DebPrint
EMACSDEBUG
MUST_UNDEF__STDC__

_VARARGS_
_WINSOCKAPI_
_WINSOCK_H

access
calloc
chdir
chmod
chown
creat
ctime
dup
dup2
execlp
execvp  (also emacsclient.c [WINDOWSNT])
fdopen
fileno
fopen
fsync
ftruncate
getdefdir
getdisk
getpid
isatty
kill
link
lseek
mkdir
mktemp
open
pclose
pipe
popen
rename
rmdir
signal
sleep
spawnve
strdup
stricmp
strnicmp
strupr
sys_nerr
tzname
tzset
umask
unlink
utimbuf
utime
wait  (also movemail.c [WINDOWSNT])
write

lib-src/ntlib:
access
chdir
chmod
creat
dup
dup2
execlp
execvp
fdopen
fileno
fopen
getpid
index
isatty
lseek
mkdir
mktemp
open
pclose
pipe
popen
rmdir
rindex
sleep
umask
unlink
utime
