From a68ffae9e6c0accaa925972ec9d222f4e3340339 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Fri, 1 Jun 2012 18:20:18 +0000 Subject: [PATCH] gdb/ * configure.ac (development): Define new variable. Call AC_CHECK_LIB for mcheck if $development. (ERROR_ON_WARNING): Enable it by default only if $development. * config.in: Regenerate. * configure: Regenerate. --- gdb/ChangeLog | 8 ++++++++ gdb/config.in | 3 +++ gdb/configure | 50 ++++++++++++++++++++++++++++++++++++++++++++---- gdb/configure.ac | 14 ++++++++++++-- 4 files changed, 69 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 68600fb0287..84ec8f096eb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2012-06-01 Jan Kratochvil + + * configure.ac (development): Define new variable. + Call AC_CHECK_LIB for mcheck if $development. + (ERROR_ON_WARNING): Enable it by default only if $development. + * config.in: Regenerate. + * configure: Regenerate. + 2012-06-01 Siddhesh Poyarekar * target.c (target_read_memory): Make LEN argument as size_t. diff --git a/gdb/config.in b/gdb/config.in index a3bd8dddd1a..5767773a6af 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -201,6 +201,9 @@ /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM +/* Define to 1 if you have the `mcheck' library (-lmcheck). */ +#undef HAVE_LIBMCHECK + /* Define if Python 2.4 is being used. */ #undef HAVE_LIBPYTHON2_4 diff --git a/gdb/configure b/gdb/configure index f638268c2be..6e92ddfe4e7 100755 --- a/gdb/configure +++ b/gdb/configure @@ -7034,6 +7034,48 @@ fi +if $development; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmcheck" >&5 +$as_echo_n "checking for main in -lmcheck... " >&6; } +if test "${ac_cv_lib_mcheck_main+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmcheck $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_mcheck_main=yes +else + ac_cv_lib_mcheck_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mcheck_main" >&5 +$as_echo "$ac_cv_lib_mcheck_main" >&6; } +if test "x$ac_cv_lib_mcheck_main" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBMCHECK 1 +_ACEOF + + LIBS="-lmcheck $LIBS" + +fi + +fi + # Generate jit-reader.h # This is typedeffed to GDB_CORE_ADDR in jit-reader.h @@ -12300,8 +12342,8 @@ if test "${enable_werror+set}" = set; then : fi -# Enable -Werror by default when using gcc -if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then +# Enable -Werror by default when using gcc. Turn it off for releases. +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then ERROR_ON_WARNING=yes fi @@ -12805,7 +12847,7 @@ $as_echo "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; } elif test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works - # against Tcl.framework installed in an arbitary location. + # against Tcl.framework installed in an arbitrary location. case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then @@ -12920,7 +12962,7 @@ $as_echo "could not find ${TK_BIN_DIR}/tkConfig.sh" >&6; } elif test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works - # against Tk.framework installed in an arbitary location. + # against Tk.framework installed in an arbitrary location. case ${TK_DEFS} in *TK_FRAMEWORK*) if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then diff --git a/gdb/configure.ac b/gdb/configure.ac index d7409d0d6ef..5ae3a6b2c8a 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -18,6 +18,11 @@ dnl along with this program. If not, see . dnl Process this file with autoconf to produce a configure script. +dnl Provide more thorough testing by -lmcheck. +dnl Set it to 'true' for development snapshots, 'false' for releases or +dnl pre-releases. +development=true + AC_PREREQ(2.59)dnl AC_INIT(main.c) AC_CONFIG_HEADER(config.h:config.in) @@ -640,6 +645,11 @@ AC_SUBST(READLINE_DEPS) AC_SUBST(READLINE_CFLAGS) AC_SUBST(READLINE_TEXI_INCFLAG) +dnl -lmcheck provides cheap enough memory mangling for debugging purposes. +if $development; then + AC_CHECK_LIB(mcheck, main) +fi + # Generate jit-reader.h # This is typedeffed to GDB_CORE_ADDR in jit-reader.h @@ -1822,8 +1832,8 @@ AC_ARG_ENABLE(werror, *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;; esac]) -# Enable -Werror by default when using gcc -if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then +# Enable -Werror by default when using gcc. Turn it off for releases. +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then ERROR_ON_WARNING=yes fi -- 2.30.2