title: rpmbuild: How can I use rpmbuild tell autoconf or configure to disable a flag?
body: <p>I am running on a CentOS 5.7 system.</p>
  
  <p>I downloaded a source package and a .spec file from someone else. I am trying to build a RPM from the source using a vanilla command like:</p>
  
  <pre><code>% rpmbuild -ba ~/rpmbuild/SPECS/foo.spec
  ...
  Configuration summary:
  ======================
  
    Host type................: x86_64-redhat-linux-gnu
    CC.......................: gcc
    CFLAGS...................: -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Werror
  
    Package..................: sudosh2
    Version..................: 1.0.4
  
    Installation prefix......: /usr
    Man directory............: /usr/share/man
    sysconfdir...............: /etc
    recording input..........: no
  </code></pre>
  
  <p>However, this build is failing. The code is a little sloppy and is generating some warnings. Some part of this toolchain is enabling <code>-Werror</code> flag, which makes "<a href="http://linux.die.net/man/1/gcc" rel="nofollow">all warnings into errors</a>." Thus, the build fails with an error:</p>
  
  <pre><code>gcc -DHAVE_CONFIG_H -I. -I..     -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Werror -MT parse.o -MD -MP -MF .deps/parse.Tpo -c -o parse.o parse.c
  cc1: warnings being treated as errors
  sudosh.c: In function 'main':
  sudosh.c:486: warning: unused variable 'written'
  sudosh.c:112: warning: unused variable 'found'
  cc1: warnings being treated as errors
  parse.c: In function 'parse':
  parse.c:20: warning: unused variable 'y'
  parse.c:14: warning: unused variable 'opt'
  parse.c:14: warning: unused variable 'cmt'
  parse.c:14: warning: unused variable 'arg'
  parse.c:10: warning: unused variable 'i'
  parse.c:10: warning: unused variable 'line_number'
  make[2]: *** [sudosh.o] Error 1
  </code></pre>
  
  <p>I know the proper fix is for the author to fix the code, but I want to work around this problem in the short term. I need a working RPM.</p>
  
  <p>It looks like either <code>./configure</code> or <code>autoconf</code> is automatically adding the <code>-Werror</code> flag. How can I disable the <code>-Werror</code> flags for my builds, short of editing the Makefile myself?</p>
  
  <p>Update in response to @pwan's answer:</p>
  
  <p>The .spec file is pretty generic, and doesn't specify any special flags:</p>
  
  <pre><code>%build
  %configure \
      --program-prefix="%{?_program_prefix}"
  %{__make} %{?_smp_mflags}
  </code></pre>