1 # ttyname_r.m4 serial 2
2 dnl Copyright (C) 2010 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_TTYNAME_R],
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
11 AC_CHECK_FUNCS([ttyname_r])
12 if test $ac_cv_func_ttyname_r = no; then
15 dnl On MacOS X 10.4 and Solaris 10 the return type is 'char *', not 'int'.
16 AC_CACHE_CHECK([whether ttyname_r is compatible with its POSIX signature],
17 [gl_cv_func_ttyname_r_posix],
21 #include <unistd.h>]],
22 [[*ttyname_r (0, NULL, 0);]])
24 [gl_cv_func_ttyname_r_posix=no],
25 [gl_cv_func_ttyname_r_posix=yes])
27 if test $gl_cv_func_ttyname_r_posix = no; then
31 if test $HAVE_TTYNAME_R = 0 || test $REPLACE_TTYNAME_R = 1; then
32 AC_LIBOBJ([ttyname_r])
37 # Prerequisites of lib/ttyname_r.c.
38 AC_DEFUN([gl_PREREQ_TTYNAME_R], [
39 AC_CHECK_FUNCS([ttyname])