<style>
/* Changing the layout to use less space for mobiles */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {
    #email-body { min-width: 30em !important; }
    #email-page { padding: 8px !important; }
    #email-banner { padding: 8px 8px 0 8px !important; }
    #email-avatar { margin: 1px 8px 8px 0 !important; padding: 0 !important; }
    #email-fields { padding: 0 8px 8px 8px !important; }
    #email-gutter { width: 0 !important; }
}
</style>
<div id="email-body">
<table id="email-wrap" align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#f0f0f0;color:#000000;width:100%;">
    <tr valign="top">
        <td id="email-page" style="padding:16px !important;">
            <table align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff;border:1px solid #bbbbbb;color:#000000;width:100%;">
                <tr valign="top">
                    <td bgcolor="#ffffff" style="background-color:#ffffff;color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;line-height:1;"><img src="https://shibboleth.net/images/shib_240x83.png" alt="" style="vertical-align:top;" /></td>
                </tr><tr valign="top">
    <td id="email-banner" style="padding:32px 32px 0 32px;">
        
                
        
        
            <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;">
    <tr valign="top">
        <td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;padding:0;">
                                        <img id="email-avatar" src="https://issues.shibboleth.net/jira/secure/useravatar?avatarId=10202" alt="" height="48" width="48" border="0" align="left" style="padding:0;margin: 0 16px 16px 0;" />
                        <div id="email-action" style="padding: 0 0 8px 0;font-size:12px;line-height:18px;">
                                    <a class="user-hover" rel="vtsji@idp.protectnetwork.org" id="email_vtsji@idp.protectnetwork.org" href="https://issues.shibboleth.net/jira/secure/ViewProfile.jspa?name=vtsji%40idp.protectnetwork.org" style="color:#326ca6;">vtsji@idp.protectnetwork.org</a>
     created <img src="https://issues.shibboleth.net/jira/images/icons/issuetypes/bug.png" height="16" width="16" border="0" align="absmiddle" alt="Bug"> <a style='color:#326ca6;text-decoration:none;' href='https://issues.shibboleth.net/jira/browse/SSPCPP-575'>SSPCPP-575</a>
            </div>
                        <div id="email-summary" style="font-size:16px;line-height:20px;padding:2px 0 16px 0;">
                <a style='color:#326ca6;text-decoration:none;' href='https://issues.shibboleth.net/jira/browse/SSPCPP-575'><strong>Source build w/memcached and/or fastcgi support fails</strong></a>
            </div>
                    </td>
    </tr>
</table>
    </td>
</tr>
<tr valign="top">
    <td id="email-fields" style="padding:0 32px 32px 32px;">
        <table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
            <tr valign="top">
                <td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Issue Type:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                <img src="https://issues.shibboleth.net/jira/images/icons/issuetypes/bug.png" height="16" width="16" border="0" align="absmiddle" alt="Bug">        Bug
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Affects Versions:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                    2.5.1            </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Assignee:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                                        <a class="user-hover" rel="cantor.2@osu.edu" id="email_cantor.2@osu.edu" href="https://issues.shibboleth.net/jira/secure/ViewProfile.jspa?name=cantor.2%40osu.edu" style="color:#326ca6;">Scott Cantor</a>
                </td>
</tr>                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Components:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                    Installation / Packaging            </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Created:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        15/Jun/13 6:21 PM
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Description:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        <p style='margin-top:0;margin-bottom:10px;'>I'm building Shibboleth SP from source on RHEL 5.9 with support for the memcached storage provider, which is installed in a custom directory. I.e., I'm invoking configure like this:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
./configure --enable-apache-22
            --with-apxs22=/opt/apache/bin/apxs2
            ...
            --with-memcached=/home/ct-dist/mylibmemcached
</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>When adding the --with-memcached line the builds fails; otherwise it's fine.<br/>
I found two problems:</p>
<ol>
        <li>The memcached header presence check ran by <tt>./configure</tt> fails because the necessary <tt>-I</tt> flag is not on the command line. I've verified this in config.log:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
configure:20037: checking <span class="code-keyword">for</span> Memcached support
configure:20047: result: /home/ct-dist/mylibmemcached
configure:20057: checking libmemcached/memcached.h usability
configure:20057: g++ -c  -Wall  -I/home/ct-dist/mycurl/include  -g -D_DEBUG -I/home/ct-dist/myopensaml/include -I/home/ct-dist/myxmltooling/include -I/home/ct-dist/myxmlsecurityc/include -I/home/ct-dist/myxerces/include -I/home/ct-dist/mylog4shib/include -pthread -Wall -O0 -g -D_DEBUG -I/home/ct-dist/myboost/include -I/home/ct-dist/myopenssl/include  conftest.cpp &gt;&amp;5
conftest.cpp:88:36: error: libmemcached/memcached.h: No such file or directory
</pre>
</div></div></li>
        <li>The build inside memcache-store fails for the same reason: missing <tt>-I</tt> flag:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
