diff options
author | Reinhard Tartler <siretart@tauware.de> | 2007-02-14 09:01:45 +0100 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2007-02-14 09:01:45 +0100 |
commit | aa2943800f9c00823720af98da036813ebf5cd2c (patch) | |
tree | 099cc0264d32a36ab89aa3f48cbf34612c3cd225 /infrastructure/m4/ax_check_malloc_workaround.m4 |
initial commit
Diffstat (limited to 'infrastructure/m4/ax_check_malloc_workaround.m4')
-rw-r--r-- | infrastructure/m4/ax_check_malloc_workaround.m4 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/infrastructure/m4/ax_check_malloc_workaround.m4 b/infrastructure/m4/ax_check_malloc_workaround.m4 new file mode 100644 index 00000000..9b1c9848 --- /dev/null +++ b/infrastructure/m4/ax_check_malloc_workaround.m4 @@ -0,0 +1,38 @@ +dnl @synopsis AX_CHECK_MALLOC_WORKAROUND +dnl +dnl This macro will see if there is a potential STL memory leak, and if we can +dnl work around it will define __USE_MALLOC as the fix. +dnl +dnl @category C +dnl @author Martin Ebourne +dnl @version 2005/07/12 +dnl @license AllPermissive + +AC_DEFUN([AX_CHECK_MALLOC_WORKAROUND], [ + if test "x$GXX" = "xyes"; then + AC_CACHE_CHECK([for gcc version 3 or later], [gcc_3_plus], + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #if __GNUC__ < 3 + #error "Old GNU C" + #endif + ]])], + [gcc_3_plus=yes], [gcc_3_plus=no] + )]) + if test "x$gcc_3_plus" = "xno"; then + AC_CACHE_CHECK([for malloc workaround], [malloc_workaround], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define __USE_MALLOC + #include <string> + ]], [[ + std::string s; + s = "test"; + ]])], + [malloc_workaround=yes], [malloc_workaround=no] + )]) + if test "x$malloc_workaround" = "xyes"; then + AC_DEFINE([__USE_MALLOC], 1, + [Define to 1 if __USE_MALLOC is required work around STL memory leaks]) + fi + fi + fi + ])dnl |