title: Use autotools installation prefix
body: <p>I am writing a C++ program using gtkmm as the window library and autotools as my build system. In my Makefile.am, I install the icon as follows:</p>
  
  <pre><code>icondir = $(datadir)/icons/hicolor/scalable/apps
  icon_DATA = $(top_srcdir)/appname.svg
  </code></pre>
  
  <p><strong>EDIT</strong>: changed from <code>prefix</code> to <code>datadir</code></p>
  
  <p>This results in <code>appname.svg</code> being copied to <code>$(datadir)/icons/hicolor/scalable/apps</code> when the program is installed. In my C++ code, I would like to access the icon at runtime for a window decoration:</p>
  
  <pre><code>string iconPath = DATADIR + "/icons/hicolor/scalable/apps/appname.svg";
  // do stuff with the icon
  </code></pre>
  
  <p>I am unsure how to go about obtaining <code>DATADIR</code> for this purpose. I could use relative paths, but then moving the binary would break the icon, which seems evident of hackery. I figure that there <em>should</em> be a special way to handle icons separate from general data, since people can install 3rd party icon packs. So, I have two questions:</p>
  
  <ol>
  <li>What is the standard way of installing <strike>and using</strike> icons with autotools/C++<strike>/gtkmm</strike>?</li>
  </ol>
  
  <p><strong>Edit</strong>: gtkmm has an <a href="https://developer.gnome.org/gtkmm/stable/classGtk_1_1IconTheme.html" rel="nofollow noreferrer">IconTheme</a> class that is the standard way to use icons in gtkmm. It appears that I <code>add_resource_path()</code> (for which I still need the installation prefix), and then I can use the library to obtain the icon by name.</p>
  
  <ol start="2">
  <li>What is the general method with autotools/C++ to access the autotools installation prefix?</li>
  </ol>