def _do_xxpend(args, name):
    """ For example, if name is CPPFLAGS, take the 
        args.prependcppflags and prepend them to args.CPPFLAGS.
        Similarly for append.
    """
    xxlist = 'prepend', 'append'
    for xx in xxlist:
        xxpendname = ''.join([xx, name.lower()])
        if hasattr(args, xxpendname):
            xxpendattr = getattr(args, xxpendname)
            attr = getattr(args, name)
            if xxpendattr:
                extra = []
                for flag in xxpendattr:
                    if flag not in attr:
                        extra.append(flag)
                if xx == 'prepend':
                    attr = ' '.join(extra + [attr])
                else:
                    attr = ' '.join([attr] + extra)
            setattr(args, name, attr)
