New module 'ttyname_r'.
[gnulib.git] / m4 / ttyname_r.m4
diff --git a/m4/ttyname_r.m4 b/m4/ttyname_r.m4
new file mode 100644 (file)
index 0000000..54a8676
--- /dev/null
@@ -0,0 +1,22 @@
+# ttyname_r.m4 serial 1
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_TTYNAME_R],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  AC_CHECK_FUNCS([ttyname_r])
+  if test $ac_cv_func_ttyname_r = no; then
+    HAVE_TTYNAME_R=0
+    AC_LIBOBJ([ttyname_r])
+    gl_PREREQ_TTYNAME_R
+  fi
+])
+
+# Prerequisites of lib/ttyname_r.c.
+AC_DEFUN([gl_PREREQ_TTYNAME_R], [
+  AC_CHECK_FUNCS([ttyname])
+])