Use same check from cmake in autotools for POSIX regex support.