Skip to content

Commit 163d62a

Browse files
committed
configure: update for libgit2 v0.99.0
Signed-off-by: Stefan Widgren <stefan.widgren@gmail.com>
1 parent e55f435 commit 163d62a

File tree

3 files changed

+53
-13
lines changed

3 files changed

+53
-13
lines changed

configure

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3329,9 +3329,8 @@ fi
33293329

33303330
################# Begin configuration to use system libgit2 ##################
33313331
if test "x${USE_BUNDLED_LIBGIT2}" = xno; then
3332-
3333-
# The function 'git_buf_free' is deprecated in libgit2. Use
3334-
# 'git_buf_dispose', if available, instead.
3332+
# The function 'git_buf_free' is deprecated in libgit2
3333+
# v0.28.0. Use 'git_buf_dispose', if available, instead.
33353334
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the libgit2 function git_buf_dispose is available" >&5
33363335
$as_echo_n "checking whether the libgit2 function git_buf_dispose is available... " >&6; }
33373336
have_buf_dispose=no
@@ -3356,9 +3355,9 @@ $as_echo "${have_buf_dispose}" >&6; }
33563355

33573356
# The constants GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT,
33583357
# GIT_OBJ_TAG_GIT_OBJ_TREE and GIT_REF_OID are deprecated in
3359-
# libgit2. Use GIT_OBJECT_ANY, GIT_OBJECT_BLOB, GIT_OBJECT_COMMIT,
3360-
# GIT_OBJECT_TAG_GIT_OBJECT_TREE and GIT_REFERENCE_DIRECT, if
3361-
# available, instead.
3358+
# libgit2 v0.28.0. Use GIT_OBJECT_ANY, GIT_OBJECT_BLOB,
3359+
# GIT_OBJECT_COMMIT, GIT_OBJECT_TAG_GIT_OBJECT_TREE and
3360+
# GIT_REFERENCE_DIRECT, if available, instead.
33623361
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the libgit2 constant GIT_OBJECT_ANY is available" >&5
33633362
$as_echo_n "checking whether the libgit2 constant GIT_OBJECT_ANY is available... " >&6; }
33643363
have_git_object_any=no
@@ -3405,6 +3404,32 @@ $as_echo "${have_git_error_last}" >&6; }
34053404
PKG_CFLAGS="${PKG_CFLAGS} -DGIT2R_HAVE_GIT_ERROR"
34063405
fi
34073406

3407+
# libgit v0.99.0: Several structures, enums and values have been
3408+
# renamed in libgit version 0.99.0. The former names are
3409+
# deprecated. See
3410+
# https://github.com/libgit2/libgit2/releases/tag/v0.99.0
3411+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the libgit2 function git_oid_is_zero is available" >&5
3412+
$as_echo_n "checking whether the libgit2 function git_oid_is_zero is available... " >&6; }
3413+
have_git_oid_is_zero=no
3414+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3415+
/* end confdefs.h. */
3416+
#include <git2.h>
3417+
int
3418+
main ()
3419+
{
3420+
git_oid_is_zero(NULL);
3421+
;
3422+
return 0;
3423+
}
3424+
_ACEOF
3425+
PKG_CFLAGS="${PKG_CFLAGS} -Werror" "$RBIN" CMD SHLIB conftest.c \
3426+
1>&5 2>&5 && have_git_oid_is_zero=yes
3427+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${have_git_oid_is_zero}" >&5
3428+
$as_echo "${have_git_oid_is_zero}" >&6; }
3429+
if test "x${have_git_oid_is_zero}" = xyes; then
3430+
PKG_CFLAGS="${PKG_CFLAGS} -DGIT2R_LIBGIT2_V0_99_0_RENAMES"
3431+
fi
3432+
34083433
# For debugging
34093434
echo "----- Results of the git2r package configure -----"
34103435
echo ""

configure.ac

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ fi
114114

115115
################# Begin configuration to use system libgit2 ##################
116116
if test "x${USE_BUNDLED_LIBGIT2}" = xno; then
117-
118-
# The function 'git_buf_free' is deprecated in libgit2. Use
119-
# 'git_buf_dispose', if available, instead.
117+
# The function 'git_buf_free' is deprecated in libgit2
118+
# v0.28.0. Use 'git_buf_dispose', if available, instead.
120119
AC_MSG_CHECKING([whether the libgit2 function git_buf_dispose is available])
121120
have_buf_dispose=no
122121
AC_LANG_CONFTEST([AC_LANG_PROGRAM(
@@ -131,9 +130,9 @@ if test "x${USE_BUNDLED_LIBGIT2}" = xno; then
131130

132131
# The constants GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT,
133132
# GIT_OBJ_TAG_GIT_OBJ_TREE and GIT_REF_OID are deprecated in
134-
# libgit2. Use GIT_OBJECT_ANY, GIT_OBJECT_BLOB, GIT_OBJECT_COMMIT,
135-
# GIT_OBJECT_TAG_GIT_OBJECT_TREE and GIT_REFERENCE_DIRECT, if
136-
# available, instead.
133+
# libgit2 v0.28.0. Use GIT_OBJECT_ANY, GIT_OBJECT_BLOB,
134+
# GIT_OBJECT_COMMIT, GIT_OBJECT_TAG_GIT_OBJECT_TREE and
135+
# GIT_REFERENCE_DIRECT, if available, instead.
137136
AC_MSG_CHECKING([whether the libgit2 constant GIT_OBJECT_ANY is available])
138137
have_git_object_any=no
139138
AC_LANG_CONFTEST([AC_LANG_PROGRAM(
@@ -160,6 +159,22 @@ if test "x${USE_BUNDLED_LIBGIT2}" = xno; then
160159
PKG_CFLAGS="${PKG_CFLAGS} -DGIT2R_HAVE_GIT_ERROR"
161160
fi
162161

162+
# libgit v0.99.0: Several structures, enums and values have been
163+
# renamed in libgit version 0.99.0. The former names are
164+
# deprecated. See
165+
# https://github.com/libgit2/libgit2/releases/tag/v0.99.0
166+
AC_MSG_CHECKING([whether the libgit2 function git_oid_is_zero is available])
167+
have_git_oid_is_zero=no
168+
AC_LANG_CONFTEST([AC_LANG_PROGRAM(
169+
[[#include <git2.h>]],
170+
[[git_oid_is_zero(NULL);]])])
171+
PKG_CFLAGS="${PKG_CFLAGS} -Werror" "$RBIN" CMD SHLIB conftest.c \
172+
1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && have_git_oid_is_zero=yes
173+
AC_MSG_RESULT([${have_git_oid_is_zero}])
174+
if test "x${have_git_oid_is_zero}" = xyes; then
175+
PKG_CFLAGS="${PKG_CFLAGS} -DGIT2R_LIBGIT2_V0_99_0_RENAMES"
176+
fi
177+
163178
# For debugging
164179
echo "----- Results of the git2r package configure -----"
165180
echo ""

tools/version.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
# if LIBGIT2_VER_MINOR < 26
55
# error libgit2 version too old
66
# endif
7-
#else
7+
#elif LIBGIT2_VER_MAJOR > 1
88
# error the libgit2 version is not compatible with git2r
99
#endif

0 commit comments

Comments
 (0)