<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - configure script errors in llvm-3.3 and current trunk cause --enable-optimize to not be used and instead continue to use CFLAGS set by build environment"
   href="http://llvm.org/bugs/show_bug.cgi?id=16724">16724</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>configure script errors in llvm-3.3 and current trunk cause --enable-optimize to not be used and instead continue to use CFLAGS set by build environment
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>autoconf
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jeremyhu@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Found downstream: <a href="https://trac.macports.org/ticket/39761">https://trac.macports.org/ticket/39761</a>

If you set CFLAGS="-O2 -pipe" when configuring llvm, you'll see something like:
./configure: line 1990: -O2: command not found
./configure: line 1991: -O2: command not found

And -O2 will be preferred over the value passed to --enable-optimize

Those lines of the configure script are just:
${CFLAGS=}
${CXXFLAGS=}

which come from this in configure.ac:

dnl Default to empty (i.e. assigning the null string to) CFLAGS and CXXFLAGS,
dnl instead of the autoconf default (for example, '-g -O2' for CC=gcc).
${CFLAGS=}
${CXXFLAGS=}

which was a bug introduced by this commit:

commit 6c440fcea52e27b3befcf2ad5f7dcc58a15a2e58
Author: Patrik Hagglund <<a href="mailto:patrik.h.hagglund@ericsson.com">patrik.h.hagglund@ericsson.com</a>>
Date:   Mon Feb 4 08:15:53 2013 +0000

    Pass CPPFLAGS/CFLAGS/CXXFLAGS from the environment of configure to
    Makefile.config.

    This is implied at the bottom of the help text of configure (besides
    CC/CXX/LDFLAGS, already passed to Makefile.config).

    For backward compatibility, the values of CFLAGS and CXXFLAGS defaults
    to empty, overriding the default values provided by autoconf (for
    example, '-g -O2' when CC=gcc').

    $(CPP) is not used by our makefiles. Therefore, the value of CPP is
    not passed to Makefile.config, despite beeing mentioned by 'configure
    --help'.

    git-svn-id: <a href="https://llvm.org/svn/llvm-project/llvm/trunk@174313">https://llvm.org/svn/llvm-project/llvm/trunk@174313</a>
91177308-0d34-0410-b5e6-96231b3b80d8</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>