source: git/omalloc/configure.ac @ 9cf75aa

spielwiese
Last change on this file since 9cf75aa was 9cf75aa, checked in by Oleksandr Motsak <motsak@…>, 10 years ago
Fix omalloc/config (+ malloc_size / OSX)
  • Property mode set to 100644
File size: 17.0 KB
RevLine 
[66502b8]1dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[c2eb2e]2dnl File: configure.ac
[66502b8]3dnl Purpose: Process this file with autoconf to produce configure
4dnl Author:  obachman@mathematik.uni-kl.de (Olaf Bachmann)
5dnl Created: 11/99
6dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
7
[ab788d]8AC_INIT([omalloc],[0.9.6])
[9634a6]9
[60bdf0]10AC_CONFIG_MACRO_DIR([../m4])
[9634a6]11AC_CONFIG_AUX_DIR([.])
[60bdf0]12AC_CONFIG_SRCDIR(om_Alloc.c)
[49ea49]13AC_CONFIG_HEADER(omConfig.h)
14
[60bdf0]15SING_RESET_FLAGS()
16
[ea0001]17AM_MAINTAINER_MODE
[24a77fb]18AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) # -Wno-extra-portability -Werror silent-rules
[25761d]19m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
[280286e]20m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
[2e984a]21
[60bdf0]22AM_SANITY_CHECK
23
[49ea49]24# Add pre'prefixed config
25AX_PREFIX_CONFIG_H([omConfig.h],[],[omConfig.h])
26
[19efd96]27# SING_CHECK_SET_ARGS()
28
[60bdf0]29AC_SUBST(VERSION)
30
[66502b8]31dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
32dnl help for configure
33dnl
[2b43ac]34
[66502b8]35AC_ARG_WITH(
[3df5b10]36  external-config_h,
[be7466]37  [ --with-external-config_h=HEADER_FILE
38                    use HEADER_FILE for external configuration])
[66502b8]39AC_ARG_WITH(
[3df5b10]40  external-config_c,
[be7466]41  [ --with-external-config_c=C_FILE
42                    use C_FILE for external implementations])
[212fc04]43AC_ARG_WITH(
[be7466]44  malloc,
[09ed77]45  [ --with-malloc=system|external
[1122b2]46                    which malloc to use, default: malloc ])
[be7466]47AC_ARG_WITH(
[3df5b10]48  external-malloc_h,
[be7466]49  [ --with-external-malloc-h=HEADER_FILE
50                    use HEADER_FILE for external malloc declaration])
51AC_ARG_WITH(
[3df5b10]52  external-malloc_c,
53  [ --with-external-malloc-c=C_FILE
[be7466]54                    use C_FILE for external malloc implementation])
55AC_ARG_WITH(
56  valloc,
[50c8e82]57  [ --with-valloc=mmap|system|emulate
[be7466]58                    how to get page-aligned memory, default: use first possible])
59AC_ARG_WITH(
60  align,
[8d0069]61  [ --with-align=8|sloppy|strict
62                    how memory is aligned,
[be7466]63                    default: if possible sloppy, else strict])
64AC_ARG_WITH(
[3df5b10]65  dense-bins,
[be7466]66  [ --with-dense-bins  use dense bin distribution])
67AC_ARG_WITH(
68  inline,
69  [ --without-inline   do not inline])
70AC_ARG_WITH(
[3df5b10]71  debug,
72  [ --without-debug    disable all debugging facilities])
[be7466]73AC_ARG_WITH(
[3df5b10]74  track,
75  [ --without-track    disable debug tracking functionality])
[212fc04]76AC_ARG_WITH(
[3df5b10]77  track-fl,
78  [ --with-track-fl    track file and line numbers])
[be7466]79AC_ARG_WITH(
[3df5b10]80  track-return,
81  [ --with-track-return track return addresses])
82AC_ARG_WITH(
83  track-backtrace,
84  [ --with-track-backtrace track stack backtraces])
[fe7bd4]85AC_ARG_WITH(
[76801a]86  track-custom,
[8d0069]87  [ --with-track-custom track custom values])
[3df5b10]88AC_ARG_WITH(
89  internal_debug,
[8d0069]90  [ --with-internal-debug
[3df5b10]91                       turn on internal debugging])
[66502b8]92dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
93dnl compiler/make  config
94dnl
[3df5b10]95dnl I'm not sure why I did this
96dnl if test "${CFLAGS+set}" != set; then
97dnl  CFLAGS="-O"
98dnl  ac_cflags_set=no
99dnl fi
100
[e92dc4a]101CPPFLAGS="-I.. -I."
[66502b8]102AC_PROG_MAKE_SET
103AC_PROG_CC
104AC_PROG_CPP
[80c102]105
[be7466]106AC_PROG_LN_S
[3df5b10]107AC_PROG_INSTALL
[97b5d5]108AM_PROG_CC_C_O
[e078e0]109# AM_PROG_AR
[3df5b10]110AC_C_CONST
111AC_C_INLINE
[be7466]112
[80c102]113LT_INIT
114
115
[be7466]116dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
117dnl check for programs
118dnl
[66502b8]119AC_CHECK_PROG(AR, ar, ar, :)
120if test "$ac_cv_prog_AR" != ar; then
121  AC_MSG_ERROR(*** ar program not found)
122fi
[78f1ab]123AC_CHECK_PROGS(PERL, perl, "no")
124if test "$ac_cv_prog_PERL" = no; then
[66502b8]125  AC_MSG_ERROR(*** perl program not found)
126fi
127
128AC_CHECK_PROG(ADDR2LINE, addr2line, addr2line, no)
129if test "$ac_cv_prog_ADDR2LINE" = addr2line; then
[97b5d5]130  AC_DEFINE_UNQUOTED(OM_PROG_ADDR2LINE, "$ac_cv_prog_ADDR2LINE", "Name of addr2line")
[66502b8]131fi
132
[be7466]133dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
134dnl header file checks
135dnl
[66502b8]136AC_HEADER_STDC
137AC_CHECK_HEADERS(limits.h,,
138  AC_MSG_ERROR(Can not compile without limits.h))
[8fee84]139
[6acb5a5]140AC_CHECK_HEADERS(unistd.h sys/mman.h fcntl.h /usr/include/malloc.h)
[66502b8]141
[8fee84]142AC_CHECK_FUNCS(popen mmap sbrk random)
[66502b8]143
[be7466]144dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
145dnl Find out more about particularity of the system
146dnl
[66502b8]147
[be7466]148# sizes
149AC_CHECK_SIZEOF(long,4)
150AC_CHECK_SIZEOF(void*,4)
151AC_CHECK_SIZEOF(double, 8)
152AC_CHECK_SIZEOF(size_t, 4)
153
154if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp"; then
155  AC_MSG_ERROR(need equal sizes for long and void*)
156fi
157if test "$ac_cv_sizeof_voidp" != 4 && test "$ac_cv_sizeof_voidp" != 8; then
158  AC_MSG_ERROR(need void* to be 4 or 8 bytes long)
159fi
160if test "$ac_cv_sizeof_double" != 4 && test "$ac_cv_sizeof_double" != 8; then
161  AC_MSG_ERROR(need double to be 4 or 8 bytes long)
162fi
163
[adb2ed]164dnl Set compiler, linker flags so that we can work with omalloc
165BACKUP_CFLAGS=$CFLAGS
166BACKUP_CXXFLAGS=$CXXFLAGS
167BACKUP_LDFLAGS=$LDFLAGS
[9cf75aa]168
[adb2ed]169CFLAGS="$CFLAGS -I$srcdir"
170CXXFLAGS="$CXXFLAGS -I$srcdir"
171
[be7466]172dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
173dnl figure out page size of the system
174dnl
175AC_MSG_CHECKING(size of system page)
176AC_CACHE_VAL(ac_cv_pagesize,
177AC_TRY_RUN([#include <stdio.h>
[e078e0]178#include <stdlib.h>
[be7466]179#include "omGetPageSize.h"
180
181main()
182{
183  FILE *f=fopen("conftestval", "w");
184  if (!f) exit(1);
185  fprintf(f, "%d\n", omalloc_getpagesize);
186  exit(0);
187}], ac_cv_pagesize=`cat conftestval`, ac_cv_pagesize=0, ac_cv_pagesize=0))
[8d0069]188# can not really handle pagesizes which are greater -- there must be a
[1d905d]189# bug somewhere
190if test $ac_cv_pagesize -gt 8192; then
191  ac_cv_pagesize=8192
192fi
[be7466]193AC_MSG_RESULT($ac_cv_pagesize)
194if test "$ac_cv_pagesize" = 4096 || test "$ac_cv_pagesize" = 8192; then
[97b5d5]195  AC_DEFINE_UNQUOTED(SIZEOF_SYSTEM_PAGE, $ac_cv_pagesize, "Page-size of the build-system")
[be7466]196else
[adb2ed]197AC_MSG_ERROR([need sytem page to be of size 4096 or 8192, but is $ac_cv_pagesize])
[be7466]198fi
[212fc04]199
[66602d]200AC_DEFINE_UNQUOTED(SIZEOF_OM_PAGE,SIZEOF_SYSTEM_PAGE,Page-size of the build-system)
201
[be7466]202dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
203dnl check whether mmap actually works
204dnl
205if test "$ac_cv_func_mmap" = yes; then
206AC_MSG_CHECKING(whether mmap works)
207AC_CACHE_VAL(ac_cv_working_mmap,
208AC_TRY_RUN([
[e078e0]209#include <stdlib.h>
[be7466]210#include "omMmap.c"
211main()
212{
213  void* addr = omVallocMmap(128*${ac_cv_pagesize});
214  if (addr == 0 || ((unsigned long) addr % ${ac_cv_pagesize}))
215    exit(1);
216  exit(omVfreeMmap(addr, 128*${ac_cv_pagesize}));
217}], ac_cv_working_mmap=yes, ac_cv_working_mmap=no, ac_cv_working_mmap=no))
218AC_MSG_RESULT($ac_cv_working_mmap)
219if test "$ac_cv_working_mmap" = yes; then
[97b5d5]220  AC_DEFINE(HAVE_WORKING_MMAP,1,"Whether we have a working mmap")
[be7466]221fi
222fi
223
224dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
225dnl for strict alignment
226dnl
227AC_CACHE_CHECK(whether alignment needs to be strict, ac_cv_align_need_strict,
[8d0069]228AC_TRY_RUN([
[e078e0]229#include <stdlib.h>
[8d0069]230main()
[be7466]231{
[8d0069]232  void* ptr = (void*) malloc(12);
[58d429]233  volatile double* d_ptr;
[8d0069]234  if ((unsigned long) ptr % 8 == 0) ptr = ptr + 4;
[be7466]235  d_ptr = (double*) ptr;
[58d429]236  *d_ptr = (double) 1.25;
237  if (*d_ptr != (double) 1.25) exit(1);
[be7466]238  else exit(0);
239}
240], ac_cv_align_need_strict=no, ac_cv_align_need_strict=yes, ac_cv_align_need_strict=yes))
241
242dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
243dnl external config files
244dnl
245AC_MSG_CHECKING(for external config files)
246if test "${with_external_config_h+set}" = set; then
[97b5d5]247    AC_DEFINE(OM_HAVE_EXTERNAL_CONFIG_H,1,"Whether we have external config.h")
[be7466]248    EXTERNAL_CONFIG_HEADER=${with_external_config_h}
[3df5b10]249    rm -f omExternalConfig.h
250    cp ${with_external_config_h} omExternalConfig.h
[be7466]251fi
252if test "${with_external_config_c+set}" = set; then
[97b5d5]253    AC_DEFINE(OM_HAVE_EXTERNAL_CONFIG_C,1,"Wether we have an external config.c")
[be7466]254    EXTERNAL_CONFIG_SOURCE=${with_external_config_c}
255fi
256AC_SUBST(EXTERNAL_CONFIG_HEADER)
257AC_SUBST(EXTERNAL_CONFIG_SOURCE)
258if test "${EXTERNAL_CONFIG_HEADER+set}" = set || test "${EXTERNAL_CONFIG_SOURCE+set}" = set; then
259AC_MSG_RESULT(${EXTERNAL_CONFIG_HEADER} ${EXTERNAL_CONFIG_SOURCE})
260else
261AC_MSG_RESULT(none)
262fi
263
264dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
265dnl for malloc
266dnl
267AC_MSG_CHECKING(which malloc to use)
268if test "${with_malloc}" = system; then
269  OM_MALLOC_HEADER=omMallocSystem.h
[a2f973]270  AC_DEFINE(OMALLOC_USES_MALLOC,1,the system allocator is called malloc)
271  AC_DEFINE(OMALLOC_USES_SYSTEM_MALLOC,1,use system malloc as system allocator)
[be7466]272elif test "${with_malloc}" = external; then
[8d0069]273  if test "${with_external_malloc_h+set}" != set; then
[be7466]274    AC_MSG_ERROR(need --with_external_malloc_h for external malloc)
275  fi
[a2f973]276  AC_DEFINE(OMALLOC_USES_EXTERNAL_MALLOC,1,use external malloc as system allocator)
[be7466]277  OM_MALLOC_HEADER=$with_external_malloc_h
278  OM_MALLOC_SOURCE=$with_external_malloc_c
[a2f973]279  AC_DEFINE(OMALLOC_USES_MALLOC,1,the system allocator is called malloc)
280else    ## default
[1122b2]281  OM_MALLOC_HEADER=omMallocSystem.h
[a2f973]282  AC_DEFINE(OMALLOC_USES_MALLOC,1,the system allocator is called malloc)
283  AC_DEFINE(OMALLOC_USES_SYSTEM_MALLOC,1,use system malloc as system allocator)
[be7466]284fi
285AC_MSG_RESULT($with_malloc)
[fe6cc2]286
[be7466]287AC_SUBST(OM_MALLOC_HEADER)
288AC_SUBST(OM_MALLOC_SOURCE)
289if test "${OM_MALLOC_SOURCE+set}" = set; then
[97b5d5]290  AC_DEFINE(OM_HAVE_MALLOC_SOURCE,1,"Whether we have the source for malloc ()")
[be7466]291fi
292
293AC_MSG_CHECKING(whether malloc provides SizeOfAddr)
294if test "${ac_cv_malloc_sizeof_addr}" = no; then
295  AC_MSG_RESULT( (cached) no)
296elif test "${ac_cv_malloc_sizeof_addr}" = "${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}"; then
297   AC_MSG_RESULT( (cached) yes)
298else
299AC_TRY_RUN([
[e078e0]300#include <stdlib.h>
[be7466]301#include "$OM_MALLOC_HEADER"
302#ifdef OM_HAVE_MALLOC_SOURCE
303#include "$OM_MALLOC_SOURCE"
304#endif
305
306main()
307{
308  void* addr = OM_MALLOC_MALLOC(512);
[9cf75aa]309#ifdef OM_MALLOC_SIZEOF_ADDR
[be7466]310  if (OM_MALLOC_SIZEOF_ADDR(addr) < 512)
311    exit(1);
312  exit(0);
[9cf75aa]313#else
314  exit(1);
315#endif
[be7466]316}
317], ac_cv_malloc_sizeof_addr="${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}", ac_cv_malloc_sizeof_addr=no, ac_cv_malloc_sizeof_addr=no)
318if test "${ac_cv_malloc_sizeof_addr}" = no; then
319AC_MSG_RESULT(no)
320else
321AC_MSG_RESULT(yes)
322fi
323fi
324if test "$ac_cv_malloc_sizeof_addr" != no; then
[97b5d5]325AC_DEFINE(OM_MALLOC_PROVIDES_SIZEOF_ADDR,1,"Whether malloc provides SIZEOF_ADDR")
[be7466]326fi
[8d0069]327
[be7466]328dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
329dnl check whether valloc is provided and that it works
330dnl
331AC_MSG_CHECKING(whether working valloc exists)
332if test "${ac_cv_working_valloc}" = no; then
333  AC_MSG_RESULT( (cached) no)
334elif test "${ac_cv_working_valloc}" = "${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}"; then
335  AC_MSG_RESULT( (cached) yes)
336else
337AC_TRY_RUN([
[e078e0]338#include <stdlib.h>
[be7466]339#include "$OM_MALLOC_HEADER"
340#ifdef OM_HAVE_MALLOC_SOURCE
341#include "$OM_MALLOC_SOURCE"
342#endif
343
344main()
345{
346  void* addr = OM_MALLOC_VALLOC(128*${ac_cv_pagesize});
347  if (addr == 0 || ((unsigned long) addr % ${ac_cv_pagesize}))
348    exit(1);
349  OM_MALLOC_VFREE(addr, 128*${ac_cv_pagesize});
350  exit(0);
351}
352], ac_cv_working_valloc="${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}", ac_cv_working_valloc=no, ac_cv_working_valloc=no)
353if test "${ac_cv_working_valloc}" = no; then
354AC_MSG_RESULT(no)
355else
356AC_MSG_RESULT(yes)
357fi
358fi
359
360dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
361dnl for valloc
362dnl
363AC_MSG_CHECKING(which valloc to use)
364if test "${with_valloc+set}" != set || test "${with_valloc}" = mmap; then
365  if test "${ac_cv_working_mmap}" = yes; then
366    with_valloc=mmap
[97b5d5]367    AC_DEFINE(OM_HAVE_VALLOC_MMAP,1,"Have valloc")
[be7466]368  else
369    with_valloc=malloc
370  fi
371fi
372if test "${with_valloc}" = malloc; then
[d83977]373  if test "${ac_cv_working_valloc}" != no; then
[97b5d5]374    AC_DEFINE(OM_HAVE_VALLOC_MALLOC,1,"Have valloc")
[be7466]375  else
376    with_valloc=emulate
377  fi
378fi
379AC_MSG_RESULT($with_valloc)
380
381dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[8d0069]382dnl alignment
[be7466]383dnl
384AC_MSG_CHECKING(how to align)
385if test "$with_align" = 8 || test "$ac_cv_sizeof_long" = 8; then
386  ac_cv_align=8
[97b5d5]387  AC_DEFINE(OM_ALIGN_8,1,"Align to 8 bytes")
[be7466]388else
389if test "$ac_cv_align_need_strict" = "yes" || test "$with_align" = "strict"; then
[97b5d5]390  AC_DEFINE(OM_ALIGNMENT_NEEDS_WORK,1,"Whether alignment needs work")
[be7466]391  ac_cv_align="strict"
392else
393  ac_cv_align="sloppy"
[8d0069]394fi
[be7466]395fi
396AC_MSG_RESULT($ac_cv_align)
397
398dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
399dnl dense bins
400dnl
401AC_MSG_CHECKING(whether to use dense bins)
402if test "$with_dense_bins" = yes; then
403AC_MSG_RESULT(yes)
[97b5d5]404AC_DEFINE(OM_HAVE_DENSE_BIN_DISTRIBUTION,1,"Whether we have dense bins")
[be7466]405else
406AC_MSG_RESULT(no)
407fi
408
409dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
410dnl debug and inline
411dnl
[3df5b10]412AC_MSG_CHECKING(whether to disable debugging)
413if test "$with_debug" != no; then
414AC_MSG_RESULT(no)
415else
416AC_MSG_RESULT(yes)
[97b5d5]417AC_DEFINE(OM_NDEBUG,1,"Disable debug")
[3df5b10]418with_track=no
419fi
420
421AC_MSG_CHECKING(whether to have tracking debug functionality)
422if test "$with_track" != no; then
423AC_MSG_RESULT(yes)
[97b5d5]424AC_DEFINE(OM_HAVE_TRACK,1,"Have track")
[3df5b10]425else
426AC_MSG_RESULT(no)
427fi
428
[be7466]429AC_MSG_CHECKING(whether to use internal debug)
430if test "$with_internal_debug" = yes; then
431AC_MSG_RESULT(yes)
[97b5d5]432AC_DEFINE(OM_INTERNAL_DEBUG,1,"Internal debug")
[be7466]433with_inline=no
434else
435AC_MSG_RESULT(no)
436fi
437
438AC_MSG_CHECKING(whether to inline)
439if test "$ac_cv_c_inline" != no && test "$with_inline" != no; then
[97b5d5]440  AC_DEFINE_UNQUOTED(OM_INLINE, static $ac_cv_c_inline, "inline-declaration")
441  AC_DEFINE_UNQUOTED(OM_INLINE_DECL, static $ac_cv_c_inline, "inline-declaration")
442  AC_DEFINE_UNQUOTED(OM_INLINE_IMPL, static $ac_cv_c_inline, "inline-declaration")
443  AC_DEFINE_UNQUOTED(OM_INLINE_LOCAL, static $ac_cv_c_inline, "inline-declaration")
[be7466]444  AC_MSG_RESULT(yes)
445else
[97b5d5]446  AC_DEFINE_UNQUOTED(OM_INLINE_DECL, extern, "inline-declaration")
447  AC_DEFINE_UNQUOTED(OM_INLINE_IMPL,, "inline-declaration")
448  AC_DEFINE_UNQUOTED(OM_INLINE_LOCAL, static, "inline-declaration")
[be7466]449  AC_MSG_RESULT(no)
450fi
451
452dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[3df5b10]453dnl backtrace business
[be7466]454dnl
[3df5b10]455AC_MSG_CHECKING(whether GET_RET_ADDR works)
456AC_CACHE_VAL(ac_cv_get_return_addr_works,
[66502b8]457AC_TRY_RUN([
[e078e0]458#include <stdlib.h>
[3df5b10]459#include "omReturn.h"
[66502b8]460int test_return_addr()
461{
[3df5b10]462  char* f;
463  GET_RET_ADDR(f);
[e078e0]464  return (int)(long) f;
[66502b8]465}
466int main()
467{
[3df5b10]468   exit(! test_return_addr());
[66502b8]469}
[8d0069]470], ac_cv_get_return_addr_works=yes,
[3df5b10]471   ac_cv_get_return_addr_works=no,
472   ac_cv_get_return_addr_works=no))
473AC_MSG_RESULT($ac_cv_get_return_addr_works)
474if test "$ac_cv_get_return_addr_works" = yes; then
[97b5d5]475AC_DEFINE(OM_GET_RETURN_ADDR_WORKS,1, "Whether get return address works")
[3df5b10]476fi
477
478AC_MSG_CHECKING(whether omGetBackTrace works)
479AC_CACHE_VAL(ac_cv_get_backtrace_works,
[212fc04]480AC_TRY_RUN([
[3df5b10]481#include <stdio.h>
[e078e0]482#include <stdlib.h>
483#include "omGetBackTrace.c"
[3df5b10]484int test_backtrace()
[212fc04]485{
[3df5b10]486  void* bt;
487  int i = omGetBackTrace(&bt, 0, 10);
488  return i;
[212fc04]489}
490int main()
491{
[8d0069]492   int i;
[3df5b10]493   omInitGetBackTrace();
494   i = test_backtrace();
[8291be]495   if (i > 0) exit(0);
496   else exit(i+10);
[212fc04]497}
[8d0069]498], ac_cv_get_backtrace_works=yes,
[3df5b10]499   ac_cv_get_backtrace_works=no,
500   ac_cv_get_backtrace_works=no))
501AC_MSG_RESULT($ac_cv_get_backtrace_works)
502if test "$ac_cv_get_backtrace_works" = yes; then
[97b5d5]503AC_DEFINE(OM_GET_BACKTRACE_WORKS,1,"Whether omInitGetBackTrace () works")
[212fc04]504fi
505
[b98efa]506AC_MSG_CHECKING(whether addr2line works)
507AC_CACHE_VAL(ac_cv_prog_addr2line_works,
508AC_TRY_RUN([
[e078e0]509#include <stdlib.h>
[b98efa]510#undef OM_GET_BACKTRACE_WORKS
511#include "omReturn.h"
512#include "omStructs.h"
513#include "omGetBackTrace.h"
514#include "omRet2Info.c"
515
516int test_Ret_2_Info()
517{
518  void* bt;
519  int i;
520  struct omRetInfo_s info;
[8d0069]521
[b98efa]522  GET_RET_ADDR(bt);
523  i = omBackTrace_2_RetInfo(&bt, &info, 1);
524  return i;
525}
526
527int main(int argc, char** argv)
528{
529  int i;
530  omInitRet_2_Info(*argv);
531  i = test_Ret_2_Info();
532  if (i==1) exit(0);
533  else exit (i+10);
534}
[8d0069]535], ac_cv_prog_addr2line_works=yes,
[b98efa]536   ac_cv_prog_addr2line_works=no,
537   ac_cv_prog_addr2line_works=no))
538AC_MSG_RESULT($ac_cv_prog_addr2line_works)
[8d0069]539
[3df5b10]540AC_MSG_CHECKING(whether to track return addresses)
[444bcf]541if test "$with_track_return" = no || test "$ac_cv_get_return_addr_works" = no || test "$ac_cv_prog_addr2line_works" != yes; then
[3df5b10]542  with_track_return=no
[212fc04]543else
[97b5d5]544  AC_DEFINE(OM_TRACK_RETURN,1,"Whether to track return")
[3df5b10]545  with_track_return=yes
[212fc04]546fi
[3df5b10]547AC_MSG_RESULT($with_track_return)
[212fc04]548
[3df5b10]549AC_MSG_CHECKING(whether to track files and line numbers)
550if test "$with_track_fl" = no && test "$with_track_return" = no; then
551  with_track_fl=yes
552fi
[8d0069]553if test "${with_track_fl+set}" != set; then
[3df5b10]554  if test "$with_track_return" = yes; then
555    with_track_fl=no
556  else
557    with_track_fl=yes
558  fi
559fi
560AC_MSG_RESULT($with_track_fl)
[8d0069]561if test "$with_track_fl" = yes; then
[97b5d5]562  AC_DEFINE(OM_TRACK_FILE_LINE,1,"Whether to track file-line")
[66502b8]563fi
564
[3df5b10]565AC_MSG_CHECKING(whether to track stack backtraces)
[b98efa]566if test "$with_track" != no && test "$ac_cv_get_backtrace_works" = yes && test "$with_track_backtrace" != no && test "$ac_cv_prog_addr2line_works" = yes; then
[3df5b10]567  with_track_backtrace=yes
[97b5d5]568  AC_DEFINE(OM_TRACK_BACKTRACE,1,"Whether to track backtrace")
[3df5b10]569else
570  with_track_backtrace=no
571fi
572AC_MSG_RESULT($with_track_backtrace)
[fe7bd4]573
[8d0069]574AC_MSG_CHECKING(whether to track custom values)
[fe7bd4]575if test "$with_track" != no && test "$with_track_custom" = yes; then
[97b5d5]576  AC_DEFINE(OM_TRACK_CUSTOM,1,"Enable custom tracking")
[fe7bd4]577else
578  with_track_custom=no
579fi
580AC_MSG_RESULT($with_track_custom)
581
[fe6cc2]582dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
583dnl figure out the return type of sbrk
584dnl
585
586AC_MSG_CHECKING(return type of sbrk)
587AC_TRY_LINK(
588#define __USE_MISC
589#include <unistd.h>
590,
591void *sbrk();
592,
[97b5d5]593AC_DEFINE(Void_t,void,"Type of void"),
594AC_DEFINE(Void_t,char,"Type of void"),
[fe6cc2]595)
596AC_MSG_RESULT(Void_t)
597
598
[715936]599AC_DEFINE(OM_PROVIDE_MALLOC,0,[Provide NO standard routines!])
600
601
[9cf75aa]602dnl Restore user-specified CFLAGS, CXXFLAGS, LIBS
603
604CFLAGS=$BACKUP_CFLAGS
605CXXFLAGS=$BACKUP_CXXFLAGS
606LDFLAGS=$BACKUP_LDFLAGS
[fe6cc2]607
[be7466]608dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[3df5b10]609dnl wrap it up
[66502b8]610dnl
[c2eb2e]611AC_CONFIG_FILES([Makefile])
612AC_OUTPUT
[fe6cc2]613
Note: See TracBrowser for help on using the repository browser.