1/*
2 * Automatic configuration flags
3 *
4 * Copyright 2020 by Gray Watson
5 *
6 * This file is part of the dmalloc package.
7 *
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose and without fee is hereby granted, provided
10 * that the above copyright notice and this permission notice appear
11 * in all copies, and that the name of Gray Watson not be used in
12 * advertising or publicity pertaining to distribution of the document
13 * or software without specific, written prior permission.
14 *
15 * Gray Watson makes no representations about the suitability of the
16 * software described herein for any purpose.  It is provided "as is"
17 * without express or implied warranty.
18 *
19 * The author may be contacted via http://dmalloc.com/
20 */
21
22#ifndef __CONF_H__
23#define __CONF_H__
24
25/* please see settings.h for manual configuration options */
26
27/*
28 * NOTE: The following settings should not need to be tuned by hand.
29 */
30
31/*
32 * Set to 1 if the mprotect function was found and the PROT_NONE,
33 * PROT_READ, and PROT_WRITE defines were found in sys/mman.h.  This
34 * is so that we can restrict access to certain blocks of memory.
35 */
36#define PROTECT_ALLOWED 0
37
38/*
39 * (char *)sbrk(const int incr) is the main heap-memory allocation
40 * routine that most systems employ.  This extends the program's data
41 * space by INCR number of bytes.
42 *
43 * NOTE: If configure generates a 0 for this and HAVE_MMAP on your
44 * system, you should see the INTERNAL_MEMORY_SPACE setting in the
45 * settings.h file which is created from the settings.dist file.
46 */
47#define HAVE_SBRK 0
48
49/*
50 * (void *)mmap(...) is another heap-memory allocation routine that
51 * systems employ.  On newer systems it is often preferable over sbrk.
52 * It allocates a block of memory in the virtual-memory system.  The
53 * USE_MMAP define is set if the standard mmap call works.
54 *
55 * NOTE: If configure generates a 0 for this and HAVE_SBRK on your
56 * system, you should see the INTERNAL_MEMORY_SPACE setting in the
57 * settings.h file which is created from the settings.dist file.
58 */
59#define HAVE_MMAP 0
60#define USE_MMAP 0
61#define HAVE_MUNMAP 0
62
63/*
64 * This is the basic block size in bits.  If possible, the configure
65 * script will set this to be the value returned by the getpagesize()
66 * function.  If not then some sort of best guess will be necessary.
67 * 15 (meaning basic block size of 32k) will probably be good.
68 *
69 * NOTE: some sbrk functions round to the correct page-size.  No
70 * problems aside from a possible small increase in the administration
71 * overhead should happen if this value is too high.
72 */
73#define BASIC_BLOCK 15
74
75/*
76 * The alignment value of all allocations in number of bytes for
77 * loading admin information before an allocation.  If possible, the
78 * configure script will set this to be the value returned by
79 * sizeof(long) which in most systems is the register width.
80 *
81 * NOTE: the value will never be auto-configured to be less than 8
82 * because some system (like sparc for instance) report the sizeof(long)
83 * == 4 while the register size is 8 bytes.  Certain memory needs to be of
84 * the same base as the register size (stack frames, code, etc.).  Any
85 * ideas how I can determine the register size in a better (and portable)
86 * fashion?
87 *
88 * NOTE: larger the number the more memory may be wasted by certain
89 * debugging settings like fence-post checking.
90 */
91#define ALLOCATION_ALIGNMENT 8
92
93/*
94 * When doing pointer arithmatic and other long value manipulation,
95 * what type should we use.  Hopefully we get a 64-bit value here.
96 */
97#define PNT_ARITH_TYPE unsigned long
98
99/*
100 * This checks to see if the abort routine does extensive cleaning up
101 * before halting a program.  If so then it may call malloc functions
102 * making the library go recursive.  If abort is set to not okay then
103 * you should tune the KILL_PROCESS and SIGNAL_INCLUDE options in
104 * settings.h if you want the library to be able to dump core.
105 */
106#define ABORT_OKAY 0
107
108/*
109 * This checks to see if we can include signal.h and get SIGHUP,
110 * SIGINT, and SIGTERM for the catch-signals token.  With this token,
111 * you can have the library do an automatic shutdown if we see the
112 * above signals.
113 */
114#define SIGNAL_OKAY 0
115#define RETSIGTYPE void
116
117/*
118 * This checks to see if we can include return.h and use the assembly
119 * macros there to call the callers address for logging.  If you do
120 * not want this behavior, then set the USE_RETURN_MACROS to 0 in the
121 * settings.h file.
122 */
123#define RETURN_MACROS_WORK 0
124
125/*
126 * Why can't the compiler folks agree about this.  I really hate Unix
127 * sometimes for its blatant disregard for anything approaching a
128 * standard.
129 */
130#define IDENT_WORKS 0
131
132/*
133 * Which pthread include file to use.
134 */
135#define HAVE_PTHREAD_H 0
136#define HAVE_PTHREADS_H 0
137
138/*
139 * What pthread functions do we have?
140 */
141#define HAVE_PTHREAD_MUTEX_INIT 0
142#define HAVE_PTHREAD_MUTEX_LOCK 0
143#define HAVE_PTHREAD_MUTEX_UNLOCK 0
144
145/*
146 * What is the pthread mutex type?  Usually (always?) it is
147 * pthread_mutex_t.
148 */
149#define THREAD_MUTEX_T pthread_mutex_t
150
151/*
152 * On some systems, you initialize mutex variables with NULL.  Others
153 * require various stupid non-portable incantations.  The OSF 3.2 guys
154 * should be ashamed of themselves.  This only is used if the
155 * LOCK_THREADS setting is enabled in the settings.h.
156 */
157#define THREAD_LOCK_INIT_VAL 0L
158
159/*
160 * Under the Cygwin environment, when malloc calls getenv, it core
161 * dumps.  This is because Cygwin, as far as I know, is loading the
162 * shared libraries for the various system functions and goes
163 * recursive with a call to getenv.  Ugh.
164 *
165 * So we have to delay the getenv call.  This sets when we can do the
166 * getenv call so the environmental processing is delayed.
167 */
168#define GETENV_SAFE 0
169
170/*
171 * See whether support exists for the constructor attribute which
172 * allows the library to run code before main() is called.  I know
173 * that later versions of gcc have support for this and maybe other
174 * compilers do as well.
175 */
176#define CONSTRUCTOR_WORKS 0
177
178/*
179 * See whether support exists for the destructor attribute which
180 * allows the library to run code after main() is exited.  I know
181 * that later versions of gcc have support for this and maybe other
182 * compilers do as well.
183 */
184#define DESTRUCTOR_WORKS 0
185
186/*
187 * See if we have the GetEnvironmentVariableA Cygwin function.  This
188 * is used as a getenv replacement.
189 */
190#define HAVE_GETENVIRONMENTVARIABLEA 0
191
192/*
193 * LIBRARY DEFINES:
194 */
195
196/*
197 * Whether the compiler and OS has standard C headers.
198 */
199#undef STDC_HEADERS
200
201/*
202 * Some systems have functions which can register routines to be
203 * called by exit(3) (or when the program returns from main).  This
204 * functionality allows the dmalloc_shutdown() routine to be called
205 * automatically upon program completion so that the library can log
206 * statistics.  Use the AUTO_SHUTDOWN define above to disable this.
207 * Please send me mail if this functionality exists on your system but
208 * in another name.
209 *
210 * NOTE: If neither is available, take a look at atexit.c in the
211 * contrib directory which may provide this useful functionality for
212 * your system.
213 */
214#define HAVE_ATEXIT 0
215#define HAVE_ON_EXIT 0
216
217/* Is the DMALLOC_SIZE type unsigned? */
218#define DMALLOC_SIZE_UNSIGNED 0
219
220/*
221 * The dmalloc library provides its own versions of the following
222 * functions, or knows how to work around their absence.
223 */
224/* bells and whistles */
225#define HAVE_FORK 0
226#define HAVE_GETHOSTNAME 0
227#define HAVE_GETPID 0
228#define HAVE_GETUID 0
229#define HAVE_TIME 0
230#define HAVE_CTIME 0
231
232#define HAVE_VPRINTF 0
233#define HAVE_SNPRINTF 0
234#define HAVE_VSNPRINTF 0
235
236#define HAVE_RECALLOC 0
237#define HAVE_MEMALIGN 0
238#define HAVE_VALLOC 0
239
240/* various functions for arg checking and/or internal use */
241
242#define HAVE_ATOI 0
243#define HAVE_ATOL 0
244#define HAVE_BCMP 0
245#define HAVE_BCOPY 0
246#define HAVE_BZERO 0
247#define HAVE_INDEX 0
248#define HAVE_MEMCCPY 0
249#define HAVE_MEMCHR 0
250#define HAVE_MEMCMP 0
251#define HAVE_MEMCPY 0
252#define HAVE_MEMMOVE 0
253#define HAVE_MEMSET 0
254#define HAVE_RINDEX 0
255#define HAVE_STRCASECMP 0
256#define HAVE_STRCAT 0
257#define HAVE_STRCHR 0
258#define HAVE_STRCMP 0
259#define HAVE_STRCPY 0
260#define HAVE_STRCSPN 0
261#define HAVE_STRDUP 0
262#define HAVE_STRLEN 0
263#define HAVE_STRNLEN 0
264#define HAVE_STRNCASECMP 0
265#define HAVE_STRNCAT 0
266#define HAVE_STRNCMP 0
267#define HAVE_STRNCPY 0
268#define HAVE_STRNDUP 0
269#define HAVE_STRPBRK 0
270#define HAVE_STRRCHR 0
271#define HAVE_STRSEP 0
272#define HAVE_STRSPN 0
273#define HAVE_STRSTR 0
274#define HAVE_STRTOK 0
275
276/* manual settings */
277#include "settings.h"
278
279#endif /* ! __CONF_H__ */
280