8252769: Warn in configure if git config autocrlf has invalid value

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2022-03-04 16:32:58 +00:00
parent 603050bfe0
commit f9f9c0a855
2 changed files with 12 additions and 2 deletions

View File

@ -80,6 +80,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
# Optional tools, we can do without them
UTIL_LOOKUP_PROGS(DF, df)
UTIL_LOOKUP_PROGS(GIT, git)
UTIL_LOOKUP_PROGS(NICE, nice)
UTIL_LOOKUP_PROGS(READLINK, greadlink readlink)
@ -339,7 +340,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
UTIL_LOOKUP_PROGS(READELF, greadelf readelf)
UTIL_LOOKUP_PROGS(DOT, dot)
UTIL_LOOKUP_PROGS(HG, hg)
UTIL_LOOKUP_PROGS(GIT, git)
UTIL_LOOKUP_PROGS(STAT, stat)
UTIL_LOOKUP_PROGS(TIME, time)
UTIL_LOOKUP_PROGS(FLOCK, flock)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -185,6 +185,16 @@ AC_DEFUN([BASIC_SETUP_PATHS_WINDOWS],
AC_MSG_RESULT([unknown])
AC_MSG_WARN([It seems that your find utility is non-standard.])
fi
if test "x$GIT" != x && test -e $TOPDIR/.git; then
git_autocrlf=`$GIT config core.autocrlf`
if test "x$git_autocrlf" != x && test "x$git_autocrlf" != "xfalse"; then
AC_MSG_NOTICE([Your git configuration does not set core.autocrlf to false.])
AC_MSG_NOTICE([If you checked out this code using that setting, the build WILL fail.])
AC_MSG_NOTICE([To correct, run "git config --global core.autocrlf false" and re-clone the repo.])
AC_MSG_WARN([Code is potentially incorrectly cloned. HIGH RISK of build failure!])
fi
fi
])
# Verify that the directory is usable on Windows