title: Change build options for Mac vs. Linux in R package
body: <p>I'm creating an R package that uses a third-party (closed-source) API for importing .edf files into R (from SR Research Eyelink eye trackers). Someone who has already gotten this to work in Linux has shared his code, and I was able to get it to work on Mac. It was a matter of changing the src/Makevars files to point to the API as it's installed on the mac: </p>
  
  <pre><code>PKG_LIBS=-framework edfapi -F/Library/Frameworks/
  </code></pre>
  
  <p>To make it work in linux, Makevars needs to have: </p>
  
  <pre><code>PKG_LIBS=-L/usr/local/lib -ledfapi -lm
  </code></pre>
  
  <p>I know that for windows-specific options, I need to create a Makevars.win file, but how do I have the build options change for Mac versus Linux? I would like to do something like:</p>
  
  <pre><code>if [[ `uname` -eq Darwin ]] ; then
  
    PKG_LIBS=-framework edfapi -F/Library/Frameworks/
  
  fi
  
  if [[ `uname` -eq Linux ]] ;then
  
    PKG_LIBS=-L/usr/local/lib -ledfapi -lm
  
  fi
  </code></pre>
  
  <p>but putting this into Makevars doesn't work. From researching this it seems that I need a combination of setting options in <code>configure</code> and <code>Makevars</code>, but I haven't quite figured it out. I am comfortable with R programming and know just enough C++ to make some basic functions, but I still don't understand all the nuances involved in the building process. If someone could explain the main purpose of <code>configure/configure.ac</code> versus <code>Makevars/Makevars.in</code> that would be helpful as well. </p>
  
  <p>Ideally I would like to bundle the API along with the R package and have the different versions in a platform-specific folder. The API consists of just 3 header files and a binary (and it rarely changes). I realize this would prevent me from putting the package on CRAN but that is fine. I've managed to successfully build the package with the API files in a different folder, but at runtime it still looks for it in the standard spot (/Library/Frameworks). I realize this is a more loaded question and I can create a separate post as well.</p>