def macroDefinitionString(cmdLineArgS):
    """Given a list of command line arguments of the form n<=d> where n is the
    macro name and d the optional definition this returns a same ordered multi-line
    string where each line is of the form '#define n d' or '#define n' if d is
    not present."""
    retMacros = []
    for d in cmdLineArgS:
        _tup = d.split('=')
        if len(_tup) == 2:
            retMacros.append('#define %s %s' % (_tup[0], _tup[1]))
        elif len(_tup) == 1:
            retMacros.append('#define %s' % _tup[0])
        else:
            raise ValueError(
                'macroDefinitionString(): Macro definition: "%s" has multiple "=" characters.'
                 % d)
    retMacros.append('')
    return '\n'.join(retMacros)
