configure: apply patch from Alberto Villa to fix build on FreeBSD