title: Statically Linking glib
body: <p>I'm trying to statically link glib into my C program.  I'm not sure what's the best way to do this.  I downloaded the code and put it in a subdirectory called glib-2.36.4.  I added "-Iglib-2.36.4" when using gcc.  The glib.h is in the glib-2.36.4/glib directory and in that file there are references to other header files under the glib directory (such as #include ).</p>
  
  <p>I'm not sure why that is since both glib.h and these other header files are at the same level (in glib subdirectory).  I got a compile error due to galloca.h not being found (even though it's there).  So I copied glib.h up one level and those errors went away.  I then got an error about a missing glibconfig.h.  I copied that from my usr directory and that error went away.  I compiled my project and now I'm getting an error about undefined reference to g_ptr_array_new.  I guess this must be because I haven't actually compiled glib.  I had tried to build glib, but when I typed "./configure", but I got this message:</p>
  
  <pre><code>checking if arpa/nameser_compat.h is needed... configure: error: could not compile test program either way
  </code></pre>
  
  <p>I did install glib using yum, but I really want this code to run even if glib is not installed on a machine.</p>