summaryrefslogtreecommitdiff
path: root/base/config.h
blob: 3cef24080e5d7406e790ba87c56f30ad32901255 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#ifndef _CONFIG_H
#define _CONFIG_H

/* config.h -- Copyright 1990, Massimo A. Sivilotti, Caltech */

/* This file documents all the system-dependent configuration options.
   It is probably better to supply these options on the command-line
   by predefining preprocessor symbols, than by editing this file */

/******************************************************************/


/* define the following if your system does not provide the SYSV string
   routines:  strpbrk(), strcspn(), and strtok() */
/* #define NEED_STRING */

/* define the following if your system does not provide strstr() */
/* #define NEED_STRSTR */

/* define the following if your system does not provide strcasecmp() */
/* #define NEED_STRCASECMP */

/* define the following if your system does not provide strdup */
/* #define NEED_STRDUP */

/* define the following if your system does not provide strtol() */
/* #define NEED_STRTOL */


/* define the following if your system does not do so in values.h */
/* INT_MAX is only used by the random number generator in netcmp.h */
/* #define INT_MAX 31999 */  /* or some other largish number */


/* define the following if your system provides times(2) data */
/* #define HAVE_TIMES */

/* define the following if your system provides getrusage(2) data */
/* #define HAVE_GETRUSAGE */

/* define the following if your system has ANSI C:  clock and CLOCKS_PER_SEC */
/* #define HAVE_CLOCK */

/* define the following if your (nominally BSD) system provides the SYSV
   string functions:  strchr, strrchr, memcpy, and memset */
/* #define HAVE_SYSV_STRING */

/* define the following if your system lacks vsprintf() and vfprintf() */
/* #define NEED_VPRINTF */

/* define the following to disable DBUG code */
/* #define DBUG_OFF */

/* define HAVE_GETOPT if your system has getopt(3) */
/* #define HAVE_GETOPT */


/***********************************************************/
/*           REGULAR EXPRESSION STUFF                      */

/* define the following if your system provides REGCMP(3X) */
/* #define HAVE_REGCMP */

/* define the following if your system provides re_exec and re_comp */
/* #define HAVE_RE_COMP */

/* IF NEITHER HAVE_REGCMP nor HAVE_RE_COMP, use internal routines */



#if defined(BSD) && !defined(HAVE_SYSV_STRING)
#include <strings.h>
#else
#include <string.h>
#ifndef IBMPC
#include <memory.h>
#endif
#endif

#ifdef HAVE_MALLINFO
#include <malloc.h>
#endif

/*  SOME GOOD DEFAULTS   */
/*  eventually, these should be independent of the standards... */

#ifdef VMUNIX
/* #define NEED_STRCASECMP */
#define HAVE_STRCASECMP
#define HAVE_GETOPT

#ifdef BSD
#ifndef ultrix
#define NEED_STRSTR
#endif /* ultrix */
#define NEED_STRDUP
#define HAVE_GETRUSAGE
#define NEED_STRING
#ifndef sun
#define NEED_STRTOL
#endif
#endif /* BSD */

#if !defined(HAVE_GETRUSAGE) && !defined(HAVE_CLOCK)
#define HAVE_TIMES
#endif /* not HAVE_GETRUSAGE or HAVE_CLOCK */
#endif /* VMUNIX */


/* some simple equivalences */
#if defined(BSD) && !defined(HAVE_SYSV_STRING)
#define strchr(s,c) index(s,c)
#define strrchr(s,c) rindex(s,c)
#define memcpy(to,from,len) bcopy((char *)(from), (char *)(to), len) 
#define memzero(ptr, len) bzero((char *)(ptr),len)
#else
#define memzero(ptr, len) memset(ptr, 0, len)
#endif

#ifdef HAVE_SYSV_STRING
#undef NEED_STRING
#endif

/* some standards !!!! */

#ifdef ANSI_LIBRARY
#undef NEED_STRSTR
#undef NEED_STRING
#undef NEED_STRTOL
#undef NEED_VPRINTF
#define HAVE_CLOCK
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>


#ifdef HPUX
extern int write(int filedes, void *buf, unsigned nbyte); /* SUN has this */
#endif

#ifndef HPUX
extern int open(char *path, int oflag, ...); /* HPUX has it in <sys/fcntl.h> */
#endif

#endif /* ANSI_LIBRARY */



#ifdef NEED_PROTOTYPES
/* proto.h contains prototypes for all undefined functions */
#include "proto.h"
#endif

/* get random number functions, and any string functions we are missing */
#include "pdutils.h"

/* Casting of allocation functions */
#ifdef TCL_NETGEN
  #define CALLOC(a, s)	tcl_calloc(a, s)
  #define MALLOC(s)	Tcl_Alloc(s)
  #define FREE(a)	Tcl_Free((char *)a)
  extern char *Tcl_Strdup(const char *);
  #define STRDUP(a)	Tcl_Strdup((const char *)a)
#else
  #include <stdlib.h>
  #define CALLOC(a, s)	calloc(a, s)
  #define MALLOC(s)	malloc(s)
  #define FREE(a)	free(a)
  #define STRDUP(a)	strdup(a)
#endif

#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif

#endif /* _CONFIG_H */