code: def _setup_versioned_lib_variables(env, **kw):
      
  
      tool = None
      try: tool = kw['tool']
      except KeyError: pass
  
      use_soname = False
      try: use_soname = kw['use_soname']
      except KeyError: pass
  
      # The $_SHLIBVERSIONFLAGS define extra commandline flags used when
      # building VERSIONED shared libraries. It's always set, but used only
      # when VERSIONED library is built (see __SHLIBVERSIONFLAGS in SCons/Defaults.py).
      if use_soname:
          # If the linker uses SONAME, then we need this little automata
          if tool == 'sunlink':
              env['_SHLIBVERSIONFLAGS'] = '$SHLIBVERSIONFLAGS -h $_SHLIBSONAME'
              env['_LDMODULEVERSIONFLAGS'] = '$LDMODULEVERSIONFLAGS -h $_LDMODULESONAME'
          else:
              env['_SHLIBVERSIONFLAGS'] = '$SHLIBVERSIONFLAGS -Wl,-soname=$_SHLIBSONAME'
              env['_LDMODULEVERSIONFLAGS'] = '$LDMODULEVERSIONFLAGS -Wl,-soname=$_LDMODULESONAME'
          env['_SHLIBSONAME'] = '${ShLibSonameGenerator(__env__,TARGET)}'
          env['_LDMODULESONAME'] = '${LdModSonameGenerator(__env__,TARGET)}'
          env['ShLibSonameGenerator'] = SCons.Tool.ShLibSonameGenerator
          env['LdModSonameGenerator'] = SCons.Tool.LdModSonameGenerator
      else:
          env['_SHLIBVERSIONFLAGS'] = '$SHLIBVERSIONFLAGS'
          env['_LDMODULEVERSIONFLAGS'] = '$LDMODULEVERSIONFLAGS'
  
      # LDOMDULVERSIONFLAGS should always default to $SHLIBVERSIONFLAGS
      env['LDMODULEVERSIONFLAGS'] = '$SHLIBVERSIONFLAGS'
docs: Setup all variables required by the versioning machinery