pty: Use posix_openpt() if available

https://bugzilla.gnome.org/show_bug.cgi?id=694494