Skip to content

Commit c968a9e

Browse files
committed
build(configure): improve zlibWrapper handling outside Git work trees
This avoids running git submodule when not in a Git working tree (which would otherwise result in a Git error) and provides a more helpful error message.
1 parent 8ad1bbf commit c968a9e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,11 @@ AM_CONDITIONAL([WITHZSTD], [test "x$with_zstd" = xyes])
397397
# Ensure zstd/zlibWrapper
398398
AS_IF([test -f "$srcdir/extern/zstd/zlibWrapper/zstd_zlibwrapper.h"], [],
399399
[AC_PATH_PROG([GIT], [git])
400-
AS_IF([test -n "$GIT"], [(cd "$srcdir" && "$GIT" submodule update --init)])])
400+
AS_IF([test -n "$GIT" && (cd "$srcdir" && "$GIT" rev-parse --is-inside-work-tree >/dev/null 2>&1)], [(cd "$srcdir" && "$GIT" submodule update --init)])])
401401
AS_IF([test -f "$srcdir/extern/zstd/zlibWrapper/zstd_zlibwrapper.h"], [],
402-
[AS_IF([test -d "$srcdir/.git"],
402+
[AS_IF([test -e "$srcdir/.git"],
403403
[AC_MSG_FAILURE([$srcdir/extern/zstd/zlibWrapper does not exist. Run git submodule update --init in the repository directory])],
404-
[AC_MSG_FAILURE([$srcdir/extern/zstd/zlibWrapper does not exist])])])
404+
[AC_MSG_FAILURE([$srcdir/extern/zstd/zlibWrapper does not exist. Copy the zlibWrapper directory from upstream (https://github.com/facebook/zstd)])])])
405405

406406
# Check for flint
407407
AC_ARG_WITH([flint],

0 commit comments

Comments
 (0)