Instead of trying to use the same functions by looking them up at startup, rely
on the linker to give us the right functions and simply define away the `git_`
prefix.
This should let us work with both compile-time and run-time linking, though it
introduces a lot of conditional compilation.
We cannot rely on the handle being `NULL` since `RTLD_DEFAULT` happens to have
the same value on many architectures. Keep a new variable to tell us whether
we think libssh2 has been loaded.
There is no end to the variation in the way people decide to package their
applications, and there seems to be no larger variety than in the way they
decide to deal with libssh2.
Re-introduce looking for the library at compile time, while adding the
USE_SSH_RUNTIME flag to enable detection at runtime.
The `LoadLibrary` function returns a `FARPROC` which MSVC won't convert on its
own to our function signatures. Add a void pointer cast to silence that warning.
While we can use the `typeof` extension with GCC and Clang, this is not
available on MSVC and its equivalent `decltype` is only available for C++.
As we must do this for MSVC, let's do it for all implementations.
Part of the point of this is being able to load libssh2 regardless of whether
it was available upon building, as the resulting shared object might move.
Make USE_SSH mean to try to load it at runtime. We still need to know the
signatures of the functions for our macros to work, so include a copy of the
header as a vendored dependency.
Don't compute the sha-1 in `git_futils_readbuffer_updated` unless the
checksum was requested. This means that `git_futils_readbuffer` will
not calculate the checksum unnecessarily.
An untracked file in a submodule should not prevent a rebase from
starting. Even if the submodule's SHA is changed, and that file would
conflict with a new tracked file, it's still OK to start the rebase
and discover the conflict later.
Signed-off-by: David Turner <dturner@twosigma.com>
We currently unconditionally enable the "-Wall" and "-Wextra" flags.
Some platforms rely on compilers which do not support these flags,
though. One of these platforms is Haiku, which does not support
"-Wextra" due to being stuck on GCC version 2.
Fix builds on such platforms by adding these flags only if supported by
the compiler.