make[2]: Entering directory `/home/ct-dist/shibboleth-sp-2.5.1/memcache-store'
<span class="code-keyword">if</span> /bin/sh ../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../shibsp   -I/home/ct-dist/myopensaml/include -I/home/ct-dist/myxmltooling/include -I/home/ct-dist/myxmlsecurityc/include -I/home/ct-dist/myxerces/include -I/home/ct-dist/mylog4sh
ib/include -pthread -Wall -O0 -g -D_DEBUG -I/home/ct-dist/myboost/include -I/home/ct-dist/myopenssl/include   -Wall  -I/home/ct-dist/mycurl/include  -g -D_DEBUG -MT memcache-store.lo -MD -MP -MF <span class="code-quote">".deps/memcache-store.Tpo"</span> -c -o memcache-store.lo memcache-store.cpp; \
        then mv -f <span class="code-quote">".deps/memcache-store.Tpo"</span> <span class="code-quote">".deps/memcache-store.Plo"</span>; <span class="code-keyword">else</span> rm -f <span class="code-quote">".deps/memcache-store.Tpo"</span>; exit 1; fi
memcache-store.cpp:45:36: error: libmemcached/memcached.h: No such file or directory
memcache-store.cpp:102: error: ISO C++ forbids declaration of 'memcached_st' with no type
memcache-store.cpp:102: error: expected ';' before '*' token
memcache-store.cpp:107: error: 'memcached_return' has not been declared
<span class="code-comment">// etc</span>
</pre>
</div></div></li>
</ol>


<p style='margin-top:0;margin-bottom:10px;'>I'm relatively new to autotools, but it seems to me like this is due to two separate issues with <tt>configure.ac</tt> and <tt>memcache-store/Makefile.am</tt>:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>configure.ac</b></div><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-comment">// ...
</span><span class="code-keyword">if</span> test <span class="code-quote">"$WANT_MEMCACHED"</span> != <span class="code-quote">"no"</span>; then 
    <span class="code-keyword">if</span> test <span class="code-quote">"$WANT_MEMCACHED"</span> != <span class="code-quote">"yes"</span>; then 
        <span class="code-keyword">if</span> test x_$WANT_MEMCACHED != x_/usr; then 
            MEMCACHED_INCLUDE=<span class="code-quote">"-I$WANT_MEMCACHED/include"</span>
            MEMCACHED_LDFLAGS=<span class="code-quote">"-L$WANT_MEMCACHED/lib"</span>
        fi   
    fi   
    AC_CHECK_HEADER([libmemcached/memcached.h],,
        AC_MSG_ERROR([unable to find Memcached header files]))
    AC_CHECK_DECL([memcached_last_error_message],
        [AC_DEFINE([HAVE_MEMCACHED_LAST_ERROR_MESSAGE],[1],[Define to 1 <span class="code-keyword">if</span> libmemcached supports error handling function.])],,
        [#include &lt;libmemcached/memcached.h&gt;])
    MEMCACHED_LIBS=<span class="code-quote">"-lmemcached"</span>
fi

AC_SUBST(MEMCACHED_INCLUDE)
AC_SUBST(MEMCACHED_LDFLAGS)
AC_SUBST(MEMCACHED_LIBS)
</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>For the first issue, notice that in <tt>configure.ac</tt> <tt>MEMCACHED_INCLUDE</tt> is not added to any variable contributing to the final g++ flags, thus leading to the necessary <tt>-I</tt> flag not being there at the time <tt>AC_CHECK_HEADER</tt> does its thing. Google tells me that common practice seems to be to temporarily add it to the <tt>CPPFLAGS</tt>; something like this:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>configure.ac'</b></div><div class="codeContent panelContent">
<pre class="code-java">
    save_CPPFLAGS=<span class="code-quote">"$CPPFLAGS"</span>
    save_LDFLAGS=<span class="code-quote">"$LDFLAGS"</span>
    CPPFLAGS=<span class="code-quote">"$CPPFLAGS $MEMCACHED_INCLUDE"</span>
    LDFLAGS=<span class="code-quote">"$LDFLAGS $MEMCACHED_LDFLAGS"</span>
    AC_CHECK_HEADER([libmemcached/memcached.h],,
        AC_MSG_ERROR([unable to find Memcached header files]))
    AC_CHECK_DECL([memcached_last_error_message],
        [AC_DEFINE([HAVE_MEMCACHED_LAST_ERROR_MESSAGE],[1],[Define to 1 <span class="code-keyword">if</span> libmemcached supports error handling function.])],,
        [#include &lt;libmemcached/memcached.h&gt;])
    CPPFLAGS=<span class="code-quote">"$save_CPPFLAGS"</span>
    LDFLAGS=<span class="code-quote">"$save_LDFLAGS"</span>
</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>This solved the missing header check for me, but I will leave its correctness up to your judgement.</p>

<p style='margin-top:0;margin-bottom:10px;'>For the second issue, the problem seems to be with <tt>memcache-store/Makefile.am</tt>:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>memcache-store/Makefile.am</b></div><div class="codeContent panelContent">
<pre class="code-java">
AM_CFLAGS = $(MEMCACHED_CFLAGS)
AM_CXXFLAGS = $(MEMCACHED_CFLAGS)
<span class="code-comment">//...
</span>memcache_store_la_LDFLAGS = -module -avoid-version
</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'><tt>MEMCACHED_CFLAGS</tt> appears nowhere else in the distribution tree, so it seems like that should've been <tt>MEMCACHED_INCLUDE</tt>. Also, <tt>MEMCACHED_LDFLAGS</tt> needs to be added to <tt>memcache_store_la_LDFLAGS</tt> as it contains the <tt>-L</tt> flag to allow the linker to find the libmemcached .so file:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>memcache-store/Makefile.am</b></div><div class="codeContent panelContent">
<pre class="code-java">
AM_CFLAGS = $(MEMCACHED_INCLUDE)
AM_CXXFLAGS = $(MEMCACHED_INCLUDE)
<span class="code-comment">//...
</span>memcache_store_la_LDFLAGS = -module -avoid-version $(MEMCACHED_LDFLAGS)
</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>Indeed, changing this and running autoreconf allowed the entire build to complete successfully again.</p>

<p style='margin-top:0;margin-bottom:10px;'>I've only looked at memcache-store, but looking at configure.ac it seems like the FastCGI support has the exact same logic as the memcached support in configure.ac, and may therefore exhibit the same issue of the required includes not being there during the header presence check. Additionally, <tt>fastcgi/Makefile.am</tt> includes the following lines:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-comment">// ...
</span>shibauthorizer_CXXFLAGS = -I$(FASTCGI_INCLUDE)
<span class="code-comment">// ...
</span>shibresponder_CXXFLAGS = -I$(FASTCGI_INCLUDE)
</pre>
</div></div>
<p style='margin-top:0;margin-bottom:10px;'>Since <tt>FASTCGI_INCLUDE</tt> already includes the <tt>-I</tt> prefix though, I suspect that the final command line will end up with something like this (unverified):</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
-I-I/path/to/fastcgi
</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>As a final issue unrelated to the above, while pouring over <tt>configure.ac</tt> I found the following bit:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
AC_ARG_WITH(saml,
    AS_HELP_STRING([--with-saml=PATH],[where opensaml is installed]),,
    [with_saml=/usr])
<span class="code-keyword">if</span> test x_$with_xmltooling != x_/usr; then 
    CPPFLAGS=<span class="code-quote">"-I${with_saml}/include $CPPFLAGS"</span>
<span class="code-comment">// ...</span>
</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>I think that should read:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
AC_ARG_WITH(...
<span class="code-keyword">if</span> test x_$with_saml != x_/usr; then 
    CPPFLAGS=<span class="code-quote">"-I${with_saml}/include $CPPFLAGS"</span>
</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>As I said, I'm new to autotools, so feel free to point out if and where I'm wrong, or suggest better ways of doing things.</p>
    </td>
</tr>
                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Environment:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        <p style='margin-top:0;margin-bottom:10px;'>Red Hat Enterprise Linux Server release 5.9 (Tikanga)<br/>
autoconf (GNU Autoconf) 2.59<br/>
automake (GNU automake) 1.9.6</p>
    </td>
</tr>
                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Project:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        <a style="color:#326ca6;" href="https://issues.shibboleth.net/jira/browse/SSPCPP">Shibboleth SP - C++</a>
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Labels:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                    configure.ac
                    memcached
            </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Priority:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                        <img src="https://issues.shibboleth.net/jira/images/icons/priorities/minor.png" height="16" width="16" border="0" align="absmiddle" alt="Minor">                Minor
    </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Reporter:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                                        <a class="user-hover" rel="vtsji@idp.protectnetwork.org" id="email_vtsji@idp.protectnetwork.org" href="https://issues.shibboleth.net/jira/secure/ViewProfile.jspa?name=vtsji%40idp.protectnetwork.org" style="color:#326ca6;">vtsji@idp.protectnetwork.org</a>
                </td>
</tr>                                                        <tr valign="top">
        <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
            <strong style="font-weight:normal;color:#505050;">Original Estimate:</strong>
        </td>
        <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
            1 hour
        </td>
    </tr>
    
        <tr valign="top">
        <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
            <strong style="font-weight:normal;color:#505050;">Remaining Estimate:</strong>
        </td>
        <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
            1 hour
        </td>
    </tr>
    
    
                        </table>
                </td>
            </tr>
        </table>
    </td>
</tr>













            </table>
        </td><!-- End #email-page -->
    </tr>
    <tr valign="top">
        <td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:10px;line-height:14px;padding: 0 16px 16px 16px;text-align:center;">
            This message is automatically generated by JIRA.<br />
            If you think it was sent incorrectly, please contact your JIRA administrators<br />
            For more information on JIRA, see: <a style='color:#326ca6;' href='http://www.atlassian.com/software/jira'>http://www.atlassian.com/software/jira</a>
        </td>
    </tr>
</table><!-- End #email-wrap -->
</div><!-- End #email-body -->