From 8bf58d7f2926133027d225114949a7fb7d85c683 Mon Sep 17 00:00:00 2001 From: rfm Date: Sun, 7 Oct 2012 13:48:51 +0000 Subject: [PATCH] check for mallinfo in -lmalloc git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@35649 72102866-910b-0410-8b05-ffd578937521 --- config.h.in | 3 +++ configure | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 2 ++ 3 files changed, 81 insertions(+) diff --git a/config.h.in b/config.h.in index 052afa7..e3c20eb 100644 --- a/config.h.in +++ b/config.h.in @@ -19,6 +19,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `malloc' library (-lmalloc). */ +#undef HAVE_LIBMALLOC + /* Define if you have libreadline */ #undef HAVE_LIBREADLINE diff --git a/configure b/configure index b094587..d82b99a 100755 --- a/configure +++ b/configure @@ -4222,6 +4222,82 @@ done +{ $as_echo "$as_me:$LINENO: checking for mallinfo in -lmalloc" >&5 +$as_echo_n "checking for mallinfo in -lmalloc... " >&6; } +if test "${ac_cv_lib_malloc_mallinfo+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmalloc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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. */ +#ifdef __cplusplus +extern "C" +#endif +char mallinfo (); +int +main () +{ +return mallinfo (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_malloc_mallinfo=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_malloc_mallinfo=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_malloc_mallinfo" >&5 +$as_echo "$ac_cv_lib_malloc_mallinfo" >&6; } +if test "x$ac_cv_lib_malloc_mallinfo" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBMALLOC 1 +_ACEOF + + LIBS="-lmalloc $LIBS" + +fi + + + # Check whether --with-readline was given. if test "${with_readline+set}" = set; then withval=$with_readline; diff --git a/configure.ac b/configure.ac index e8acbbf..750b664 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,8 @@ AC_TYPE_MODE_T AC_CHECK_FUNCS(getpid setpgid) +AC_CHECK_LIB([malloc],[mallinfo]) + AC_ARG_WITH([readline], [AS_HELP_STRING([--with-readline], [support fancy command line editing @<:@default=check@:>@])],