old_contents: # Copyright 2013-2014 Dietrich Epp.
  # This file is part of SGLib.  SGLib is licensed under the terms of the
  # 2-clause BSD license.  For more information, see LICENSE.txt.
  from . import GeneratedSource, NOTICE
  
  def macro(x):
      return x.replace('-', '_').upper()
  
  class ConfigHeader(GeneratedSource):
      __slots__ = ['target', 'flags', 'options']
  
      def __init__(self, target, build):
          self.target = target
          self.flags = build.config.flags
          self.options = build.options
  
      @property
      def dependencies(self):
          return ()
  
      def write(self, fp):
          fp.write(
              '/* {} */\n'
              '#ifndef CONFIG_H\n'
              '#define CONFIG_H\n'
              '\n'
              '/* Enabled / disabled features */\n'
              .format(NOTICE))
          for k, v in sorted(self.flags.items()):
              k = macro(k)
              if isinstance(v, bool):
                  e = '#define ENABLE_{} 1'.format(k)
                  if v:
                      print(e, file=fp)
                  else:
                      print('/* {} */'.format(e), file=fp)
              else:
                  print('#define ENABLE_{}_{} 1'.format(k, macro(v)), file=fp)
          fp.write(
              '\n'
              '#endif\n')
  
new_contents: # Copyright 2013-2014 Dietrich Epp.
  # This file is part of SGLib.  SGLib is licensed under the terms of the
  # 2-clause BSD license.  For more information, see LICENSE.txt.
  from . import GeneratedSource, NOTICE
  
  def macro(x):
      return x.replace('-', '_').upper()
  
  class ConfigHeader(GeneratedSource):
      __slots__ = ['target', 'flags', 'options']
  
      def __init__(self, target, build):
          self.target = target
          self.flags = build.config.flags
          self.options = build.options
  
      @property
      def dependencies(self):
          return ()
  
      def write(self, fp):
          fp.write(
              '/* {} */\n'
              '#ifndef CONFIG_H\n'
              '#define CONFIG_H\n'
              '\n'
              '/* Enabled / disabled features */\n'
              .format(NOTICE))
          for k, v in sorted(self.flags.items()):
              k = macro(k)
              if isinstance(v, bool):
                  e = '#define ENABLE_{} 1'.format(k)
                  if v:
                      print(e, file=fp)
                  else:
                      print('/* {} */'.format(e), file=fp)
              else:
                  print('#define ENABLE_{} 1'.format(k), file=fp)
                  print('#define ENABLE_{}_{} 1'.format(k, macro(v)), file=fp)
          fp.write(
              '\n'
              '#endif\n')
  
subject: add more details to config.h