You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Marc Singer <el...@buici.com> on 2003/09/02 20:18:41 UTC

[PATCH] fix for --enable-debug configuration option

I've looked deeper into the configure script and found that
--enable-debug is intended to do the trick.  What appears to be
missing is the setting of the -g switch.  This switch is supposed to
be set automatically, but is being blocked by the presence of other
options.  The attached patch moves the check for the C compiler to the
top of the configuration script which fixes the problem.

Index: configure.in
===================================================================
--- configure.in        (revision 6949)
+++ configure.in        (working copy)
@@ -49,6 +49,9 @@
 MKDIR="$INSTALL -d"
 AC_SUBST(MKDIR)
 
+dnl Look for a C compiler early so that we get the -g switch
+AC_PROG_CC
+
 dnl Grab our own macros
 sinclude(build/ac-macros/berkeley-db.m4)
 sinclude(build/ac-macros/svn-apache.m4)
@@ -175,9 +178,6 @@
 
 dnl Check for programs ---------------------
 
-dnl Look for a C compiler
-AC_PROG_CC
-
 dnl Look for a C pre-processor
 AC_PROG_CPP
 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: [PATCH] fix for --enable-debug configuration option

Posted by Philip Martin <ph...@codematters.co.uk>.
Marc Singer <el...@buici.com> writes:

> On Tue, Sep 02, 2003 at 10:34:51PM +0100, Philip Martin wrote:
>> Marc Singer <el...@buici.com> writes:
>> 
>> Patches should be sent to the dev list (I've set Mail-Followup-To),
>> ideally they would include a log message as well.  See the HACKING
>> file.
>
> I sent it there, too.  I'll read HACKING, too.

The message I saw only had
  To: users@subversion.tigris.org

>> > I've looked deeper into the configure script and found that
>> > --enable-debug is intended to do the trick.  What appears to be
>> > missing is the setting of the -g switch.  This switch is supposed to
>> > be set automatically, but is being blocked by the presence of other
>> > options.  The attached patch moves the check for the C compiler to the
>> > top of the configuration script which fixes the problem.
>> 
>> I don't understand your explanation of the problem, or your
>> explanation of the solution.  What does "being blocked by the presence
>> of other options" mean?
>
> The compiler check script has the following fragment:
>
>      if test "$ac_test_CFLAGS" = set; then
>        CFLAGS=$ac_save_CFLAGS
>      elif test $ac_cv_prog_cc_g = yes; then
>        if test "$GCC" = yes; then
> 	 CFLAGS="-g -O2"
>        else
> 	 CFLAGS="-g"
>        fi
>      else
>        if test "$GCC" = yes; then
> 	 CFLAGS="-O2"
>        else
> 	 CFLAGS=
>        fi
>      fi
>
> which means that if $ac_save_CFLAGS is not empty, set CFLAGS to that
> value, otherwise set -O2 and -g accordingly.  Normally, CFLAGS is
> empty when ./configure is executed and so the -g flag is set.
> However, earlier in the configuration script there is the line
>
>   CFLAGS="$CFLAGS `$apr_config --cflags`"

I understand now.  On my system that sets CFLAGS to "-g -O2 -pthread",
which explains why it "works for me".

> which makes CFLAGS non-empty.  That's what 'blocks' the setting of -g
> and -O2 by the compiler check.n
>
>> With your patch I get I get
>> 
>> CFLAGS = -g -O2  -g -O2 -pthread  -DNEON_ZLIB -DNEON_SSL $(EXTRA_CFLAGS)
>> 
>> which doesn't seem right.
>>
>> I don't have apr, apr-util, db or neon in the Subversion build tree,
>> do you?  Is that making the difference?
>
> That's part of the problem.  It is odd that you'd get two copies of
> the switches unless CFLAGS is set in your environment.

I see now, the AC_PROG_CC provides the first "-g -O2" and the
apr_config line you identifed above adds the second "-g -O2".

I agree that you have identified a problem, but I'm not enough of an
autoconf expert to be able to say your solution is correct.  I wonder
if it would be better if the files in build/ac-macros/ didn't set any
of CFLAGS, CPPFLAGS, LDFLAGS, etc. Instead they could set things like
SVN_APR_CFLAGS, SVN_BDB_CPPFLAGS, etc. and later these new variables
could be combined with the CFLAGS etc.

I guess it's possible CPPFLAGS getting set could have a similar effect
on AC_PROG_CPP.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] fix for --enable-debug configuration option

