anchor.diff:      get_port_spec(Config, OsType, {Arch, Target, Sources, []});
   get_port_spec(Config, OsType, {_Arch, Target, Sources, Opts}) ->
       SourceFiles = port_sources(Sources),
  +    LinkLang =
  +        case lists:any(
  +               fun(Src) -> compiler(filename:extension(Src)) == "$CXX" end,
  +               SourceFiles) of
  +            true  -> cxx;
  +            false -> cc
  +        end,
       ObjectFiles = port_objects(SourceFiles),
       #spec{type=target_type(Target),
             target=maybe_switch_extension(OsType, Target),
  +          link_lang=LinkLang,
             sources=SourceFiles,
             objects=ObjectFiles,
             opts=port_opts(Config, Opts)}.
  
positive.code:        "           EXE_CFLAGS  - flags that will be used for compiling~n"
         "           EXE_LDFLAGS - flags that will be used for linking~n"
         "           ERL_EI_LIBDIR - ei library directory~n"
         "           DRV_CXX_TEMPLATE  - C++ command template~n"
         "           DRV_CC_TEMPLATE   - C command template~n"
         "           DRV_LINK_TEMPLATE - Linker command template~n"
         "           EXE_CXX_TEMPLATE  - C++ command template~n"
         "           EXE_CC_TEMPLATE   - C command template~n"
         "           EXE_LINK_TEMPLATE - Linker command template~n"
         "~n"
         "           Note that if you wish to extend (vs. replace) these variables,~n"
         "           you MUST include a shell-style reference in your definition.~n"
  
negative.code: select_compile_exe_template("$CC")  -> "EXE_CC_TEMPLATE";
  select_compile_exe_template("$CXX") -> "EXE_CXX_TEMPLATE".
  
  select_link_template(LinkLang, Target) ->
      case {LinkLang, target_type(Target)} of
          {cc,  drv} -> "DRV_LINK_TEMPLATE";
          {cxx, drv} -> "DRV_LINK_CXX_TEMPLATE";
          {cc,  exe} -> "EXE_LINK_TEMPLATE";
          {cxx, exe} -> "EXE_LINK_CXX_TEMPLATE"
      end.
  
  target_type(Target) -> target_type1(filename:extension(Target)).
  