def do_preconfigure(d):
    import subprocess
    cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize')
    subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
    cmd = d.expand("sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure")
    subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)

    # Easiest way to stop bad RPATHs getting into the library since we have a
    # broken libtool here (breaks cross-canadian and target at least)
    cmd = d.expand("sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${S}/libcc1/configure")
    subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)

do_preconfigure(d)

