1 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
2 | dnl File: configure.in |
---|
3 | dnl Purpose: Process this file with autoconf to produce configure |
---|
4 | dnl Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) |
---|
5 | dnl Created: 11/99 |
---|
6 | dnl Version: $Id: configure.in,v 1.9 2000-09-14 15:36:39 obachman Exp $ |
---|
7 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
8 | |
---|
9 | AC_INIT(omAlloc.c) |
---|
10 | |
---|
11 | VERSION=0.9.5 |
---|
12 | AC_SUBST(VERSION) |
---|
13 | |
---|
14 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
15 | dnl help for configure |
---|
16 | dnl |
---|
17 | AC_ARG_WITH( |
---|
18 | external-config_h, |
---|
19 | [ --with-external-config_h=HEADER_FILE |
---|
20 | use HEADER_FILE for external configuration]) |
---|
21 | AC_ARG_WITH( |
---|
22 | external-config_c, |
---|
23 | [ --with-external-config_c=C_FILE |
---|
24 | use C_FILE for external implementations]) |
---|
25 | AC_ARG_WITH( |
---|
26 | malloc, |
---|
27 | [ --with-malloc=system|dlmalloc|gmalloc|pmalloc|external |
---|
28 | which malloc to use, default: dlmalloc ]) |
---|
29 | AC_ARG_WITH( |
---|
30 | external-malloc_h, |
---|
31 | [ --with-external-malloc-h=HEADER_FILE |
---|
32 | use HEADER_FILE for external malloc declaration]) |
---|
33 | AC_ARG_WITH( |
---|
34 | external-malloc_c, |
---|
35 | [ --with-external-malloc-c=C_FILE |
---|
36 | use C_FILE for external malloc implementation]) |
---|
37 | AC_ARG_WITH( |
---|
38 | valloc, |
---|
39 | [ --with-valloc=mmap|malloc|emulate |
---|
40 | how to get page-aligned memory, default: use first possible]) |
---|
41 | AC_ARG_WITH( |
---|
42 | provide-malloc, |
---|
43 | [ --with-provide-malloc=yes|debug|malloc |
---|
44 | provide normal|debug|underlying malloc ANSI-C conforming |
---|
45 | versions of malloc|calloc|realloc|free]) |
---|
46 | AC_ARG_WITH( |
---|
47 | emulate-omalloc, |
---|
48 | [ --with-emulate-omalloc |
---|
49 | provide only omallocs interface, but do not use its features]) |
---|
50 | AC_ARG_WITH( |
---|
51 | align, |
---|
52 | [ --with-align=8|sloppy|strict |
---|
53 | how memory is aligned, |
---|
54 | default: if possible sloppy, else strict]) |
---|
55 | AC_ARG_WITH( |
---|
56 | dense-bins, |
---|
57 | [ --with-dense-bins use dense bin distribution]) |
---|
58 | AC_ARG_WITH( |
---|
59 | inline, |
---|
60 | [ --without-inline do not inline]) |
---|
61 | AC_ARG_WITH( |
---|
62 | debug, |
---|
63 | [ --without-debug disable all debugging facilities]) |
---|
64 | AC_ARG_WITH( |
---|
65 | track, |
---|
66 | [ --without-track disable debug tracking functionality]) |
---|
67 | AC_ARG_WITH( |
---|
68 | track-fl, |
---|
69 | [ --with-track-fl track file and line numbers]) |
---|
70 | AC_ARG_WITH( |
---|
71 | track-return, |
---|
72 | [ --with-track-return track return addresses]) |
---|
73 | AC_ARG_WITH( |
---|
74 | track-backtrace, |
---|
75 | [ --with-track-backtrace track stack backtraces]) |
---|
76 | AC_ARG_WITH( |
---|
77 | track-custom, |
---|
78 | [ --with-track-custom track custom values]) |
---|
79 | AC_ARG_WITH( |
---|
80 | internal_debug, |
---|
81 | [ --with-internal-debug |
---|
82 | turn on internal debugging]) |
---|
83 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
84 | dnl compiler/make config |
---|
85 | dnl |
---|
86 | dnl I'm not sure why I did this |
---|
87 | dnl if test "${CFLAGS+set}" != set; then |
---|
88 | dnl CFLAGS="-O" |
---|
89 | dnl ac_cflags_set=no |
---|
90 | dnl fi |
---|
91 | |
---|
92 | AC_PROG_MAKE_SET |
---|
93 | AC_PROG_CC |
---|
94 | AC_PROG_CPP |
---|
95 | AC_PROG_RANLIB |
---|
96 | AC_PROG_LN_S |
---|
97 | AC_PROG_INSTALL |
---|
98 | AC_C_CONST |
---|
99 | AC_C_INLINE |
---|
100 | |
---|
101 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
102 | dnl check for programs |
---|
103 | dnl |
---|
104 | AC_CHECK_PROG(AR, ar, ar, :) |
---|
105 | if test "$ac_cv_prog_AR" != ar; then |
---|
106 | AC_MSG_ERROR(*** ar program not found) |
---|
107 | fi |
---|
108 | AC_CHECK_PROGS(PERL, perl, "no") |
---|
109 | if test "$ac_cv_prog_PERL" = no; then |
---|
110 | AC_MSG_ERROR(*** perl program not found) |
---|
111 | fi |
---|
112 | |
---|
113 | AC_CHECK_PROG(ADDR2LINE, addr2line, addr2line, no) |
---|
114 | if test "$ac_cv_prog_ADDR2LINE" = addr2line; then |
---|
115 | AC_DEFINE_UNQUOTED(OM_PROG_ADDR2LINE, "$ac_cv_prog_ADDR2LINE") |
---|
116 | fi |
---|
117 | |
---|
118 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
119 | dnl header file checks |
---|
120 | dnl |
---|
121 | AC_HEADER_STDC |
---|
122 | AC_CHECK_HEADERS(limits.h,, |
---|
123 | AC_MSG_ERROR(Can not compile without limits.h)) |
---|
124 | AC_CHECK_HEADERS(unistd.h sys/mman.h fcntl.h /usr/include/malloc.h) |
---|
125 | |
---|
126 | AC_CHECK_FUNCS(popen readlink getcwd getwd mmap sbrk random) |
---|
127 | |
---|
128 | dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
129 | dnl Find out more about particularity of the system |
---|
130 | dnl |
---|
131 | |
---|
132 | # sizes |
---|
133 | AC_CHECK_SIZEOF(long,4) |
---|
134 | AC_CHECK_SIZEOF(void*,4) |
---|
135 | AC_CHECK_SIZEOF(double, 8) |
---|
136 | AC_CHECK_SIZEOF(size_t, 4) |
---|
137 | |
---|
138 | if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then |
---|
139 | AC_MSG_ERROR(need equal sizes for long and void*) |
---|
140 | fi |
---|
141 | if test "$ac_cv_sizeof_voidp" != 4 && test "$ac_cv_sizeof_voidp" != 8; then |
---|
142 | AC_MSG_ERROR(need void* to be 4 or 8 bytes long) |
---|
143 | fi |
---|
144 | if test "$ac_cv_sizeof_double" != 4 && test "$ac_cv_sizeof_double" != 8; then |
---|
145 | AC_MSG_ERROR(need double to be 4 or 8 bytes long) |
---|
146 | fi |
---|
147 | |
---|
148 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
149 | dnl figure out page size of the system |
---|
150 | dnl |
---|
151 | AC_MSG_CHECKING(size of system page) |
---|
152 | AC_CACHE_VAL(ac_cv_pagesize, |
---|
153 | AC_TRY_RUN([#include <stdio.h> |
---|
154 | #include "omGetPageSize.h" |
---|
155 | |
---|
156 | main() |
---|
157 | { |
---|
158 | FILE *f=fopen("conftestval", "w"); |
---|
159 | if (!f) exit(1); |
---|
160 | fprintf(f, "%d\n", omalloc_getpagesize); |
---|
161 | exit(0); |
---|
162 | }], ac_cv_pagesize=`cat conftestval`, ac_cv_pagesize=0, ac_cv_pagesize=0)) |
---|
163 | AC_MSG_RESULT($ac_cv_pagesize) |
---|
164 | if test "$ac_cv_pagesize" = 4096 || test "$ac_cv_pagesize" = 8192; then |
---|
165 | AC_DEFINE_UNQUOTED(SIZEOF_SYSTEM_PAGE, $ac_cv_pagesize) |
---|
166 | else |
---|
167 | AC_MSG_ERROR(need sytem page to be of size 4096 or 8192, but is $ac_cv_pagesize) |
---|
168 | fi |
---|
169 | |
---|
170 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
171 | dnl check whether mmap actually works |
---|
172 | dnl |
---|
173 | if test "$ac_cv_func_mmap" = yes; then |
---|
174 | AC_MSG_CHECKING(whether mmap works) |
---|
175 | AC_CACHE_VAL(ac_cv_working_mmap, |
---|
176 | AC_TRY_RUN([ |
---|
177 | #include "omMmap.c" |
---|
178 | main() |
---|
179 | { |
---|
180 | void* addr = omVallocMmap(128*${ac_cv_pagesize}); |
---|
181 | if (addr == 0 || ((unsigned long) addr % ${ac_cv_pagesize})) |
---|
182 | exit(1); |
---|
183 | exit(omVfreeMmap(addr, 128*${ac_cv_pagesize})); |
---|
184 | }], ac_cv_working_mmap=yes, ac_cv_working_mmap=no, ac_cv_working_mmap=no)) |
---|
185 | AC_MSG_RESULT($ac_cv_working_mmap) |
---|
186 | if test "$ac_cv_working_mmap" = yes; then |
---|
187 | AC_DEFINE(HAVE_WORKING_MMAP) |
---|
188 | fi |
---|
189 | fi |
---|
190 | |
---|
191 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
192 | dnl for strict alignment |
---|
193 | dnl |
---|
194 | AC_CACHE_CHECK(whether alignment needs to be strict, ac_cv_align_need_strict, |
---|
195 | AC_TRY_RUN([ |
---|
196 | main() |
---|
197 | { |
---|
198 | void* ptr = (void*) malloc(12); |
---|
199 | double* d_ptr; |
---|
200 | if ((unsigned long) ptr % 8 == 0) ptr = ptr + 4; |
---|
201 | d_ptr = (double*) ptr; |
---|
202 | *d_ptr = (double) 1.1; |
---|
203 | if (*d_ptr != (double) 1.1) exit(1); |
---|
204 | else exit(0); |
---|
205 | } |
---|
206 | ], ac_cv_align_need_strict=no, ac_cv_align_need_strict=yes, ac_cv_align_need_strict=yes)) |
---|
207 | |
---|
208 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
209 | dnl external config files |
---|
210 | dnl |
---|
211 | AC_MSG_CHECKING(for external config files) |
---|
212 | if test "${with_external_config_h+set}" = set; then |
---|
213 | AC_DEFINE(OM_HAVE_EXTERNAL_CONFIG_H) |
---|
214 | EXTERNAL_CONFIG_HEADER=${with_external_config_h} |
---|
215 | rm -f omExternalConfig.h |
---|
216 | cp ${with_external_config_h} omExternalConfig.h |
---|
217 | fi |
---|
218 | if test "${with_external_config_c+set}" = set; then |
---|
219 | AC_DEFINE(OM_HAVE_EXTERNAL_CONFIG_C) |
---|
220 | EXTERNAL_CONFIG_SOURCE=${with_external_config_c} |
---|
221 | fi |
---|
222 | AC_SUBST(EXTERNAL_CONFIG_HEADER) |
---|
223 | AC_SUBST(EXTERNAL_CONFIG_SOURCE) |
---|
224 | if test "${EXTERNAL_CONFIG_HEADER+set}" = set || test "${EXTERNAL_CONFIG_SOURCE+set}" = set; then |
---|
225 | AC_MSG_RESULT(${EXTERNAL_CONFIG_HEADER} ${EXTERNAL_CONFIG_SOURCE}) |
---|
226 | else |
---|
227 | AC_MSG_RESULT(none) |
---|
228 | fi |
---|
229 | |
---|
230 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
231 | dnl for malloc |
---|
232 | dnl |
---|
233 | AC_MSG_CHECKING(which malloc to use) |
---|
234 | if test "${with_malloc}" = system; then |
---|
235 | OM_MALLOC_HEADER=omMallocSystem.h |
---|
236 | if test "${with_provide_malloc}" = yes || test "${with_provide_malloc}" = debug; then |
---|
237 | AC_MSG_ERROR("can not provide malloc for --with-malloc=system") |
---|
238 | fi |
---|
239 | elif test "${with_malloc}" = gmalloc; then |
---|
240 | OM_MALLOC_HEADER=gmalloc.h |
---|
241 | OM_MALLOC_SOURCE=gmalloc.c |
---|
242 | elif test "${with_malloc}" = pmalloc; then |
---|
243 | OM_MALLOC_HEADER=pmalloc.h |
---|
244 | OM_MALLOC_SOURCE=pmalloc.c |
---|
245 | elif test "${with_malloc}" = external; then |
---|
246 | if test "${with_external_malloc_h+set}" != set; then |
---|
247 | AC_MSG_ERROR(need --with_external_malloc_h for external malloc) |
---|
248 | fi |
---|
249 | if test "${with_provide_malloc}" = yes || test "${with_provide_malloc}" = debug; then |
---|
250 | AC_MSG_ERROR("can not provide malloc for --with_malloc=external") |
---|
251 | fi |
---|
252 | OM_MALLOC_HEADER=$with_external_malloc_h |
---|
253 | OM_MALLOC_SOURCE=$with_external_malloc_c |
---|
254 | else |
---|
255 | with_malloc=dlmalloc |
---|
256 | OM_MALLOC_HEADER=dlmalloc.h |
---|
257 | OM_MALLOC_SOURCE=dlmalloc.c |
---|
258 | fi |
---|
259 | AC_MSG_RESULT($with_malloc) |
---|
260 | AC_SUBST(OM_MALLOC_HEADER) |
---|
261 | AC_SUBST(OM_MALLOC_SOURCE) |
---|
262 | if test "${OM_MALLOC_SOURCE+set}" = set; then |
---|
263 | AC_DEFINE(OM_HAVE_MALLOC_SOURCE) |
---|
264 | fi |
---|
265 | |
---|
266 | AC_MSG_CHECKING(whether malloc provides SizeOfAddr) |
---|
267 | if test "${ac_cv_malloc_sizeof_addr}" = no; then |
---|
268 | AC_MSG_RESULT( (cached) no) |
---|
269 | elif test "${ac_cv_malloc_sizeof_addr}" = "${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}"; then |
---|
270 | AC_MSG_RESULT( (cached) yes) |
---|
271 | else |
---|
272 | AC_TRY_RUN([ |
---|
273 | #include "$OM_MALLOC_HEADER" |
---|
274 | #ifdef OM_HAVE_MALLOC_SOURCE |
---|
275 | #include "$OM_MALLOC_SOURCE" |
---|
276 | #endif |
---|
277 | |
---|
278 | main() |
---|
279 | { |
---|
280 | void* addr = OM_MALLOC_MALLOC(512); |
---|
281 | if (OM_MALLOC_SIZEOF_ADDR(addr) < 512) |
---|
282 | exit(1); |
---|
283 | exit(0); |
---|
284 | } |
---|
285 | ], ac_cv_malloc_sizeof_addr="${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}", ac_cv_malloc_sizeof_addr=no, ac_cv_malloc_sizeof_addr=no) |
---|
286 | if test "${ac_cv_malloc_sizeof_addr}" = no; then |
---|
287 | AC_MSG_RESULT(no) |
---|
288 | else |
---|
289 | AC_MSG_RESULT(yes) |
---|
290 | fi |
---|
291 | fi |
---|
292 | if test "$ac_cv_malloc_sizeof_addr" != no; then |
---|
293 | AC_DEFINE(OM_MALLOC_PROVIDES_SIZEOF_ADDR) |
---|
294 | fi |
---|
295 | |
---|
296 | if test "${with_provide_malloc}" = malloc; then |
---|
297 | AC_DEFINE(OM_PROVIDE_MALLOC, 3) |
---|
298 | elif test "${with_provide_malloc}" = debug; then |
---|
299 | AC_DEFINE(OM_PROVIDE_MALLOC, 2) |
---|
300 | elif test "${with_provide_malloc}" = yes; then |
---|
301 | AC_DEFINE(OM_PROVIDE_MALLOC, 1) |
---|
302 | else |
---|
303 | AC_DEFINE(OM_PROVIDE_MALLOC, 0) |
---|
304 | fi |
---|
305 | |
---|
306 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
307 | dnl check whether valloc is provided and that it works |
---|
308 | dnl |
---|
309 | AC_MSG_CHECKING(whether working valloc exists) |
---|
310 | if test "${ac_cv_working_valloc}" = no; then |
---|
311 | AC_MSG_RESULT( (cached) no) |
---|
312 | elif test "${ac_cv_working_valloc}" = "${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}"; then |
---|
313 | AC_MSG_RESULT( (cached) yes) |
---|
314 | else |
---|
315 | AC_TRY_RUN([ |
---|
316 | #include "$OM_MALLOC_HEADER" |
---|
317 | #ifdef OM_HAVE_MALLOC_SOURCE |
---|
318 | #include "$OM_MALLOC_SOURCE" |
---|
319 | #endif |
---|
320 | |
---|
321 | main() |
---|
322 | { |
---|
323 | void* addr = OM_MALLOC_VALLOC(128*${ac_cv_pagesize}); |
---|
324 | if (addr == 0 || ((unsigned long) addr % ${ac_cv_pagesize})) |
---|
325 | exit(1); |
---|
326 | OM_MALLOC_VFREE(addr, 128*${ac_cv_pagesize}); |
---|
327 | exit(0); |
---|
328 | } |
---|
329 | ], ac_cv_working_valloc="${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}", ac_cv_working_valloc=no, ac_cv_working_valloc=no) |
---|
330 | if test "${ac_cv_working_valloc}" = no; then |
---|
331 | AC_MSG_RESULT(no) |
---|
332 | else |
---|
333 | AC_MSG_RESULT(yes) |
---|
334 | fi |
---|
335 | fi |
---|
336 | |
---|
337 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
338 | dnl for valloc |
---|
339 | dnl |
---|
340 | AC_MSG_CHECKING(which valloc to use) |
---|
341 | if test "${with_valloc+set}" != set || test "${with_valloc}" = mmap; then |
---|
342 | if test "${ac_cv_working_mmap}" = yes; then |
---|
343 | with_valloc=mmap |
---|
344 | AC_DEFINE(OM_HAVE_VALLOC_MMAP) |
---|
345 | else |
---|
346 | with_valloc=malloc |
---|
347 | fi |
---|
348 | fi |
---|
349 | if test "${with_valloc}" = malloc; then |
---|
350 | if test "{ac_cv_working_valloc}" != no; then |
---|
351 | AC_DEFINE(OM_HAVE_VALLOC_MALLOC) |
---|
352 | else |
---|
353 | with_valloc=emulate |
---|
354 | fi |
---|
355 | fi |
---|
356 | AC_MSG_RESULT($with_valloc) |
---|
357 | |
---|
358 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
359 | dnl emulation |
---|
360 | dnl |
---|
361 | AC_MSG_CHECKING(whether to emulate omalloc) |
---|
362 | if test "${with_emulate_omalloc}" = yes; then |
---|
363 | AC_DEFINE(OM_EMULATE_OMALLOC) |
---|
364 | AC_MSG_RESULT(yes) |
---|
365 | else |
---|
366 | AC_MSG_RESULT(no) |
---|
367 | fi |
---|
368 | |
---|
369 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
370 | dnl alignment |
---|
371 | dnl |
---|
372 | AC_MSG_CHECKING(how to align) |
---|
373 | if test "$with_align" = 8 || test "$ac_cv_sizeof_long" = 8; then |
---|
374 | ac_cv_align=8 |
---|
375 | AC_DEFINE(OM_ALIGN_8) |
---|
376 | else |
---|
377 | if test "$ac_cv_align_need_strict" = "yes" || test "$with_align" = "strict"; then |
---|
378 | AC_DEFINE(OM_ALIGNMENT_NEEDS_WORK) |
---|
379 | ac_cv_align="strict" |
---|
380 | else |
---|
381 | ac_cv_align="sloppy" |
---|
382 | fi |
---|
383 | fi |
---|
384 | AC_MSG_RESULT($ac_cv_align) |
---|
385 | |
---|
386 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
387 | dnl dense bins |
---|
388 | dnl |
---|
389 | AC_MSG_CHECKING(whether to use dense bins) |
---|
390 | if test "$with_dense_bins" = yes; then |
---|
391 | AC_MSG_RESULT(yes) |
---|
392 | AC_DEFINE(OM_HAVE_DENSE_BIN_DISTRIBUTION) |
---|
393 | else |
---|
394 | AC_MSG_RESULT(no) |
---|
395 | fi |
---|
396 | |
---|
397 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
398 | dnl debug and inline |
---|
399 | dnl |
---|
400 | AC_MSG_CHECKING(whether to disable debugging) |
---|
401 | if test "$with_debug" != no; then |
---|
402 | AC_MSG_RESULT(no) |
---|
403 | else |
---|
404 | AC_MSG_RESULT(yes) |
---|
405 | AC_DEFINE(OM_NDEBUG) |
---|
406 | with_track=no |
---|
407 | fi |
---|
408 | |
---|
409 | AC_MSG_CHECKING(whether to have tracking debug functionality) |
---|
410 | if test "$with_track" != no; then |
---|
411 | AC_MSG_RESULT(yes) |
---|
412 | AC_DEFINE(OM_HAVE_TRACK) |
---|
413 | else |
---|
414 | AC_MSG_RESULT(no) |
---|
415 | fi |
---|
416 | |
---|
417 | AC_MSG_CHECKING(whether to use internal debug) |
---|
418 | if test "$with_internal_debug" = yes; then |
---|
419 | AC_MSG_RESULT(yes) |
---|
420 | AC_DEFINE(OM_INTERNAL_DEBUG) |
---|
421 | with_inline=no |
---|
422 | else |
---|
423 | AC_MSG_RESULT(no) |
---|
424 | fi |
---|
425 | |
---|
426 | AC_MSG_CHECKING(whether to inline) |
---|
427 | if test "$ac_cv_c_inline" != no && test "$with_inline" != no; then |
---|
428 | AC_DEFINE_UNQUOTED(OM_INLINE, static $ac_cv_c_inline) |
---|
429 | AC_DEFINE_UNQUOTED(OM_INLINE_DECL, static $ac_cv_c_inline) |
---|
430 | AC_DEFINE_UNQUOTED(OM_INLINE_IMPL, static $ac_cv_c_inline) |
---|
431 | AC_DEFINE_UNQUOTED(OM_INLINE_LOCAL, static $ac_cv_c_inline) |
---|
432 | AC_MSG_RESULT(yes) |
---|
433 | else |
---|
434 | AC_DEFINE_UNQUOTED(OM_INLINE_DECL, extern) |
---|
435 | AC_DEFINE_UNQUOTED(OM_INLINE_IMPL,) |
---|
436 | AC_DEFINE_UNQUOTED(OM_INLINE_LOCAL, static) |
---|
437 | AC_MSG_RESULT(no) |
---|
438 | fi |
---|
439 | |
---|
440 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
441 | dnl backtrace business |
---|
442 | dnl |
---|
443 | AC_MSG_CHECKING(whether GET_RET_ADDR works) |
---|
444 | AC_CACHE_VAL(ac_cv_get_return_addr_works, |
---|
445 | AC_TRY_RUN([ |
---|
446 | #include "omReturn.h" |
---|
447 | int test_return_addr() |
---|
448 | { |
---|
449 | char* f; |
---|
450 | GET_RET_ADDR(f); |
---|
451 | return (int) f; |
---|
452 | } |
---|
453 | int main() |
---|
454 | { |
---|
455 | exit(! test_return_addr()); |
---|
456 | } |
---|
457 | ], ac_cv_get_return_addr_works=yes, |
---|
458 | ac_cv_get_return_addr_works=no, |
---|
459 | ac_cv_get_return_addr_works=no)) |
---|
460 | AC_MSG_RESULT($ac_cv_get_return_addr_works) |
---|
461 | if test "$ac_cv_get_return_addr_works" = yes; then |
---|
462 | AC_DEFINE(OM_GET_RETURN_ADDR_WORKS) |
---|
463 | fi |
---|
464 | |
---|
465 | AC_MSG_CHECKING(whether omGetBackTrace works) |
---|
466 | AC_CACHE_VAL(ac_cv_get_backtrace_works, |
---|
467 | AC_TRY_RUN([ |
---|
468 | #include "omGetBackTrace.c" |
---|
469 | #include <stdio.h> |
---|
470 | int test_backtrace() |
---|
471 | { |
---|
472 | void* bt; |
---|
473 | int i = omGetBackTrace(&bt, 0, 10); |
---|
474 | return i; |
---|
475 | } |
---|
476 | int main() |
---|
477 | { |
---|
478 | int i; |
---|
479 | omInitGetBackTrace(); |
---|
480 | i = test_backtrace(); |
---|
481 | if (i == 1) exit(0); |
---|
482 | else exit(i+1); |
---|
483 | } |
---|
484 | ], ac_cv_get_backtrace_works=yes, |
---|
485 | ac_cv_get_backtrace_works=no, |
---|
486 | ac_cv_get_backtrace_works=no)) |
---|
487 | AC_MSG_RESULT($ac_cv_get_backtrace_works) |
---|
488 | if test "$ac_cv_get_backtrace_works" = yes; then |
---|
489 | AC_DEFINE(OM_GET_BACKTRACE_WORKS) |
---|
490 | fi |
---|
491 | |
---|
492 | AC_MSG_CHECKING(whether addr2line works) |
---|
493 | AC_CACHE_VAL(ac_cv_prog_addr2line_works, |
---|
494 | AC_TRY_RUN([ |
---|
495 | #undef OM_GET_BACKTRACE_WORKS |
---|
496 | #include "omReturn.h" |
---|
497 | #include "omStructs.h" |
---|
498 | #include "omGetBackTrace.h" |
---|
499 | #include "omRet2Info.c" |
---|
500 | #include "omFindExec.c" |
---|
501 | |
---|
502 | |
---|
503 | int test_Ret_2_Info() |
---|
504 | { |
---|
505 | void* bt; |
---|
506 | int i; |
---|
507 | struct omRetInfo_s info; |
---|
508 | |
---|
509 | GET_RET_ADDR(bt); |
---|
510 | i = omBackTrace_2_RetInfo(&bt, &info, 1); |
---|
511 | return i; |
---|
512 | } |
---|
513 | |
---|
514 | |
---|
515 | int main(int argc, char** argv) |
---|
516 | { |
---|
517 | int i; |
---|
518 | omInitRet_2_Info(*argv); |
---|
519 | i = test_Ret_2_Info(); |
---|
520 | if (i==1) exit(0); |
---|
521 | else exit (i+10); |
---|
522 | } |
---|
523 | ], ac_cv_prog_addr2line_works=yes, |
---|
524 | ac_cv_prog_addr2line_works=no, |
---|
525 | ac_cv_prog_addr2line_works=no)) |
---|
526 | AC_MSG_RESULT($ac_cv_prog_addr2line_works) |
---|
527 | |
---|
528 | AC_MSG_CHECKING(whether to track return addresses) |
---|
529 | if test "$with_track_return" = no || test "$ac_cv_get_return_addr_works" = no || test "$ac_cv_prog_addr2line_works" != yes; then |
---|
530 | with_track_return=no |
---|
531 | else |
---|
532 | AC_DEFINE(OM_TRACK_RETURN) |
---|
533 | with_track_return=yes |
---|
534 | fi |
---|
535 | AC_MSG_RESULT($with_track_return) |
---|
536 | |
---|
537 | AC_MSG_CHECKING(whether to track files and line numbers) |
---|
538 | if test "$with_track_fl" = no && test "$with_track_return" = no; then |
---|
539 | with_track_fl=yes |
---|
540 | fi |
---|
541 | if test "${with_track_fl+set}" != set; then |
---|
542 | if test "$with_track_return" = yes; then |
---|
543 | with_track_fl=no |
---|
544 | else |
---|
545 | with_track_fl=yes |
---|
546 | fi |
---|
547 | fi |
---|
548 | AC_MSG_RESULT($with_track_fl) |
---|
549 | if test "$with_track_fl" = yes; then |
---|
550 | AC_DEFINE(OM_TRACK_FILE_LINE) |
---|
551 | fi |
---|
552 | |
---|
553 | AC_MSG_CHECKING(whether to track stack backtraces) |
---|
554 | if test "$with_track" != no && test "$ac_cv_get_backtrace_works" = yes && test "$with_track_backtrace" != no && test "$ac_cv_prog_addr2line_works" = yes; then |
---|
555 | with_track_backtrace=yes |
---|
556 | AC_DEFINE(OM_TRACK_BACKTRACE) |
---|
557 | else |
---|
558 | with_track_backtrace=no |
---|
559 | fi |
---|
560 | AC_MSG_RESULT($with_track_backtrace) |
---|
561 | |
---|
562 | AC_MSG_CHECKING(whether to track custom values) |
---|
563 | if test "$with_track" != no && test "$with_track_custom" = yes; then |
---|
564 | AC_DEFINE(OM_TRACK_CUSTOM) |
---|
565 | else |
---|
566 | with_track_custom=no |
---|
567 | fi |
---|
568 | AC_MSG_RESULT($with_track_custom) |
---|
569 | |
---|
570 | dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll |
---|
571 | dnl wrap it up |
---|
572 | dnl |
---|
573 | AC_CONFIG_HEADER(omConfig.h omMalloc.h:${OM_MALLOC_HEADER}) |
---|
574 | |
---|
575 | |
---|
576 | AC_OUTPUT(Makefile, \ |
---|
577 | if test "$CONFIG_HEADERS"; then echo timestamp > stamp-h; fi) |
---|
578 | |
---|
579 | |
---|
580 | |
---|
581 | |
---|