anchor.diff:      {_, [], Sum} = lists:keyfind(libsummary, 1, Xml),
       Sum.
   
  -ensure_docsrc (Conf, IncludePaths, AppDir) ->
  +ensure_docsrc (Conf, IncludePaths, AppName, AppDir) ->
       %% List any doc/src/*.xml files that exist in the source files
       XMLFiles = filelib:wildcard(jname([AppDir, "doc", "src", "*.xml"])),
       HandWritten = [bname(File, ".xml") || File <- XMLFiles],
   
  -    ErlFiles = filelib:wildcard(jname([AppDir,        "*.erl"]))
  -        ++     filelib:wildcard(jname([AppDir, "src", "*.erl"])),
  +    ErlFiles = filelib:wildcard(jname( AppDir,        "*.erl" ))
  +        ++     filelib:wildcard(jname([AppDir, "src", "*.erl"]))
  +        ++ maybe_add_otp_preloaded(AppName, kf(building_otp,Conf)),
   
       %% Generate any missing module XML
       SrcFiles = [filename:absname(File) ||
  
positive.code:     %% Output XML files to destination folder
      %% This prevents from polluting the source files
      TmpRoot = jname(kf(dest,Conf), ?ERLDOCS_SPECS_TMP),
      XMLDir  = jname(TmpRoot, bname(AppDir)),
      mkdir_p(XMLDir ++ "/"),
  
      lists:foreach(fun (File) -> gen_type_specs(TmpRoot, IncludePaths, File) end, ErlFiles),
  
      %% Return the complete list of XML files
      XMLFiles ++ tmp_cd(XMLDir, fun () ->
                                         gen_docsrc(AppDir, SrcFiles, IncludePaths, XMLDir)
                                 end).
  
  gen_type_specs (SpecsDest, IncludePaths, ErlFile) ->
      case erlang:system_info(otp_release) of
          [$R,$1,Digit|_] when Digit < $5 -> SpecsGenModule = specs_gen__below_R15;
          "R"++_ ->                          SpecsGenModule = specs_gen__R15_to_17;
          Vsn when Vsn < "18" ->             SpecsGenModule = specs_gen__R15_to_17;
          _ ->                               SpecsGenModule = specs_gen__18_and_above
      end,
      ?log("Generating Type Specs - ~p", [ErlFile]),
      Args = ["-o"++SpecsDest] ++ ["-I"++Inc || Inc <- IncludePaths] ++ [ErlFile],
      try SpecsGenModule:main(Args)
      catch _:_SpecsGenError ->
              ?log("Error generating type specs for ~p", [ErlFile])
      end.
  
  includes (AppDir) ->
  
negative.code:            , {layout, docgen_edoc_xml_cb}
             ],
  
      ?log("Generating XML for application ~s ~p -> ~p", [AppName,AppDir,Dest]),
      case catch (edoc:application(list_to_atom(AppName), AppDir, Opts)) of
          ok ->
  