Posted by Marc Singer <el...@buici.com>.
On Tue, Sep 02, 2003 at 10:34:51PM +0100, Philip Martin wrote:
> Marc Singer <el...@buici.com> writes:
> 
> Patches should be sent to the dev list (I've set Mail-Followup-To),
> ideally they would include a log message as well.  See the HACKING
> file.

I sent it there, too.  I'll read HACKING, too.

> > I've looked deeper into the configure script and found that
> > --enable-debug is intended to do the trick.  What appears to be
> > missing is the setting of the -g switch.  This switch is supposed to
> > be set automatically, but is being blocked by the presence of other
> > options.  The attached patch moves the check for the C compiler to the
> > top of the configuration script which fixes the problem.
> 
> I don't understand your explanation of the problem, or your
> explanation of the solution.  What does "being blocked by the presence
> of other options" mean?

The compiler check script has the following fragment:

     if test "$ac_test_CFLAGS" = set; then
       CFLAGS=$ac_save_CFLAGS
     elif test $ac_cv_prog_cc_g = yes; then
       if test "$GCC" = yes; then
	 CFLAGS="-g -O2"
       else
	 CFLAGS="-g"
       fi
     else
       if test "$GCC" = yes; then
	 CFLAGS="-O2"
       else
	 CFLAGS=
       fi
     fi

which means that if $ac_save_CFLAGS is not empty, set CFLAGS to that
value, otherwise set -O2 and -g accordingly.  Normally, CFLAGS is
empty when ./configure is executed and so the -g flag is set.
However, earlier in the configuration script there is the line

  CFLAGS="$CFLAGS `$apr_config --cflags`"

which makes CFLAGS non-empty.  That's what 'blocks' the setting of -g
and -O2 by the compiler check.n

> With your patch I get I get
> 
> CFLAGS = -g -O2  -g -O2 -pthread  -DNEON_ZLIB -DNEON_SSL $(EXTRA_CFLAGS)
> 
> which doesn't seem right.
>
> I don't have apr, apr-util, db or neon in the Subversion build tree,
> do you?  Is that making the difference?

That's part of the problem.  It is odd that you'd get two copies of
the switches unless CFLAGS is set in your environment.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] fix for --enable-debug configuration option

Posted by Philip Martin <ph...@codematters.co.uk>.
Marc Singer <el...@buici.com> writes:

Patches should be sent to the dev list (I've set Mail-Followup-To),
ideally they would include a log message as well.  See the HACKING
file.

> I've looked deeper into the configure script and found that
> --enable-debug is intended to do the trick.  What appears to be
> missing is the setting of the -g switch.  This switch is supposed to
> be set automatically, but is being blocked by the presence of other
> options.  The attached patch moves the check for the C compiler to the
> top of the configuration script which fixes the problem.

I don't understand your explanation of the problem, or your
explanation of the solution.  What does "being blocked by the presence
of other options" mean?

If I run ./configure without your patch I get a Makefile that includes

CFLAGS =   -g -O2 -pthread  -DNEON_ZLIB -DNEON_SSL $(EXTRA_CFLAGS)

so I get -g without passing --enable-debug.  (If I pass --disable-debug
the -g flag gets removed.)

With your patch I get I get

CFLAGS = -g -O2  -g -O2 -pthread  -DNEON_ZLIB -DNEON_SSL $(EXTRA_CFLAGS)

which doesn't seem right.

I don't have apr, apr-util, db or neon in the Subversion build tree,
do you?  Is that making the difference?


> Index: configure.in
> ===================================================================
> --- configure.in        (revision 6949)
> +++ configure.in        (working copy)
> @@ -49,6 +49,9 @@
>  MKDIR="$INSTALL -d"
>  AC_SUBST(MKDIR)
>  
> +dnl Look for a C compiler early so that we get the -g switch
> +AC_PROG_CC
> +
>  dnl Grab our own macros
>  sinclude(build/ac-macros/berkeley-db.m4)
>  sinclude(build/ac-macros/svn-apache.m4)
> @@ -175,9 +178,6 @@
>  
>  dnl Check for programs ---------------------
>  
> -dnl Look for a C compiler
> -AC_PROG_CC
> -
>  dnl Look for a C pre-processor
>  AC_PROG_CPP

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] fix for --enable-debug configuration option

Posted by Philip Martin <ph...@codematters.co.uk>.
Marc Singer <el...@buici.com> writes:

Patches should be sent to the dev list (I've set Mail-Followup-To),
ideally they would include a log message as well.  See the HACKING
file.

> I've looked deeper into the configure script and found that
> --enable-debug is intended to do the trick.  What appears to be
> missing is the setting of the -g switch.  This switch is supposed to
> be set automatically, but is being blocked by the presence of other
> options.  The attached patch moves the check for the C compiler to the
> top of the configuration script which fixes the problem.

I don't understand your explanation of the problem, or your
explanation of the solution.  What does "being blocked by the presence
of other options" mean?

If I run ./configure without your patch I get a Makefile that includes

CFLAGS =   -g -O2 -pthread  -DNEON_ZLIB -DNEON_SSL $(EXTRA_CFLAGS)

so I get -g without passing --enable-debug.  (If I pass --disable-debug
the -g flag gets removed.)

With your patch I get I get

CFLAGS = -g -O2  -g -O2 -pthread  -DNEON_ZLIB -DNEON_SSL $(EXTRA_CFLAGS)

which doesn't seem right.

I don't have apr, apr-util, db or neon in the Subversion build tree,
do you?  Is that making the difference?


> Index: configure.in
> ===================================================================
> --- configure.in        (revision 6949)
> +++ configure.in        (working copy)
> @@ -49,6 +49,9 @@
>  MKDIR="$INSTALL -d"
>  AC_SUBST(MKDIR)
>  
> +dnl Look for a C compiler early so that we get the -g switch
> +AC_PROG_CC
> +
>  dnl Grab our own macros
>  sinclude(build/ac-macros/berkeley-db.m4)
>  sinclude(build/ac-macros/svn-apache.m4)
> @@ -175,9 +178,6 @@
>  
>  dnl Check for programs ---------------------
>  
> -dnl Look for a C compiler
> -AC_PROG_CC
> -
>  dnl Look for a C pre-processor
>  AC_PROG_CPP

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org