[sane-devel] autoconf/configure and debug

2011-06-15 Thread Olaf Meeuwissen
stef  writes:

>   in order to debug more efficiently, I have to re-edit Makefiles to 
> remove 
> the two -O2 options in CFLAGS and change the -g to the -ggdb option. Is there 
> an easy way to get CFLAGS=-ggdb  when configuring SANE ?

In addition to specifying CFLAGS at configure time, you can also give an
override at compile time, like so

  make CFLAGS="-ggdb -O0"

Of course, this will only affect those files that get recompiled but
with `make clean` (or selective removal of *.la and *.lo files) that
should be easy to control.

I use this approach quite a bit to avoid a time consuming configure step
and only override stuff for those files I want to focus on.

Hope this helps,
-- 
Olaf Meeuwissen, LPIC-2   FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962   Help support software freedom
 http://www.fsf.org/jf?referrer=1962



[sane-devel] autoconf/configure and debug

2011-06-14 Thread stef
Le mardi 14 juin 2011 22:57:01 Reinhold Kainhofer, vous avez ?crit :
> Am Dienstag, 14. Juni 2011, 22:32:25 schrieb Chris Bagwell:
> > configure will not default to CFLAGS="-g -O2" if you specify your own
> > value.  But if your getting two -O2 then something else may be adding
> > it as well.
> 
> Yes, the culprit is the net-snmp library...
> To get the include path for the net-snmp library, the binary
> "net-snmp-config" is called with --cflags and the result is appended to
> CFLAGS. Unfortunately,
> 
> reinhold at einstein:~$ net-snmp-config --cflags
> -g -O2 -Ulinux -Dlinux=linux -Wall -Wstrict-prototypes -Wwrite-strings
> -Wcast- qual -I. -I/home/reinhold/.build/include
> 
> Judging from the output of net-snmp-config --help, there is no other way to
> get the correct include pathes / libraries to link to net-snmp without
> dragging in all unneeded compiler flags...
> 
> Cheers,
> Reinhold

Hello,

Thanks for your help. By configuring with CFLAGS=-ggdb and 
--without-snmp 
I can do the debug I need without optimized out functions or variables.

Regards,
Stef



[sane-devel] autoconf/configure and debug

2011-06-14 Thread Reinhold Kainhofer
Am Dienstag, 14. Juni 2011, 22:32:25 schrieb Chris Bagwell:
> configure will not default to CFLAGS="-g -O2" if you specify your own
> value.  But if your getting two -O2 then something else may be adding
> it as well.

Yes, the culprit is the net-snmp library...
To get the include path for the net-snmp library, the binary "net-snmp-config" 
is called with --cflags and the result is appended to CFLAGS. Unfortunately,

reinhold at einstein:~$ net-snmp-config --cflags
-g -O2 -Ulinux -Dlinux=linux -Wall -Wstrict-prototypes -Wwrite-strings -Wcast-
qual -I. -I/home/reinhold/.build/include

Judging from the output of net-snmp-config --help, there is no other way to get 
the correct include pathes / libraries to link to net-snmp without dragging in 
all unneeded compiler flags...

Cheers,
Reinhold

-- 
--
Reinhold Kainhofer, reinhold at kainhofer.com, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org



[sane-devel] autoconf/configure and debug

2011-06-14 Thread Reinhold Kainhofer
Am Dienstag, 14. Juni 2011, 21:49:44 schrieb stef:
>   Hello,
> 
>   in order to debug more efficiently, I have to re-edit Makefiles to 
> remove
> the two -O2 options in CFLAGS and change the -g to the -ggdb option. Is
> there an easy way to get CFLAGS=-ggdb  when configuring SANE ?

Have you ever looked at "./configure --help" to find out what options the 
configure script supports? There you'll see:

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.
[...]
Some influential environment variables:
  CC  C compiler command
  CFLAGS  C compiler flags
  LDFLAGS linker flags, e.g. -L if you have libraries in a
  nonstandard directory 
  LIBSlibraries to pass to the linker, e.g. -l
[...]


So, it is sufficient to simply call the configure script as:
./configure CFLAGS=-ggdbg
(If CFLAGS is set, the configure script uses its value, otherwise it uses the 
default of "-g -O2", which is what you want to prevent).

Cheers,
Reinhold
-- 
--
Reinhold Kainhofer, reinhold at kainhofer.com, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org



[sane-devel] autoconf/configure and debug

2011-06-14 Thread stef
Hello,

in order to debug more efficiently, I have to re-edit Makefiles to 
remove 
the two -O2 options in CFLAGS and change the -g to the -ggdb option. Is there 
an easy way to get CFLAGS=-ggdb  when configuring SANE ?

Regards,
Stef



[sane-devel] autoconf/configure and debug

2011-06-14 Thread Chris Bagwell
On Tue, Jun 14, 2011 at 2:49 PM, stef  wrote:
> ? ? ? ?Hello,
>
> ? ? ? ?in order to debug more efficiently, I have to re-edit Makefiles to 
> remove
> the two -O2 options in CFLAGS and change the -g to the -ggdb option. Is there
> an easy way to get CFLAGS=-ggdb  when configuring SANE ?
>

I've not tried this with sane-backends but its supposed to be as simple as:

./configure CFLAGS=-ggdb

configure will not default to CFLAGS="-g -O2" if you specify your own
value.  But if your getting two -O2 then something else may be adding
it as well.

Chris