summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-10-17 17:19:41 -0600
committerEric Blake <eblake@redhat.com>2011-10-18 15:15:44 -0600
commit94d63c4bfd95e7ff11c3dcbc1d60d276739f7f55 (patch)
tree28aa8c76eef4600791cc11075409784b29aa22b3 /m4
parent0a19a162755da4ef297bcacd62cf5243c76324ed (diff)
downloadgnulib-94d63c4bfd95e7ff11c3dcbc1d60d276739f7f55.tar.gz
posix_openpt: new module
* modules/posix_openpt: New module. * m4/posix_openpt.m4: New file. * lib/posix_openpt.c: Likewise. * m4/stdlib_h.m4 (gl_STDLIB_H): Check for decl. (gl_STDLIB_H_DEFAULTS): Set defaults. * modules/stdlib (Makefile.am): Substitute macros. * lib/stdlib.in.h (posix_openpt): Declare. * MODULES.html.sh (systems lacking POSIX:2008): Document it. * doc/posix-functions/posix_openpt.texi (posix_openpt): Likewise. * modules/posix_openpt-tests: New test module. * tests/test-posix_openpt.c: New test.
Diffstat (limited to 'm4')
-rw-r--r--m4/posix_openpt.m421
-rw-r--r--m4/stdlib_h.m410
2 files changed, 27 insertions, 4 deletions
diff --git a/m4/posix_openpt.m4 b/m4/posix_openpt.m4
new file mode 100644
index 0000000000..8d90f9bba0
--- /dev/null
+++ b/m4/posix_openpt.m4
@@ -0,0 +1,21 @@
+# posix_openpt.m4 serial 1
+dnl Copyright (C) 2011 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_POSIX_OPENPT],
+[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+ dnl Persuade Solaris <stdlib.h> to declare posix_openpt().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_CHECK_FUNCS_ONCE([posix_openpt])
+ if test $ac_cv_have_posix_openpt != yes; then
+ dnl The system does not have posix_openpt.
+ HAVE_POSIX_OPENPT=0
+ dnl Prerequisites of lib/posix_openpt.c in this case.
+ AC_CHECK_FUNCS([_getpty])
+ fi
+])
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 25fdada0de..fbdba980eb 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -19,10 +19,10 @@ AC_DEFUN([gl_STDLIB_H],
#if HAVE_RANDOM_H
# include <random.h>
#endif
- ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp
- mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r
- setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt
- unsetenv])
+ ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
+ initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt
+ ptsname random_r realpath rpmatch setenv setstate_r srandom_r strtod
+ strtoll strtoull unlockpt unsetenv])
])
AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -50,6 +50,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS])
GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS])
+ GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT])
GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
@@ -76,6 +77,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP])
HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
+ HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])