The CVODES library from sundials is huge, but I don't want to force
users to install it (especially with the headaches on windows that
this will cause).

There is a fairly sophisticated mechanism for creating and linking
to additional libraries used in the in Matrix package
  http://r.789695.n4.nabble.com/Makevars-cc-files-in-multiple-directories-td925539.html
but that looks like a potential world of pain here, where all I
want to do is keep my work separate from the main CVODES code.

In the 'configure' script, I just copy all the files into the src
directory.  The 'cleanup' script undoes this, deleting all these
files.  Passing in --disable-cvodes prevents this (also diabled on
Windows).

Download cvodes-2.6.0.tar.gz from 
  https://computation.llnl.gov/casc/sundials/download/download.html

Note that CVODES is licenced under the "New BSD Licence".  The
diversitree package as a whole is licenced under the GPL, but the
CVODES code remains under BSD.  See src/cvodes/LICENCE

From src/cvodes/, unmodified.  This is all *.c and *.h files
The only modification is removing checking of one error in cvodes.c,
and a couple of minor tweaks to pass gcc tests (flagged with RGF)
cvodea.c
cvodea_io.c
cvodes.c
cvodes_band.c
cvodes_bandpre.c
cvodes_bandpre_impl.h
cvodes_bbdpre.c
cvodes_bbdpre_impl.h
cvodes_dense.c
cvodes_diag.c
cvodes_diag_impl.h
cvodes_direct.c
cvodes_direct_impl.h
cvodes_impl.h
cvodes_io.c
cvodes_lapack.c
cvodes_spbcgs.c
cvodes_spgmr.c
cvodes_spils.c
cvodes_spils_impl.h
cvodes_sptfqmr.c

From src/nvec_ser/, unmodified.  This is all *.c and *.h files
fnvector_serial.c
fnvector_serial.h
nvector_serial.c

From src/sundials/, unmodified.  This is all *.c files (no *.h files present)
sundials_band.c
sundials_dense.c
sundials_direct.c
sundials_iterative.c
sundials_math.c
sundials_nvector.c
sundials_spbcgs.c
sundials_spgmr.c
sundials_sptfqmr.c

include
Contains all files from include/, but:

  sundials_config.h file is tweaked
  sundials_lapack.h rewritten to use R's Lapack

## My code:

Makevars
cvodes/include/user_data.h

Basic object for using CVODES
  cvodes_obj.c/h
Modification of the basic CVODES object for running forward
sensitivity analysis
  cvodes_obj_fwd.c/h
R interfaces
  cvodes_interface.c
  cvodes_interface_fwd.c

There is an issue that generates compiler warnings when using gcc's
  -ansi -pedantic flags:
     ISO C forbids conversion of object pointer to function pointer type
This is discussed at length on the internet, e.g.:
  http://marc.info/?l=apache-modules&m=114108974131841
  http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2005-08/1556.html
However, BDR says that we can live with it:
  https://stat.ethz.ch/pipermail/r-devel/2004-September/030792.html

TODO:
I need to fix the src/cvodes/include/sundials/sundials_config.h file.

Ideally, I could probably generate it at the same time that I do my
general configure process.

There is only one line that needs possible changing:
I do need to find out what this would be on Windows, and find out how
to set it.
  #define SUNDIALS_F77_FUNC(name,NAME) name ## _
  #define SUNDIALS_F77_FUNC_(name,NAME) name ## _
I think that we can possibly use R's F77_NAME macro here
  #define SUNDIALS_F77_FUNC(name,NAME) F77_NAME(name)

These ones should not be configured, I believe.
  #define SUNDIALS_DOUBLE_PRECISION 1
  #define SUNDIALS_USE_GENERIC_MATH 1
  #define SUNDIALS_BLAS_LAPACK 1
  #define SUNDIALS_EXPORT
