Re: [patch 35/39] add proper "--enable-debug" switch

"Aleksey Demakov" <[email protected]> Sun, 4 Feb 2007 14:05:31 +0600
Newsgroups gmane.comp.gnu.dotgnu.developer
Message-ID <[email protected]>
Hi Robert,

I do not think that there is much need for --enable-debug option
as configure allows to specify whatever CFALGS you like in the
command line:

./configure CFLAGS="-g -O0"

However if there are people who like it this might be ok.

But it seems that your patch intervenes not only in the case when
--enable-debug is provided but also when it does not,  That is it
overrides the -O option that might be specified in the command
line with -O2. I do not think this is any good as it goes against pretty
common way of specifying CFLAGS that is incidentally also what
I accustomed to.

Regards,
Aleksey

2007/2/4, Robert Schwebel <[email protected]>:
> This patch adds a proper --enable-debug switch which compiles with -O1
> (debugger friendly) and usually should also switch to -Werror. Because
> the dotgnu sources don't build without warnings yet, leave the latter
> one for now.
>
> FIXME: for the moment, dotgnu doesn't even work without -O0, so we
> disable optimization tweaking for now.
>
> Signed-off-by: Robert Schwebel <[email protected]>
>
>  configure.in |   51 +++++++++++++++++++++++++++++++++++----------------
>  1 file changed, 35 insertions(+), 16 deletions(-)
>
> Index: configure.in
> ===================================================================
> --- configure.in.orig
> +++ configure.in
> @@ -41,6 +41,27 @@ AC_SUBST(ILASM)
>
>  AC_PATH_PROG(SYSTEM_AR, ar)
>
> +
> +#
> +# Debugging
> +#
> +AC_MSG_CHECKING([whether to enable debugging])
> +AC_ARG_ENABLE(debug,
> +    AS_HELP_STRING([--enable-debug], [enable debugging @<:@default=yes@:>@]),
> +        [case "$enableval" in
> +        y | yes) CONFIG_DEBUG=yes ;;
> +        *) CONFIG_DEBUG=no ;;
> +    esac],
> +    [CONFIG_DEBUG=yes])
> +AC_MSG_RESULT([${CONFIG_DEBUG}])
> +if test "${CONFIG_DEBUG}" = "yes"; then
> +    CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wfloat-equal -Wformat-security -g -O0"
> +    AC_DEFINE(DEBUG, 1, [debugging])
> +else
> +    CFLAGS="${CFLAGS} -Wall -O2"
> +fi
> +
> +
>  dnl Option to disable cygwin1.dll under Windows.
>  dnl case "$host$" in
>  dnl    *-*-cygwin*) def_cygwin=false ;;
> @@ -217,16 +238,18 @@ AC_ARG_WITH(profile,
>         PROFILE_NAME=full
>  ])
>
> -#
> -# NOTE! This (--disable-optimizations argument) should be able to be removed when the gcc optimizer bug goes away.......
> -#
> -AC_ARG_ENABLE(optimizations,
> -[  --disable-optimizations disables all CFLAGS that have been passed into ./configure via the environment or
> -                          by the PROG_CC macro. The result is that CFLAGS is replaced by the default '-g'.
> -                          This is useful in bypassing the apparent bugs in gcc's optimizer.],
> -[
> -       CFLAGS="-g"
> -])
> +dnl FIXME RSC: this is complete bogus, isn't it?
> +dnl
> +dnl #
> +dnl # NOTE! This (--disable-optimizations argument) should be able to be removed when the gcc optimizer bug goes away.......
> +dnl #
> +dnl AC_ARG_ENABLE(optimizations,
> +dnl [  --disable-optimizations disables all CFLAGS that have been passed into ./configure via the environment or
> +dnl                           by the PROG_CC macro. The result is that CFLAGS is replaced by the default '-g'.
> +dnl                           This is useful in bypassing the apparent bugs in gcc's optimizer.],
> +dnl [
> +dnl    CFLAGS="-g"
> +dnl ])
>
>  dnl This code was borrowed from "libgc" to test for the correct
>  dnl thread package to use, and to notify the garbage collector's
> @@ -509,12 +532,8 @@ AC_TRY_COMPILE([], [
>  AC_MSG_RESULT($piccompgoto)
>
>  dnl Check to see if we are using gcc or not.
> -if test x$GCC = xyes ; then
> -       if test x$withjit = xyes ; then
> -               CFLAGS="$CFLAGS -fno-omit-frame-pointer -Wall"
> -       else
> -               CFLAGS="$CFLAGS -Wall"
> -       fi
> +if test x$GCC = xyes && test x$withjit = xyes; then
> +    CFLAGS="-fno-omit-frame-pointer $CFLAGS"
>  fi
>
>  dnl Check for "tm_gmtoff" in "struct tm".
>
> --
>  Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
>  Pengutronix - Linux Solutions for Science and Industry
>    Handelsregister:  Amtsgericht Hildesheim, HRA 2686
>      Hannoversche Str. 2, 31134 Hildesheim, Germany
>    Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
>
> _______________________________________________
> Developers mailing list
> [email protected]
> http://dotgnu.org/mailman/listinfo/developers
>