C code wasn't written with GNU/kFreeBSD and hurn in mind
--- a/src/mod_term/terminals.c
+++ b/src/mod_term/terminals.c
@@ -32,6 +32,7 @@
 
 /* First defined some macro to identify easily some systems */
 #if defined (__FreeBSD__) \
+ || defined (__FreeBSD_kernel__) \
  || defined (__OpenBSD__) \
  || defined (__NetBSD__) \
  || defined (__DragonFly__)
@@ -52,10 +53,14 @@
 
 /* On some system termio is either absent or including it will disable termios
    (HP-UX) */
-#if ! defined (__hpux__) && ! defined (FREEBSD) && ! defined (__APPLE__)
+#if ! defined (__hpux__) && ! defined (FREEBSD) && ! defined (__APPLE__) && ! defined (__GNU__)
 #   include <termio.h>
 #endif
 
+#if defined (FREEBSD)
+#   include <pty.h>
+#endif
+
 #include <sys/ioctl.h>
 #include <termios.h>
 #include <fcntl.h>
