diff --git a/lib/envars.ml b/lib/envars.ml index b5036e73403ec..f68b9828bb295 100644 --- a/lib/envars.ml +++ b/lib/envars.ml @@ -12,7 +12,13 @@ open Util (** {1 Helper functions} *) -let getenv_else s dft = try Sys.getenv s with Not_found -> dft () +let getenv_else s dft = + try + let v = Sys.getenv s in + if String.equal v "" + then dft () + else v + with Not_found -> dft () let safe_getenv warning n = getenv_else n (fun () -> diff --git a/tools/CoqMakefile.in b/tools/CoqMakefile.in index b673225e409a4..914269cd78172 100644 --- a/tools/CoqMakefile.in +++ b/tools/CoqMakefile.in @@ -33,7 +33,13 @@ COQLIBS := $(COQMF_COQLIBS) COQLIBS_NOML := $(COQMF_COQLIBS_NOML) CMDLINE_COQLIBS := $(COQMF_CMDLINE_COQLIBS) LOCAL := $(COQMF_LOCAL) -COQLIB := $(COQMF_COQLIB) +# We add a workaround for #8731; if COQLIB is set externally, don't +# override it. +ifeq ($(COQMF_COQLIB),) + COQLIB := $(shell coqtop -where)/ +else + COQLIB := $(COQMF_COQLIB) +endif DOCDIR := $(COQMF_DOCDIR) OCAMLFIND := $(COQMF_OCAMLFIND) CAMLFLAGS := $(COQMF_CAMLFLAGS)