make endmntent function handle null argument

The function originates from SunOS 4.x in which the null argument
is allowed. glibc also handles this case.
make clearenv available with _BSD_SOURCE

glibc declares clearenv under _BSD_SOURCE, some applications might
depend on it being available this way.
fix dlerror when using dlopen with a static libc

when the dynamic loader is disabled, dlopen fails correctly but dlerror
did not return a human readable error string like it should have.
add dlerror message for static-linked dlsym failure