title: debian/rules:161: recipe for target 'config.status' failed
body: <blockquote>
    <p>I had originally posted this few days ago on askubuntu @
    <a href="https://askubuntu.com/questions/1044708/debian-rules161-recipe-for-target-config-status-failed">https://askubuntu.com/questions/1044708/debian-rules161-recipe-for-target-config-status-failed</a></p>
    
    <p>Unfortunately, I failed to get any responses. Hence looking for some
    help on StackOverflow.</p>
  </blockquote>
  
  <p>I am trying to build a <code>deb</code> package for <code>collect-pw</code>. The upstream tar ball is: 
  <a href="http://perfwatcher.free.fr/download/collectd/collectd-5.4.0.20150311.tar.gz" rel="nofollow noreferrer">http://perfwatcher.free.fr/download/collectd/collectd-5.4.0.20150311.tar.gz</a></p>
  
  <p>For building this package, I pulled the source package for <code>collectd</code> from ubuntu repo and modified the package name under <code>debian/control</code> and <code>debian/changelog</code>. </p>
  
  <p>Now, when I run <code>pdebuild</code> (OR <code>debuild</code> for that sake), it fails with below error:</p>
  
  <pre><code>configure: exit 1
  debian/rules:161: recipe for target 'config.status' failed
  make: *** [config.status] Error 1
  dpkg-buildpackage: error: debian/rules build gave error exit status 2
  </code></pre>
  
  <p>I am not able to figure out what is wrong here. The error is a generic error.
  If I run <code>./configure</code>, <code>make</code>, then build goes fine.</p>
  
  <p>Here are relevant lines from <code>debian/rules</code></p>
  
  <pre><code>160 config.status: configure
  161         dh_testdir
  162
  163         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
  164         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  165                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
  166                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
  167                 || ( status=$$?; cat config.log; exit $$status )
  </code></pre>
  
  <p>Can you help with any pointers on what could be going wrong here? OR Any suggestion to make it provide <em>detailed error</em> would be helpful because 
  <code>configure: exit 1</code> does not give much insight to act upon.</p>
  
  <p>BTW, I have <code>export DH_VERBOSE=1</code> enabled in <code>debian/rules</code>.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>As suggested by @GiacomoCatenazzi:</p>
  
  <ul>
  <li>Yes, I can run <code>dh_testdir</code> successfully.</li>
  <li>I ran <code>make</code> with <code>debian/rules</code> as makefile and verbose enabled as <code>make -d -f debian/rules</code>. This time again it failed on the same <code>config.status</code> step with 2 more debug lines added which I could not understand. </li>
  </ul>
  
  <p>Here are the last few lines of output of above <code>make</code> command:</p>
  
  <pre><code>...
  ...
  ...
  #define HAVE_PLUGIN_VSERVER 1
  #define HAVE_PLUGIN_WIRELESS 1
  #define HAVE_PLUGIN_WRITE_GRAPHITE 1
  
  configure: exit 1
  Reaping losing child 0x1a103d0 PID 27476
  debian/rules:161: recipe for target 'config.status' failed
  make: *** [config.status] Error 1
  Removing child 0x1a103d0 PID 27476 from chain.
  </code></pre>
  
  <ul>
  <li>After running this, it created <code>config.log</code> which has about 30k lines.</li>
  </ul>
  
  <p>Last few lines of the log are as below:</p>
  
  <pre><code>29303 #define HAVE_PLUGIN_WIRELESS 1
  29304 #define HAVE_PLUGIN_WRITE_GRAPHITE 1
  29305
  29306 configure: exit 1
  </code></pre>
  
  <p>No helpful information here as well :(</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>As suggested by @Stephen Kitt, The entire <code>config.log</code> is available here: <a href="http://pasted.co/3767a043" rel="nofollow noreferrer">http://pasted.co/3767a043</a></p>