comparison m4/pty.m4 @ 17322:9d7698fd5b5f

openpty: fix bug where HAVE_OPENPTY is mistakenly 1 Problem reported by Mats Erik Andersson in <http://lists.gnu.org/archive/html/bug-gnulib/2013-02/msg00051.html>. * m4/pty.m4 (gl_FUNC_OPENPTY): Define HAVE_OPENPTY when the openpty function exists, not merely when we intend to replace it. This corrects the 2013-01-31 patch, which mistakenly defined HAVE_OPENPTY even on hosts that lacked it.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 08 Feb 2013 08:03:23 -0800
parents d2ccaec7b18c
children fcc679804d75
comparison
equal deleted inserted replaced
17321:4fd6896488e6 17322:9d7698fd5b5f
96 #if HAVE_LIBUTIL_H 96 #if HAVE_LIBUTIL_H
97 # include <libutil.h> 97 # include <libutil.h>
98 #endif 98 #endif
99 ]]) 99 ]])
100 if test $ac_cv_have_decl_openpty = yes; then 100 if test $ac_cv_have_decl_openpty = yes; then
101 AC_DEFINE([HAVE_OPENPTY], [1],
102 [Define to 1 if the system has the 'openpty' function.])
101 dnl The system has openpty. 103 dnl The system has openpty.
102 dnl Prefer glibc's const-safe prototype, if available. 104 dnl Prefer glibc's const-safe prototype, if available.
103 AC_CACHE_CHECK([for const-safe openpty signature], 105 AC_CACHE_CHECK([for const-safe openpty signature],
104 [gl_cv_func_openpty_const], 106 [gl_cv_func_openpty_const],
105 [AC_COMPILE_IFELSE( 107 [AC_COMPILE_IFELSE(
120 struct winsize const *); 122 struct winsize const *);
121 ]]) 123 ]])
122 ], 124 ],
123 [gl_cv_func_openpty_const=yes], [gl_cv_func_openpty_const=no]) 125 [gl_cv_func_openpty_const=yes], [gl_cv_func_openpty_const=no])
124 ]) 126 ])
125 fi 127 if test $gl_cv_func_openpty_const != yes; then
126 if test $gl_cv_func_openpty_const = yes; then 128 REPLACE_OPENPTY=1
127 HAVE_OPENPTY=1 129 fi
128 else 130 else
129 dnl We need gnulib's openpty. 131 dnl The system does not have openpty.
132 HAVE_OPENPTY=0
130 dnl Prerequisites of lib/openpty.c in this case. 133 dnl Prerequisites of lib/openpty.c in this case.
131 AC_CHECK_FUNCS([_getpty posix_openpt], [HAVE_OPENPTY=1], [HAVE_OPENPTY=0]) 134 AC_CHECK_FUNCS([_getpty posix_openpt])
132 REPLACE_OPENPTY=$HAVE_OPENPTY
133 fi
134 if test $HAVE_OPENPTY = 1; then
135 AC_DEFINE([HAVE_OPENPTY], [1],
136 [Define to 1 if the system has the 'openpty' function.])
137 fi 135 fi
138 ]) 136 ])
139 137
140 AC_DEFUN([gl_FUNC_LOGIN_TTY], 138 AC_DEFUN([gl_FUNC_LOGIN_TTY],
141 [ 139 [