diff options
author | Pedro Alves <palves@redhat.com> | 2013-07-03 13:25:46 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2013-07-03 13:25:46 +0000 |
commit | 17ef446eed00c1b7c88863fe461c5859d271f77c (patch) | |
tree | 6cf13142bf1b75637738f9396c6d1d972e6fed63 /gdb/configure | |
parent | 5295321caf668a06255f545b8deb1fe97a9357d6 (diff) | |
download | gdb-17ef446eed00c1b7c88863fe461c5859d271f77c.zip gdb-17ef446eed00c1b7c88863fe461c5859d271f77c.tar.gz gdb-17ef446eed00c1b7c88863fe461c5859d271f77c.tar.bz2 |
On mainline/development, also link GDBserver with -lmcheck.
This factors --enable-libmcheck related bits from GDB's configure.ac
and makes GDBserver use them too. Specifically, the 'development'
global is moved to a separate script to it can be sourced by both GDB
and GDBserver, and the --enable-libmcheck/--disable-libmcheck bits
proper are moved to a new m4 file.
I started out by defining 'development' in the m4 file, but in the end
decided against it, as a separate script has the advantage that
changing it in release branches does not require regenerating
configure, unlike today.
I had also started out by making the new GDB_AC_LIBMCHECK itself
handle the yes/no default fallback depending on release/developement,
but since I had split out 'development' to a separate script, and, GDB
needs the python checks anyway (hence we'd need to do the python
checks in gdb's configure.ac, and pass in a 'default lmcheck yes/no'
parameter to GDB_AC_LIBMCHECK anyway), I ended up keeping
GDB_AC_LIBMCHECK isolated from the 'development' global. IOW, it's
the caller's business to handle it.
Tested on x86_64 Fedora 17. Built GDB and GDBserver with and without
--enable-libmcheck, and observed --enable-libmcheck overrides the
disablement of -lmcheck caused by python supporting threads, and that
GDBserver links with -lmcheck when expected. Also observed that
changing the 'development' global, and issuing "make" triggers a
relink, and '-lmcheck' is included or not from the link accordingly.
gdb/
2013-07-03 Pedro Alves <palves@redhat.com>
* Makefile.in (config.status): Depend on development.sh.
(aclocal_m4_deps): Add libmcheck.m4.
* acinclude.m4: Include libmcheck.m4.
* configure.ac: Source development.sh instead of setting
'development' here. --enable-libmcheck/--disable-libmcheck code
factored out to GDB_AC_LIBMCHECK. Run it.
* development.sh: New file.
* libmcheck.m4: New file.
* configure: Regenerate.
gdb/gdbserver/
2013-07-03 Pedro Alves <palves@redhat.com>
* Makefile.in (config.status): Depend on development.sh.
* acinclude.m4: Include libmcheck.m4.
* configure: Regenerate.
Diffstat (limited to 'gdb/configure')
-rwxr-xr-x | gdb/configure | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/gdb/configure b/gdb/configure index 822f2df..4833297 100755 --- a/gdb/configure +++ b/gdb/configure @@ -1480,7 +1480,7 @@ Optional Features: --enable-gdbtk enable gdbtk graphical user interface (GUI) --enable-profiling enable profiling of GDB --disable-rpath do not hardcode runtime library paths - --enable-libmcheck Try building GDB with -lmcheck if available + --enable-libmcheck Try linking with -lmcheck if available --enable-werror treat compile warnings as errors --enable-build-warnings enable build-time compiler warnings if gcc is used --enable-gdb-build-warnings @@ -2704,10 +2704,8 @@ fi -# Provide more thorough testing by -lmcheck. -# Set it to 'true' for development snapshots, 'false' for releases or -# pre-releases. -development=true +# Set the 'development' global. +. $srcdir/development.sh ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -8565,36 +8563,33 @@ fi -# Provide a --enable-libmcheck/--disable-libmcheck set of options -# allowing a user to enable this option even when building releases, -# or to disable it when building a snapshot. -# Check whether --enable-libmcheck was given. -if test "${enable_libmcheck+set}" = set; then : - enableval=$enable_libmcheck; case "${enableval}" in - yes | y) ENABLE_LIBMCHECK="yes" ;; - no | n) ENABLE_LIBMCHECK="no" ;; - *) as_fn_error "bad value ${enableval} for --enable-libmcheck" "$LINENO" 5 ;; - esac -fi - - # Enable -lmcheck by default (it provides cheap-enough memory mangling), # but turn it off if Python is enabled with threads, since -lmcheck is # not thread safe (http://sourceware.org/bugzilla/show_bug.cgi?id=9939), # and for releases. -if test -z "${ENABLE_LIBMCHECK}" \ - -a \( "${have_libpython}" = "no" \ - -o "${python_has_threads}" = "no" \) \ - && $development; then - ENABLE_LIBMCHECK=yes +if test \( "${have_libpython}" = "no" -o "${python_has_threads}" = "no" \) \ + && $development; then + libmcheck_default=yes +else + libmcheck_default=no fi -if test "$ENABLE_LIBMCHECK" = "yes" ; then - if test "${have_libpython}" != "no" -a "${python_has_threads}" = "yes" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-libmcheck may lead to spurious crashes if threads are used in python" >&5 -$as_echo "$as_me: WARNING: --enable-libmcheck may lead to spurious crashes if threads are used in python" >&2;} + # Check whether --enable-libmcheck was given. +if test "${enable_libmcheck+set}" = set; then : + enableval=$enable_libmcheck; case "${enableval}" in + yes | y) ENABLE_LIBMCHECK="yes" ;; + no | n) ENABLE_LIBMCHECK="no" ;; + *) as_fn_error "bad value ${enableval} for --enable-libmcheck" "$LINENO" 5 ;; + esac +fi + + + if test -z "${ENABLE_LIBMCHECK}"; then + ENABLE_LIBMCHECK=${libmcheck_default} fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmcheck" >&5 + + if test "$ENABLE_LIBMCHECK" = "yes" ; 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 @@ -8633,6 +8628,14 @@ _ACEOF fi + fi + + +if test "$ENABLE_LIBMCHECK" = "yes" \ + -a "${have_libpython}" != "no" \ + -a "${python_has_threads}" = "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-libmcheck may lead to spurious crashes if threads are used in python" >&5 +$as_echo "$as_me: WARNING: --enable-libmcheck may lead to spurious crashes if threads are used in python" >&2;} fi # ------------------------- # |