diff --git a/configure.ac b/configure.ac
index c2ac2f3..8766828 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,7 @@ AC_SEARCH_LIBS([compress], [z], , [AC_MSG_ERROR([Unable to find zlib.])])
AX_BOOST_BASE(, , [AC_MSG_ERROR([Unable to find boost libraries.])])
# Checks for header files.
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h langinfo.h limits.h locale.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termios.h unistd.h wchar.h wctype.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h langinfo.h limits.h locale.h netinet/in.h pty.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termios.h unistd.h util.h wchar.h wctype.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
diff --git a/src/examples/parse.cc b/src/examples/parse.cc
index 3a55258..c98f392 100644
--- a/src/examples/parse.cc
+++ b/src/examples/parse.cc
@@ -16,7 +16,8 @@
along with this program. If not, see .
*/
-#include
+#include "config.h"
+
#include
#include
#include
@@ -32,6 +33,12 @@
#include
#include
+#if HAVE_PTY_H
+#include
+#elif HAVE_UTIL_H
+#include
+#endif
+
#include "parser.h"
#include "swrite.h"
diff --git a/src/examples/termemu.cc b/src/examples/termemu.cc
index b9f0526..2a9a3c4 100644
--- a/src/examples/termemu.cc
+++ b/src/examples/termemu.cc
@@ -16,7 +16,8 @@
along with this program. If not, see .
*/
-#include
+#include "config.h"
+
#include
#include
#include
@@ -39,6 +40,12 @@
#include
#include
+#if HAVE_PTY_H
+#include
+#elif HAVE_UTIL_H
+#include
+#endif
+
#include "parser.h"
#include "completeterminal.h"
#include "swrite.h"
diff --git a/src/frontend/stmclient.cc b/src/frontend/stmclient.cc
index 09f0e98..fc02ffd 100644
--- a/src/frontend/stmclient.cc
+++ b/src/frontend/stmclient.cc
@@ -16,12 +16,13 @@
along with this program. If not, see .
*/
+#include "config.h"
+
#include
#include
#include
#include
#include
-#include
#include
#include
#include
@@ -31,6 +32,12 @@
#include
#include
+#if HAVE_PTY_H
+#include
+#elif HAVE_UTIL_H
+#include
+#endif
+
#include "stmclient.h"
#include "swrite.h"
#include "completeterminal.h"