diff --git a/configure b/configure index a12f1f593..3b6124d15 100755 --- a/configure +++ b/configure @@ -10429,6 +10429,68 @@ then : fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing mallinfo2" >&5 +printf %s "checking for library containing mallinfo2... " >&6; } +if test ${ac_cv_search_mallinfo2+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char mallinfo2 (); +int +main (void) +{ +return mallinfo2 (); + ; + return 0; +} +_ACEOF +for ac_lib in '' malloc +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_mallinfo2=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_mallinfo2+y} +then : + break +fi +done +if test ${ac_cv_search_mallinfo2+y} +then : + +else $as_nop + ac_cv_search_mallinfo2=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_mallinfo2" >&5 +printf "%s\n" "$ac_cv_search_mallinfo2" >&6; } +ac_res=$ac_cv_search_mallinfo2 +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +printf "%s\n" "#define HAVE_MALLINFO2 1" >>confdefs.h + +fi + + diff --git a/configure.ac b/configure.ac index e05fb6b6c..45233bb57 100644 --- a/configure.ac +++ b/configure.ac @@ -892,6 +892,10 @@ AC_SEARCH_LIBS(sin, m) AC_SEARCH_LIBS(cblas_daxpy, gslcblas) AC_SEARCH_LIBS(gsl_version, gsl) +dnl mallinfo is optional; the code can compile (minus features) without it +AC_SEARCH_LIBS(mallinfo2,malloc,AC_DEFINE([HAVE_MALLINFO2],[1], + [Define if mallinfo2() is available on this platform.])) + dnl AC_CHECK_LIB(c, strsignal) dnl Checks for header files.