Detect an edge case where ROOT Minuit2 is detected as standalone
    because $ROOTSYS/lib is in LD_LIBRARY_PATH, and suggest
    appropriate countermeasures.

def is_secretly_root(lib):
    """
    Detect an edge case where ROOT Minuit2 is detected as standalone
    because $ROOTSYS/lib is in LD_LIBRARY_PATH, and suggest
    appropriate countermeasures.
    """
    from distutils import ccompiler
    libdir = os.path.dirname(lib)
    cc = ccompiler.new_compiler()
    for rootlib in ("Core","MathCore"):
        if not cc.find_library_file([libdir], rootlib):
            return False
        else:
            try:
                root_config('libdir')
                return True
            except OSError:
                raise RuntimeError("Found %s, which appears to be part of ROOT, but could not find root-config in PATH! To build against the standalone Minuit2, remove $ROOTSYS/lib from LD_LIBRARY_PATH; to build against the ROOT version, add $ROOTSYS/bin to your PATH" % lib)