Download raw body.
[portable] fix sha1.h detection on OpenBSD
There are three errors here actually. The first one is a typo
: AC_CHECK_DECL([SHA_DIGEST_LENGTH],
^^^
should be SHA1_DIGEST_LENGTH
: [AC_DEFINE(HAVE_SHA1_AS_SHA1)],
: [AC_DEFINE(NEEDS_SHA1_DEFS)],
: [#include <sha1.h>])
the second is a missing header. At least on OpenBSD sha1.h needs
sys/types.h too.
: fi
With these fixed, the build still fails because of a re-definition of
SHA1_* constant. It is because the (failed) test for sha.h sets
NEEDS_SHA1_DEFS.
This is my attempt at simplifying the checks. We only look at sha.h
if the sha1.h check failed, and only if both fails it set
NEEDS_SHA1_DEFS.
diff /home/op/w/got-portable
commit - 415a43bb0c7491db8a907b4e5bbdf9894602d651
path + /home/op/w/got-portable
blob - 613855f12d450e8083c23a83e2880abb4c863cc3
file + configure.ac
--- configure.ac
+++ configure.ac
@@ -88,25 +88,20 @@ if test "x$ac_cv_header_sha_h" = xyes; then
AM_CONDITIONAL([HAVE_SHA2], [test "x$ac_cv_header_sha2_h" = xyes])
# Check for SHA1_DIGEST_LENGTH
-if test "x$ac_cv_header_sha_h" = xyes; then
-AC_CHECK_DECL([SHA_DIGEST_LENGTH],
- [AC_DEFINE(HAVE_SHA_AS_SHA1)],
- [AC_DEFINE(NEEDS_SHA1_DEFS)],
- [#include <sha.h>])
-fi
+AC_CHECK_DECL([SHA1_DIGEST_LENGTH],
+ [AC_DEFINE(HAVE_SHA1_AS_SHA1)],
+ [
+ dnl maybe sha.h is available
+ AC_CHECK_DECL([SHA_DIGETS_LENGTH],
+ [AC_DEFINE(HAVE_SHA_AS_SHA1)],
+ [AC_DEFINE(NEEDS_SHA1_DEFS)],
+ [#include <sha.h>])
+ ],
+ [
+ #include <sys/types.h>
+ #include <sha1.h>
+ ])
-if test "x$ac_cv_header_sha1_h" = xyes; then
-AC_CHECK_DECL([SHA_DIGEST_LENGTH],
- [AC_DEFINE(HAVE_SHA1_AS_SHA1)],
- [AC_DEFINE(NEEDS_SHA1_DEFS)],
- [#include <sha1.h>])
-fi
-
-if test "x$ac_cv_header_sha_h" = xno || test "x$ac_cv_header_sha1_h" = xno
-then
- AC_DEFINE(NEEDS_SHA1_DEFS)
-fi
-
# Checks for typ edefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
[portable] fix sha1.h detection on OpenBSD