source: git/omalloc/configure.ac @ 25761d

spielwiese
Last change on this file since 25761d was 25761d, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Fix BS: AM_SILENT_RULES([yes])
  • Property mode set to 100644
File size: 16.9 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
168CFLAGS="$CFLAGS -I$srcdir"
169CXXFLAGS="$CXXFLAGS -I$srcdir"
170
[be7466]171dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
172dnl figure out page size of the system
173dnl
174AC_MSG_CHECKING(size of system page)
175AC_CACHE_VAL(ac_cv_pagesize,
176AC_TRY_RUN([#include <stdio.h>
[e078e0]177#include <stdlib.h>
[be7466]178#include "omGetPageSize.h"
179
180main()
181{
182  FILE *f=fopen("conftestval", "w");
183  if (!f) exit(1);
184  fprintf(f, "%d\n", omalloc_getpagesize);
185  exit(0);
186}], ac_cv_pagesize=`cat conftestval`, ac_cv_pagesize=0, ac_cv_pagesize=0))
[8d0069]187# can not really handle pagesizes which are greater -- there must be a
[1d905d]188# bug somewhere
189if test $ac_cv_pagesize -gt 8192; then
190  ac_cv_pagesize=8192
191fi
[be7466]192AC_MSG_RESULT($ac_cv_pagesize)
193if test "$ac_cv_pagesize" = 4096 || test "$ac_cv_pagesize" = 8192; then
[97b5d5]194  AC_DEFINE_UNQUOTED(SIZEOF_SYSTEM_PAGE, $ac_cv_pagesize, "Page-size of the build-system")
[be7466]195else
[adb2ed]196AC_MSG_ERROR([need sytem page to be of size 4096 or 8192, but is $ac_cv_pagesize])
[be7466]197fi
[212fc04]198
[66602d]199AC_DEFINE_UNQUOTED(SIZEOF_OM_PAGE,SIZEOF_SYSTEM_PAGE,Page-size of the build-system)
200
[be7466]201dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
202dnl check whether mmap actually works
203dnl
204if test "$ac_cv_func_mmap" = yes; then
205AC_MSG_CHECKING(whether mmap works)
206AC_CACHE_VAL(ac_cv_working_mmap,
207AC_TRY_RUN([
[e078e0]208#include <stdlib.h>
[be7466]209#include "omMmap.c"
210main()
211{
212  void* addr = omVallocMmap(128*${ac_cv_pagesize});
213  if (addr == 0 || ((unsigned long) addr % ${ac_cv_pagesize}))
214    exit(1);
215  exit(omVfreeMmap(addr, 128*${ac_cv_pagesize}));
216}], ac_cv_working_mmap=yes, ac_cv_working_mmap=no, ac_cv_working_mmap=no))
217AC_MSG_RESULT($ac_cv_working_mmap)
218if test "$ac_cv_working_mmap" = yes; then
[97b5d5]219  AC_DEFINE(HAVE_WORKING_MMAP,1,"Whether we have a working mmap")
[be7466]220fi
221fi
222
223dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
224dnl for strict alignment
225dnl
226AC_CACHE_CHECK(whether alignment needs to be strict, ac_cv_align_need_strict,
[8d0069]227AC_TRY_RUN([
[e078e0]228#include <stdlib.h>
[8d0069]229main()
[be7466]230{
[8d0069]231  void* ptr = (void*) malloc(12);
[58d429]232  volatile double* d_ptr;
[8d0069]233  if ((unsigned long) ptr % 8 == 0) ptr = ptr + 4;
[be7466]234  d_ptr = (double*) ptr;
[58d429]235  *d_ptr = (double) 1.25;
236  if (*d_ptr != (double) 1.25) exit(1);
[be7466]237  else exit(0);
238}
239], ac_cv_align_need_strict=no, ac_cv_align_need_strict=yes, ac_cv_align_need_strict=yes))
240
241dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
242dnl external config files
243dnl
244AC_MSG_CHECKING(for external config files)
245if test "${with_external_config_h+set}" = set; then
[97b5d5]246    AC_DEFINE(OM_HAVE_EXTERNAL_CONFIG_H,1,"Whether we have external config.h")
[be7466]247    EXTERNAL_CONFIG_HEADER=${with_external_config_h}
[3df5b10]248    rm -f omExternalConfig.h
249    cp ${with_external_config_h} omExternalConfig.h
[be7466]250fi
251if test "${with_external_config_c+set}" = set; then
[97b5d5]252    AC_DEFINE(OM_HAVE_EXTERNAL_CONFIG_C,1,"Wether we have an external config.c")
[be7466]253    EXTERNAL_CONFIG_SOURCE=${with_external_config_c}
254fi
255AC_SUBST(EXTERNAL_CONFIG_HEADER)
256AC_SUBST(EXTERNAL_CONFIG_SOURCE)
257if test "${EXTERNAL_CONFIG_HEADER+set}" = set || test "${EXTERNAL_CONFIG_SOURCE+set}" = set; then
258AC_MSG_RESULT(${EXTERNAL_CONFIG_HEADER} ${EXTERNAL_CONFIG_SOURCE})
259else
260AC_MSG_RESULT(none)
261fi
262
263dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
264dnl for malloc
265dnl
266AC_MSG_CHECKING(which malloc to use)
267if test "${with_malloc}" = system; then
268  OM_MALLOC_HEADER=omMallocSystem.h
[a2f973]269  AC_DEFINE(OMALLOC_USES_MALLOC,1,the system allocator is called malloc)
270  AC_DEFINE(OMALLOC_USES_SYSTEM_MALLOC,1,use system malloc as system allocator)
[be7466]271elif test "${with_malloc}" = external; then
[8d0069]272  if test "${with_external_malloc_h+set}" != set; then
[be7466]273    AC_MSG_ERROR(need --with_external_malloc_h for external malloc)
274  fi
[a2f973]275  AC_DEFINE(OMALLOC_USES_EXTERNAL_MALLOC,1,use external malloc as system allocator)
[be7466]276  OM_MALLOC_HEADER=$with_external_malloc_h
277  OM_MALLOC_SOURCE=$with_external_malloc_c
[a2f973]278  AC_DEFINE(OMALLOC_USES_MALLOC,1,the system allocator is called malloc)
279else    ## default
[1122b2]280  OM_MALLOC_HEADER=omMallocSystem.h
[a2f973]281  AC_DEFINE(OMALLOC_USES_MALLOC,1,the system allocator is called malloc)
282  AC_DEFINE(OMALLOC_USES_SYSTEM_MALLOC,1,use system malloc as system allocator)
[be7466]283fi
284AC_MSG_RESULT($with_malloc)
[fe6cc2]285
[be7466]286AC_SUBST(OM_MALLOC_HEADER)
287AC_SUBST(OM_MALLOC_SOURCE)
288if test "${OM_MALLOC_SOURCE+set}" = set; then
[97b5d5]289  AC_DEFINE(OM_HAVE_MALLOC_SOURCE,1,"Whether we have the source for malloc ()")
[be7466]290fi
291
292AC_MSG_CHECKING(whether malloc provides SizeOfAddr)
293if test "${ac_cv_malloc_sizeof_addr}" = no; then
294  AC_MSG_RESULT( (cached) no)
295elif test "${ac_cv_malloc_sizeof_addr}" = "${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}"; then
296   AC_MSG_RESULT( (cached) yes)
297else
298AC_TRY_RUN([
[e078e0]299#include <stdlib.h>
[be7466]300#include "$OM_MALLOC_HEADER"
301#ifdef OM_HAVE_MALLOC_SOURCE
302#include "$OM_MALLOC_SOURCE"
303#endif
304
305main()
306{
307  void* addr = OM_MALLOC_MALLOC(512);
308  if (OM_MALLOC_SIZEOF_ADDR(addr) < 512)
309    exit(1);
310  exit(0);
311}
312], ac_cv_malloc_sizeof_addr="${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}", ac_cv_malloc_sizeof_addr=no, ac_cv_malloc_sizeof_addr=no)
313if test "${ac_cv_malloc_sizeof_addr}" = no; then
314AC_MSG_RESULT(no)
315else
316AC_MSG_RESULT(yes)
317fi
318fi
319if test "$ac_cv_malloc_sizeof_addr" != no; then
[97b5d5]320AC_DEFINE(OM_MALLOC_PROVIDES_SIZEOF_ADDR,1,"Whether malloc provides SIZEOF_ADDR")
[be7466]321fi
[8d0069]322
[adb2ed]323dnl Restore user-specified CFLAGS, CXXFLAGS, LIBS
324
325CFLAGS=$BACKUP_CFLAGS
326CXXFLAGS=$BACKUP_CXXFLAGS
327LDFLAGS=$BACKUP_LDFLAGS
328
[be7466]329dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
330dnl check whether valloc is provided and that it works
331dnl
332AC_MSG_CHECKING(whether working valloc exists)
333if test "${ac_cv_working_valloc}" = no; then
334  AC_MSG_RESULT( (cached) no)
335elif test "${ac_cv_working_valloc}" = "${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}"; then
336  AC_MSG_RESULT( (cached) yes)
337else
338AC_TRY_RUN([
[e078e0]339#include <stdlib.h>
[be7466]340#include "$OM_MALLOC_HEADER"
341#ifdef OM_HAVE_MALLOC_SOURCE
342#include "$OM_MALLOC_SOURCE"
343#endif
344
345main()
346{
347  void* addr = OM_MALLOC_VALLOC(128*${ac_cv_pagesize});
348  if (addr == 0 || ((unsigned long) addr % ${ac_cv_pagesize}))
349    exit(1);
350  OM_MALLOC_VFREE(addr, 128*${ac_cv_pagesize});
351  exit(0);
352}
353], ac_cv_working_valloc="${OM_MALLOC_HEADER}_${OM_MALLOC_SOURCE}", ac_cv_working_valloc=no, ac_cv_working_valloc=no)
354if test "${ac_cv_working_valloc}" = no; then
355AC_MSG_RESULT(no)
356else
357AC_MSG_RESULT(yes)
358fi
359fi
360
361dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
362dnl for valloc
363dnl
364AC_MSG_CHECKING(which valloc to use)
365if test "${with_valloc+set}" != set || test "${with_valloc}" = mmap; then
366  if test "${ac_cv_working_mmap}" = yes; then
367    with_valloc=mmap
[97b5d5]368    AC_DEFINE(OM_HAVE_VALLOC_MMAP,1,"Have valloc")
[be7466]369  else
370    with_valloc=malloc
371  fi
372fi
373if test "${with_valloc}" = malloc; then
[d83977]374  if test "${ac_cv_working_valloc}" != no; then
[97b5d5]375    AC_DEFINE(OM_HAVE_VALLOC_MALLOC,1,"Have valloc")
[be7466]376  else
377    with_valloc=emulate
378  fi
379fi
380AC_MSG_RESULT($with_valloc)
381
382dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[8d0069]383dnl alignment
[be7466]384dnl
385AC_MSG_CHECKING(how to align)
386if test "$with_align" = 8 || test "$ac_cv_sizeof_long" = 8; then
387  ac_cv_align=8
[97b5d5]388  AC_DEFINE(OM_ALIGN_8,1,"Align to 8 bytes")
[be7466]389else
390if test "$ac_cv_align_need_strict" = "yes" || test "$with_align" = "strict"; then
[97b5d5]391  AC_DEFINE(OM_ALIGNMENT_NEEDS_WORK,1,"Whether alignment needs work")
[be7466]392  ac_cv_align="strict"
393else
394  ac_cv_align="sloppy"
[8d0069]395fi
[be7466]396fi
397AC_MSG_RESULT($ac_cv_align)
398
399dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
400dnl dense bins
401dnl
402AC_MSG_CHECKING(whether to use dense bins)
403if test "$with_dense_bins" = yes; then
404AC_MSG_RESULT(yes)
[97b5d5]405AC_DEFINE(OM_HAVE_DENSE_BIN_DISTRIBUTION,1,"Whether we have dense bins")
[be7466]406else
407AC_MSG_RESULT(no)
408fi
409
410dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
411dnl debug and inline
412dnl
[3df5b10]413AC_MSG_CHECKING(whether to disable debugging)
414if test "$with_debug" != no; then
415AC_MSG_RESULT(no)
416else
417AC_MSG_RESULT(yes)
[97b5d5]418AC_DEFINE(OM_NDEBUG,1,"Disable debug")
[3df5b10]419with_track=no
420fi
421
422AC_MSG_CHECKING(whether to have tracking debug functionality)
423if test "$with_track" != no; then
424AC_MSG_RESULT(yes)
[97b5d5]425AC_DEFINE(OM_HAVE_TRACK,1,"Have track")
[3df5b10]426else
427AC_MSG_RESULT(no)
428fi
429
[be7466]430AC_MSG_CHECKING(whether to use internal debug)
431if test "$with_internal_debug" = yes; then
432AC_MSG_RESULT(yes)
[97b5d5]433AC_DEFINE(OM_INTERNAL_DEBUG,1,"Internal debug")
[be7466]434with_inline=no
435else
436AC_MSG_RESULT(no)
437fi
438
439AC_MSG_CHECKING(whether to inline)
440if test "$ac_cv_c_inline" != no && test "$with_inline" != no; then
[97b5d5]441  AC_DEFINE_UNQUOTED(OM_INLINE, static $ac_cv_c_inline, "inline-declaration")
442  AC_DEFINE_UNQUOTED(OM_INLINE_DECL, static $ac_cv_c_inline, "inline-declaration")
443  AC_DEFINE_UNQUOTED(OM_INLINE_IMPL, static $ac_cv_c_inline, "inline-declaration")
444  AC_DEFINE_UNQUOTED(OM_INLINE_LOCAL, static $ac_cv_c_inline, "inline-declaration")
[be7466]445  AC_MSG_RESULT(yes)
446else
[97b5d5]447  AC_DEFINE_UNQUOTED(OM_INLINE_DECL, extern, "inline-declaration")
448  AC_DEFINE_UNQUOTED(OM_INLINE_IMPL,, "inline-declaration")
449  AC_DEFINE_UNQUOTED(OM_INLINE_LOCAL, static, "inline-declaration")
[be7466]450  AC_MSG_RESULT(no)
451fi
452
453dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[3df5b10]454dnl backtrace business
[be7466]455dnl
[3df5b10]456AC_MSG_CHECKING(whether GET_RET_ADDR works)
457AC_CACHE_VAL(ac_cv_get_return_addr_works,
[66502b8]458AC_TRY_RUN([
[e078e0]459#include <stdlib.h>
[3df5b10]460#include "omReturn.h"
[66502b8]461int test_return_addr()
462{
[3df5b10]463  char* f;
464  GET_RET_ADDR(f);
[e078e0]465  return (int)(long) f;
[66502b8]466}
467int main()
468{
[3df5b10]469   exit(! test_return_addr());
[66502b8]470}
[8d0069]471], ac_cv_get_return_addr_works=yes,
[3df5b10]472   ac_cv_get_return_addr_works=no,
473   ac_cv_get_return_addr_works=no))
474AC_MSG_RESULT($ac_cv_get_return_addr_works)
475if test "$ac_cv_get_return_addr_works" = yes; then
[97b5d5]476AC_DEFINE(OM_GET_RETURN_ADDR_WORKS,1, "Whether get return address works")
[3df5b10]477fi
478
479AC_MSG_CHECKING(whether omGetBackTrace works)
480AC_CACHE_VAL(ac_cv_get_backtrace_works,
[212fc04]481AC_TRY_RUN([
[3df5b10]482#include <stdio.h>
[e078e0]483#include <stdlib.h>
484#include "omGetBackTrace.c"
[3df5b10]485int test_backtrace()
[212fc04]486{
[3df5b10]487  void* bt;
488  int i = omGetBackTrace(&bt, 0, 10);
489  return i;
[212fc04]490}
491int main()
492{
[8d0069]493   int i;
[3df5b10]494   omInitGetBackTrace();
495   i = test_backtrace();
[8291be]496   if (i > 0) exit(0);
497   else exit(i+10);
[212fc04]498}
[8d0069]499], ac_cv_get_backtrace_works=yes,
[3df5b10]500   ac_cv_get_backtrace_works=no,
501   ac_cv_get_backtrace_works=no))
502AC_MSG_RESULT($ac_cv_get_backtrace_works)
503if test "$ac_cv_get_backtrace_works" = yes; then
[97b5d5]504AC_DEFINE(OM_GET_BACKTRACE_WORKS,1,"Whether omInitGetBackTrace () works")
[212fc04]505fi
506
[b98efa]507AC_MSG_CHECKING(whether addr2line works)
508AC_CACHE_VAL(ac_cv_prog_addr2line_works,
509AC_TRY_RUN([
[e078e0]510#include <stdlib.h>
[b98efa]511#undef OM_GET_BACKTRACE_WORKS
512#include "omReturn.h"
513#include "omStructs.h"
514#include "omGetBackTrace.h"
515#include "omRet2Info.c"
516
517int test_Ret_2_Info()
518{
519  void* bt;
520  int i;
521  struct omRetInfo_s info;
[8d0069]522
[b98efa]523  GET_RET_ADDR(bt);
524  i = omBackTrace_2_RetInfo(&bt, &info, 1);
525  return i;
526}
527
528int main(int argc, char** argv)
529{
530  int i;
531  omInitRet_2_Info(*argv);
532  i = test_Ret_2_Info();
533  if (i==1) exit(0);
534  else exit (i+10);
535}
[8d0069]536], ac_cv_prog_addr2line_works=yes,
[b98efa]537   ac_cv_prog_addr2line_works=no,
538   ac_cv_prog_addr2line_works=no))
539AC_MSG_RESULT($ac_cv_prog_addr2line_works)
[8d0069]540
[3df5b10]541AC_MSG_CHECKING(whether to track return addresses)
[444bcf]542if test "$with_track_return" = no || test "$ac_cv_get_return_addr_works" = no || test "$ac_cv_prog_addr2line_works" != yes; then
[3df5b10]543  with_track_return=no
[212fc04]544else
[97b5d5]545  AC_DEFINE(OM_TRACK_RETURN,1,"Whether to track return")
[3df5b10]546  with_track_return=yes
[212fc04]547fi
[3df5b10]548AC_MSG_RESULT($with_track_return)
[212fc04]549
[3df5b10]550AC_MSG_CHECKING(whether to track files and line numbers)
551if test "$with_track_fl" = no && test "$with_track_return" = no; then
552  with_track_fl=yes
553fi
[8d0069]554if test "${with_track_fl+set}" != set; then
[3df5b10]555  if test "$with_track_return" = yes; then
556    with_track_fl=no
557  else
558    with_track_fl=yes
559  fi
560fi
561AC_MSG_RESULT($with_track_fl)
[8d0069]562if test "$with_track_fl" = yes; then
[97b5d5]563  AC_DEFINE(OM_TRACK_FILE_LINE,1,"Whether to track file-line")
[66502b8]564fi
565
[3df5b10]566AC_MSG_CHECKING(whether to track stack backtraces)
[b98efa]567if 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]568  with_track_backtrace=yes
[97b5d5]569  AC_DEFINE(OM_TRACK_BACKTRACE,1,"Whether to track backtrace")
[3df5b10]570else
571  with_track_backtrace=no
572fi
573AC_MSG_RESULT($with_track_backtrace)
[fe7bd4]574
[8d0069]575AC_MSG_CHECKING(whether to track custom values)
[fe7bd4]576if test "$with_track" != no && test "$with_track_custom" = yes; then
[97b5d5]577  AC_DEFINE(OM_TRACK_CUSTOM,1,"Enable custom tracking")
[fe7bd4]578else
579  with_track_custom=no
580fi
581AC_MSG_RESULT($with_track_custom)
582
[fe6cc2]583dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
584dnl figure out the return type of sbrk
585dnl
586
587AC_MSG_CHECKING(return type of sbrk)
588AC_TRY_LINK(
589#define __USE_MISC
590#include <unistd.h>
591,
592void *sbrk();
593,
[97b5d5]594AC_DEFINE(Void_t,void,"Type of void"),
595AC_DEFINE(Void_t,char,"Type of void"),
[fe6cc2]596)
597AC_MSG_RESULT(Void_t)
598
599
[715936]600AC_DEFINE(OM_PROVIDE_MALLOC,0,[Provide NO standard routines!])
601
602
[fe6cc2]603
[be7466]604dnl lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
[3df5b10]605dnl wrap it up
[66502b8]606dnl
[c2eb2e]607AC_CONFIG_FILES([Makefile])
608AC_OUTPUT
[fe6cc2]609
Note: See TracBrowser for help on using the repository browser.