Theano/Theano — pull request #2256 by f0k (2014-11-14 16:27:31+00:00)
Title: Fix cuDNN detection

The cuDNN detection code in `theano.sandbox.cuda.dnn.dnn_available()` is slightly broken. It assumes that cuda.h, cudnn.h and cudnn.so are available in standard system-wide include and library directories, while during the compilation of the cuDNN ops, it is enough if they are available in CUDA's include and library directories.
This PR includes cuda.h before cudnn.h to not give a "cudnn.h is not found" error if even cuda.h cannot be found (to avoid pointing the user in the wrong direction on what to fix). In addition, it adds the CUDA include and lib directories to the GCC call via -I and -L, respectively.

Alternatively, the check could just use nvcc instead of gcc, but I don't know if that's easy to accomplish.