- [AC_DEFINE(HAVE_TERMIOS2_SPEED, 1)], [], [[#include <linux/termios.h>]])
-
-# Check for readlinkat.
-AC_CHECK_FUNC([readlinkat], [AC_DEFINE(HAVE_READLINKAT, 1)], [])
+ [AC_DEFINE(HAVE_TERMIOS2_SPEED, 1,
+ [struct termios2 has c_ispeed/c_ospeed.])],
+ [], [[#include <linux/termios.h>]])
+
+# Check for the BOTHER definition, needed for setting arbitrary baud rates.
+# We can't just #ifdef BOTHER in the code, because of the separation between
+# code using libc headers and code using kernel termios.h headers.
+AC_MSG_CHECKING(for BOTHER)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <linux/termios.h>
+]],
+[[
+#ifndef BOTHER
+#error BOTHER is not defined
+#endif
+]])],
+[AC_DEFINE(HAVE_BOTHER, 1, [BOTHER macro is available])
+AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])