[sane-devel] autoconf/configure and debug

Reinhold Kainhofer reinhold at kainhofer.com
Tue Jun 14 20:44:05 UTC 2011

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<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>

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).

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

More information about the sane-devel mailing list