File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,10 +107,16 @@ HAVE_GIT=yes
107107AC_ARG_WITH ( git ,
108108 AS_HELP_STRING ( [ --without-git] , [ never use git] ) ,
109109 [ AS_CASE ( [ $withval] ,
110- [ no] , [ GIT=never-use HAVE_GIT=no] ,
110+ [ no] , [ HAVE_GIT=no] ,
111111 [ yes] , [ ] ,
112112 [ GIT=$withval] ) ] )
113- AS_IF ( [ test x"$HAVE_GIT" = xyes] , [ command -v "$GIT" > /dev/null || HAVE_GIT=no] )
113+ {
114+ test x"$HAVE_GIT" = xyes &&
115+ command -v "$GIT" > /dev/null &&
116+ # git 1.8.4 fails with `-C` as unknown option, but git 1.8.5
117+ # succeeds and exits by `--version`.
118+ $GIT -C . --version > /dev/null 2>&1
119+ } || HAVE_GIT=no GIT=never-use
114120AC_SUBST ( GIT )
115121AC_SUBST ( HAVE_GIT )
116122
Original file line number Diff line number Diff line change @@ -506,17 +506,18 @@ VPATH = $(arch_hdrdir)/ruby;$(hdrdir)/ruby;$(srcdir);$(srcdir)/missing;$(win_src
506506!ifndef GIT
507507GIT = git
508508!endif
509+ GIT_TO_CHECK_C_OPTION = -C . --version >nul 2>&1
509510!if "$(HAVE_GIT)" == "yes" || "$(HAVE_GIT)" == "no"
510511!else if "$(GIT)" == ""
511512HAVE_GIT = no
512513!else if [for %I in ($(GIT)) do @if not "%~xI" == "" exit 1]
513- ! if [for % I in ( $( GIT ) ) do @if not " % ~$$PATH :I" == "" exit 1]
514+ ! if [%I $(GIT_TO_CHECK_C_OPTION)] == 0
514515HAVE_GIT = yes
515516! else
516517HAVE_GIT = no
517518! endif
518519!else
519- ! if [for % x in (% PATHEXT :;= % ) do @for % I in ($(GIT ) % x) do @if not " % ~$$PATH:I" == "" exit 1]
520+ ! if [for % x in (% PATHEXT :;= % ) do @($(GIT ) % x $( GIT_TO_CHECK_C_OPTION ) && exit 0)] == 0
520521HAVE_GIT = yes
521522! else
522523HAVE_GIT = no
You can’t perform that action at this time.
0 commit comments