source: box/trunk/infrastructure/m4/ax_check_malloc_workaround.m4 @ 2327

Revision 2327, 1.2 KB checked in by jamesog, 4 years ago (diff)

Update autoconf to silence warnings on autoconf >= 2.62

  • AC_SUBST now only works with one variable per call
  • When using AC_CACHE the variable must contain the string '_cv_', thus prefix all cache variables with box_cv_
  • Property svn:eol-style set to native
Line 
1dnl @synopsis AX_CHECK_MALLOC_WORKAROUND
2dnl
3dnl This macro will see if there is a potential STL memory leak, and if we can
4dnl work around it will define __USE_MALLOC as the fix.
5dnl
6dnl @category C
7dnl @author Martin Ebourne
8dnl @version 2005/07/12
9dnl @license AllPermissive
10
11AC_DEFUN([AX_CHECK_MALLOC_WORKAROUND], [
12  if test "x$GXX" = "xyes"; then
13    AC_CACHE_CHECK([for gcc version 3 or later], [box_cv_gcc_3_plus],
14      [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
15          #if __GNUC__ < 3
16          #error "Old GNU C"
17          #endif
18          ]])],
19      [box_cv_gcc_3_plus=yes], [box_cv_gcc_3_plus=no]
20    )])
21    if test "x$box_cv_gcc_3_plus" = "xno"; then
22      AC_CACHE_CHECK([for malloc workaround], [box_cv_malloc_workaround],
23        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
24            #define __USE_MALLOC
25            #include <string>
26          ]], [[
27            std::string s;
28            s = "test";
29        ]])],
30        [box_cv_malloc_workaround=yes], [box_cv_malloc_workaround=no]
31      )])
32      if test "x$box_cv_malloc_workaround" = "xyes"; then
33        AC_DEFINE([__USE_MALLOC], 1,
34                  [Define to 1 if __USE_MALLOC is required work around STL memory leaks])
35      fi
36    fi
37  fi
38  ])dnl
Note: See TracBrowser for help on using the repository browser.