title: Intltool with an autoconf-generated .desktop file
body: <p>In the <a href="https://github.com/tjol/emperor" rel="nofollow">Emperor</a> project, I'm having some issues getting intltool to work when doing an out-of-tree build. When running <code>make check</code> out-of-tree, which is one of the things <code>make distcheck</code> does, intltool fails thus:</p>
  
  <pre><code>INTLTOOL_EXTRACT="/usr/bin/intltool-extract" XGETTEXT="/usr/bin/xgettext" srcdir=../../po /usr/bin/intltool-update --gettext-package emperor --pot
  can't open ../../po/../data/emperor.desktop.in: No such file or directory at /usr/bin/intltool-extract line 212.
  </code></pre>
  
  <p>intltool is looking for <code>emperor.desktop.in</code>, which is listed in <code>po/POTFILES.in</code>, in the source tree. However, <code>emperor.desktop.in</code> is generated by the configure script from a file called <code>emperor.desktop.in.in</code>, in order to insert the installed executable path as configured by the user, and lands in the build tree.</p>
  
  <p>These are the relevant <code>bootstrap.sh</code> lines:</p>
  
  <pre><code>echo +++ Running intltoolize ... &amp;&amp;
  intltoolize --force --copy &amp;&amp;
  cat &gt;&gt;po/Makefile.in.in &lt;&lt;EOF
  
  ../data/_column_names.h:
      cd ../data &amp;&amp; \$(MAKE) _column_names.h
  
  EOF
  </code></pre>
  
  <p>The setup code in <code>configure.ac</code>:</p>
  
  <pre><code>IT_PROG_INTLTOOL([0.35.0])
  
  GETTEXT_PACKAGE=emperor
  AC_SUBST(GETTEXT_PACKAGE)
  AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
                                        [The domain to use with gettext])
  AM_GLIB_GNU_GETTEXT
  </code></pre>
  
  <p><code>data/emperor.desktop.in</code> is listed in <code>AC_CONFIG_FILES</code>.</p>
  
  <p><code>data/Makefile.am</code> contains these lines:</p>
  
  <pre><code>desktopdir = $(datadir)/applications
  desktop_in_files = emperor.desktop.in
  desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
  @INTLTOOL_DESKTOP_RULE@
  </code></pre>
  
  <p>and <code>po/POTFILES.in</code> contains the line</p>
  
  <pre><code>data/emperor.desktop.in
  </code></pre>
  
  <p>You can review all the details in the <a href="https://github.com/tjol/emperor" rel="nofollow">public git repository</a> if you wish.</p>
  
  <p><strong>Can I somehow tell intltool that this file will be located in the build tree, not in the source tree?</strong> Otherwise, my options appear to be to break <code>make distcheck</code> (not a great option), or to ship a desktop file that doesn't include the full path and assumes that the executable is installed in the PATH. (just as messy, IMHO) - Any other options?</p>