Why is the luarocks makefile failing to find my lua interpreter?
<p>I'm trying to install luarocks to a custom location.  I've downloaded the latest tarball (v2.3.0) and run the following <code>./configure</code> command:</p>
<pre><code># OPENRESTY_PREFIX is set to /opt/openresty
./configure --prefix=$OPENRESTY_PREFIX \
            --with-lua=$OPENRESTY_PREFIX/luajit \
            --with-lua-include=$OPENRESTY_PREFIX/luajit/include \
            --with-lua-lib=$OPENRESTY_PREFIX/lualib
</code></pre>
<p>This produces the following error:</p>
<pre><code>Checking Lua interpreter... lua not found (looked in =/opt/openresty/luajit/bin)
You may want to use the flag --with-lua or --with-lua-bin. See --help.

configure failed.
</code></pre>
<p>I first checked that <code>/opt/openresty/luajit/bin/lua</code> properly invoked the interpreter, which is the case.  I then inspected the contents of <code>/opt/openresty/luajit/bin</code> and found the following:</p>
<pre><code>$ ls -al /opt/openresty/luajit/bin/
total 2860
drwxr-xr-x 2 root root    4096 Jan  9 14:05 .
drwxr-xr-x 6 root root    4096 Jan  9 14:05 ..
lrwxrwxrwx 1 root root      44 Jan  9 14:05 lua -&gt; /opt/openresty/luajit/bin/luajit-2.1.0-beta1
lrwxrwxrwx 1 root root      18 Jan  9 14:05 luajit -&gt; luajit-2.1.0-beta1
-rwxr-xr-x 1 root root 2918392 Jan  9 14:05 luajit-2.1.0-beta1
</code></pre>
<p>As we can see, <code>lua</code> and <code>luajit</code> are symlinks that point to <code>luajit-2.1.0-beta1</code>.  I figured that <code>make</code> was perhaps struggling with the symlinks, so I tried running the original command with <code>--lua-suffix=jit-2.1.0-beta1</code></p>
<p>I obtain a similar error message, so it appears that even when pointing to the &quot;real&quot; file, <code>make</code> is getting tripped up:</p>
<pre><code>Checking Lua interpreter... luajit-2.1.0-beta1 not found (looked in =/opt/openresty/luajit/bin)
You may want to use the flag --with-lua or --with-lua-bin. See --help.

configure failed.
</code></pre>
<p>I'm clearly missing something fundamental, here.  What am I doing incorrectly?</p>
<h1>Supplementary Information</h1>
<h2>Build target</h2>
<p>I'm building against a <code>debian:jessie</code> docker image.  Here is the corresponding <code>Dockerfile</code>, in case it helps reveal the directory structure.</p>
<pre><code>FROM debian:jessie

# derived from https://github.com/ficusio/openresty/blob/master/debian/Dockerfile

RUN apt-get update &amp;&amp; apt-get install -y --no-install-recommends \
    curl perl make build-essential procps libreadline-dev libncurses5-dev libpcre3-dev libssl-dev

ENV CFLAGS '-O2'
ENV OPENRESTY_VERSION 1.9.7.1
ENV OPENRESTY_PREFIX /opt/openresty
ENV NGINX_PREFIX /opt/openresty/nginx
ENV VAR_PREFIX /var/nginx

# NginX prefix is automatically set by OpenResty to $OPENRESTY_PREFIX/nginx
# look for $ngx_prefix in https://github.com/openresty/ngx_openresty/blob/master/util/configure

RUN cd /tmp \
    &amp;&amp; echo &quot;==&gt; Downloading OpenResty...&quot; \
    &amp;&amp; curl -sSL http://openresty.org/download/ngx_openresty-${OPENRESTY_VERSION}.tar.gz | tar -xvz \
    &amp;&amp; echo &quot;==&gt; Configuring OpenResty...&quot; \
    &amp;&amp; cd ngx_openresty-* \
    &amp;&amp; readonly NPROC=$(grep -c ^processor /proc/cpuinfo 2&gt;/dev/null || 1) \
    &amp;&amp; echo &quot;using upto $NPROC threads&quot; \
    &amp;&amp; ./configure \
    --prefix=$OPENRESTY_PREFIX \
    --http-client-body-temp-path=$VAR_PREFIX/client_body_temp \
    --http-proxy-temp-path=$VAR_PREFIX/proxy_temp \
    --http-log-path=$VAR_PREFIX/access.log \
    --error-log-path=$VAR_PREFIX/error.log \
    --pid-path=$VAR_PREFIX/nginx.pid \
    --lock-path=$VAR_PREFIX/nginx.lock \
    --with-luajit \
    --with-pcre-jit \
    --with-ipv6 \
    --with-http_ssl_module \
    --without-http_scgi_module \
    -j${NPROC} \
    &amp;&amp; echo &quot;==&gt; Building OpenResty...&quot; \
    &amp;&amp; make -j${NPROC} \
    &amp;&amp; echo &quot;==&gt; Installing OpenResty...&quot; \
    &amp;&amp; make install \
    &amp;&amp; echo &quot;==&gt; Finishing...&quot; \
    &amp;&amp; ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/nginx \
    &amp;&amp; ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/openresty \
    &amp;&amp; ln -sf $OPENRESTY_PREFIX/bin/resty /usr/local/bin/resty \
    &amp;&amp; ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* $OPENRESTY_PREFIX/luajit/bin/lua \
    &amp;&amp; ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* /usr/local/bin/lua \
    &amp;&amp; apt-get remove -y make build-essential \
    &amp;&amp; rm -rf /tmp/ngx_openresty* \
    &amp;&amp; rm -rf /var/lib/apt/lists/*

WORKDIR $NGINX_PREFIX

# Example contents for the `nginx` directory can be found at:
# https://github.com/ficusio/openresty/tree/master/_example/nginx
ONBUILD RUN rm -rf conf/* html/*
ONBUILD COPY nginx $NGINX_PREFIX

CMD [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off; error_log /dev/stderr info;&quot;]
</code></pre>