I didn't remove both checks Rather I changed the include file from a -f check to a -e check. On my borked up system ${dir}/include/${python} was a symlink to /usr/include/x86_64-linux-gnu/python2.7 so the -f didn't find it.

I removed the check for the library because, it doesn't check the whole path that ld config checked. As such it could fail here, and then later when the actual linking happens succeed. (As it did on my machine).

I've removed this change now, as it probably only affects people with weird setups.