title: Compiling C program that uses a library
body: <p>I've made a C program that uses <a href="http://www.mega-nerd.com/libsndfile/" rel="nofollow">libsndfile</a> to extract some data from audio files.</p>
  
  <p>What possibilities are there to make the program as portable as possible, preferably without requiring root access when installing?</p>
  
  <p>Libsndfile is not available at the target machines, so i need to somehow package it with my program. Is there a way to statically link the library? I've also looked at some Autotools tutorials, but I'm not sure how to proceed.</p>
  
  <p>I can compile without a hitch on my dev machine, where I installed the libraries using the package manager: <code>apt-get install libsnfile1-dev</code></p>
  
  <p>The makefile is very simple:</p>
  
  <pre><code>CFLAGS=-std=c99 -Wall -pedantic -g
  CLIBS= -lsndfile -lm
  BIN=audiodecode
  CC=gcc
  
  MAIN=main.o
  
  FILES=
  
  OBJS=$(FILES) $(MAIN)
  
  .PHONY: all
  all: clean $(OBJS)
      $(CC) $(CFLAGS) -o $(BIN) $(OBJS) $(CLIBS)
  
  .PHONY: clean
  clean:
      rm -f *.o $(BIN)
  </code></pre>