Make the readdir_r check an AC_TRY_COMPILE check

glibc recently deprecated readdir_r(). However, AC_CHECK_FUNC only
checks for the symbol, which is still there. This would then result in a
warning during compilation (resulting in an error due to -Werror) as
soon as readdir_r() is used.