* modules/pty (Makefile.am): Substitute new witnesses. (Libraries): Move library detection... * modules/forkpty: ...into new module. * modules/openpty: Another new module. * modules/pty-tests: Rename... * modules/forkpty-tests: ...to this. * tests/test-pty.c: Rename... * tests/test-forkpty.c: ...to this. * m4/pty_h.m4 (gl_PTY_H_DEFAULTS): Add new witnesses. (gl_PTY): Split library searching... * m4/forkpty.m4 (gl_PTY_LIB): ...into new file. (gl_FORKPTY, gl_OPENPTY): New macros. * lib/pty.in.h (forkpty, openpty): Honor new witnesses. * NEWS: Mention the split. * MODULES.html.sh (Misc): Document the modules. * doc/glibc-functions/forkpty.texi (forkpty): Likewise. * doc/glibc-functions/openpty.texi (openpty): Likewise.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- This is a usage change - anyone that was previously using pty for function declarations should now use forkpty and/or openpty. But it is necessary to get us closer to providing forkpty replacements on Solaris and HP-UX (not done in this series, but should be easier now), as well as a forkpty stup on mingw (which has neither fork() nor pty's, so the replacement would always fail, but at least provide avoidance of link failure). ChangeLog | 19 +++++++++++++++++++ MODULES.html.sh | 3 +++ NEWS | 4 ++++ doc/glibc-functions/forkpty.texi | 2 +- doc/glibc-functions/openpty.texi | 2 +- lib/pty.in.h | 8 ++++---- m4/forkpty.m4 | 31 +++++++++++++++++++++++++++++++ m4/pty_h.m4 | 18 +++++------------- modules/forkpty | 27 +++++++++++++++++++++++++++ modules/forkpty-tests | 8 ++++++++ modules/openpty | 26 ++++++++++++++++++++++++++ modules/pty | 2 ++ modules/pty-tests | 8 -------- tests/{test-pty.c => test-forkpty.c} | 0 14 files changed, 131 insertions(+), 27 deletions(-) create mode 100644 m4/forkpty.m4 create mode 100644 modules/forkpty create mode 100644 modules/forkpty-tests create mode 100644 modules/openpty delete mode 100644 modules/pty-tests rename tests/{test-pty.c => test-forkpty.c} (100%) diff --git a/ChangeLog b/ChangeLog index b52e146..5bdb71f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2010-03-18 Eric Blake <ebl...@redhat.com> + forkpty, openpty: split functions into new modules + * modules/pty (Makefile.am): Substitute new witnesses. + (Libraries): Move library detection... + * modules/forkpty: ...into new module. + * modules/openpty: Another new module. + * modules/pty-tests: Rename... + * modules/forkpty-tests: ...to this. + * tests/test-pty.c: Rename... + * tests/test-forkpty.c: ...to this. + * m4/pty_h.m4 (gl_PTY_H_DEFAULTS): Add new witnesses. + (gl_PTY): Split library searching... + * m4/forkpty.m4 (gl_PTY_LIB): ...into new file. + (gl_FORKPTY, gl_OPENPTY): New macros. + * lib/pty.in.h (forkpty, openpty): Honor new witnesses. + * NEWS: Mention the split. + * MODULES.html.sh (Misc): Document the modules. + * doc/glibc-functions/forkpty.texi (forkpty): Likewise. + * doc/glibc-functions/openpty.texi (openpty): Likewise. + pty: improve replacement header * lib/pty.in.h: New file. * modules/pty (Files): Ship it. diff --git a/MODULES.html.sh b/MODULES.html.sh index 080c60a..b0fbe39 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -3143,6 +3143,7 @@ func_all_modules () func_module exitfail func_module error func_module extensions + func_module forkpty func_module getdomainname func_module xgetdomainname func_module getloadavg @@ -3150,9 +3151,11 @@ func_all_modules () func_module getusershell func_module lib-symbol-visibility func_module nproc + func_module openpty func_module physmem func_module posixver func_module progname + func_module pty func_module quotearg func_module quote func_module readutmp diff --git a/NEWS b/NEWS index ad639dd..0074492 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,10 @@ User visible incompatible changes Date Modules Changes +2010-03-18 pty This module now only declares the pty.h header. + Use the new modules 'forkpty' or 'openpty' to + get the functions that were previously provided. + 2010-03-05 exit This module is deprecated, use 'stdlib' directly instead. It will be removed 2011-01-01. diff --git a/doc/glibc-functions/forkpty.texi b/doc/glibc-functions/forkpty.texi index 7701a38..8a86511 100644 --- a/doc/glibc-functions/forkpty.texi +++ b/doc/glibc-functions/forkpty.texi @@ -2,7 +2,7 @@ forkpty @subsection @code{forkpty} @findex forkpty -Gnulib module: pty +Gnulib module: forkpty Portability problems fixed by Gnulib: @itemize diff --git a/doc/glibc-functions/openpty.texi b/doc/glibc-functions/openpty.texi index 83975a9..7eb528e 100644 --- a/doc/glibc-functions/openpty.texi +++ b/doc/glibc-functions/openpty.texi @@ -2,7 +2,7 @@ openpty @subsection @code{openpty} @findex openpty -Gnulib module: pty +Gnulib module: openpty Portability problems fixed by Gnulib: @itemize diff --git a/lib/pty.in.h b/lib/pty.in.h index 72cf9cf..7e90fcc 100644 --- a/lib/pty.in.h +++ b/lib/pty.in.h @@ -44,21 +44,21 @@ /* Declare overridden functions. */ -#if 1 /* FIXME - split forkpty into separate module */ +#if @GNULIB_FORKPTY@ #elif defined GNULIB_POSIXCHECK # undef forkpty # if HAVE_RAW_DECL_FORKPTY _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - " - "use gnulib module pty for portability"); + "use gnulib module forkpty for portability"); # endif #endif -#if 1 /* FIXME - split openpty into separate module */ +#if @GNULIB_OPENPTY@ #elif defined GNULIB_POSIXCHECK # undef openpty # if HAVE_RAW_DECL_OPENPTY _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - " - "use gnulib module pty for portability"); + "use gnulib module openpty for portability"); # endif #endif diff --git a/m4/forkpty.m4 b/m4/forkpty.m4 new file mode 100644 index 0000000..38b51b7 --- /dev/null +++ b/m4/forkpty.m4 @@ -0,0 +1,31 @@ +# forkpty.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. + +# gl_PTY_LIB +# ---------- +# Define automake variable PTY_LIB to the library needed (if any). +AC_DEFUN([gl_PTY_LIB], +[ + # Check for the library required for forkpty. + PTY_LIB= + save_LIBS="$LIBS" + AC_SEARCH_LIBS([forkpty], [util libutil], + [if test "$ac_cv_search_forkpty" != "none required"; then + PTY_LIB="$ac_cv_search_forkpty" + fi]) + LIBS="$save_LIBS" + AC_SUBST([PTY_LIB]) +]) + +AC_DEFUN([gl_FORKPTY], +[ + AC_REQUIRE([gl_PTY_LIB]) +]) + +AC_DEFUN([gl_OPENPTY], +[ + AC_REQUIRE([gl_PTY_LIB]) +]) diff --git a/m4/pty_h.m4 b/m4/pty_h.m4 index 90181c3..9e41dcd 100644 --- a/m4/pty_h.m4 +++ b/m4/pty_h.m4 @@ -1,4 +1,4 @@ -# pty_h.m4 serial 2 +# pty_h.m4 serial 3 dnl Copyright (C) 2009, 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, @@ -7,13 +7,11 @@ dnl with or without modifications, as long as this notice is preserved. # gl_PTY # ------ # Make sure that pty.h provides forkpty, or sets up a replacement header. -# Also define automake variable PTY_LIB to the library needed (if any). AC_DEFUN_ONCE([gl_PTY], [ AC_REQUIRE([gl_PTY_H_DEFAULTS]) - PTY_LIB='' - # First make sure that pty.h provides forkpty, or setup the replacement. + # Make sure that pty.h provides forkpty, or setup the replacement. AC_CHECK_HEADERS_ONCE([pty.h]) if test $ac_cv_header_pty_h != yes; then HAVE_PTY_H=0 @@ -24,6 +22,7 @@ AC_DEFUN_ONCE([gl_PTY], if test $ac_cv_header_libutil_h = yes; then HAVE_LIBUTIL_H=1 fi + dnl FIXME - move this into forkpty module, when replacement is provided AC_CHECK_DECLS([forkpty],,, [[ #if HAVE_UTIL_H # include <util.h> @@ -42,15 +41,6 @@ AC_DEFUN_ONCE([gl_PTY], dnl <pty.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([pty.h]) - # Second check for the library required for forkpty. - save_LIBS="$LIBS" - AC_SEARCH_LIBS([forkpty], [util], - [if test "$ac_cv_search_forkpty" != "none required"; then - PTY_LIB="$ac_cv_search_forkpty" - fi]) - LIBS="$save_LIBS" - AC_SUBST([PTY_LIB]) - dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ @@ -77,6 +67,8 @@ AC_DEFUN([gl_PTY_MODULE_INDICATOR], AC_DEFUN([gl_PTY_H_DEFAULTS], [ + GNULIB_FORKPTY=0; AC_SUBST([GNULIB_FORKPTY]) + GNULIB_OPENPTY=0; AC_SUBST([GNULIB_OPENPTY]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_UTIL_H=0; AC_SUBST([HAVE_UTIL_H]) HAVE_LIBUTIL_H=0; AC_SUBST([HAVE_LIBUTIL_H]) diff --git a/modules/forkpty b/modules/forkpty new file mode 100644 index 0000000..52dbc49 --- /dev/null +++ b/modules/forkpty @@ -0,0 +1,27 @@ +Description: +Provide the forkpty() function. + +Files: +m4/forkpty.m4 + +Depends-on: +openpty +pty + +configure.ac: +gl_FORKPTY +gl_PTY_MODULE_INDICATOR([forkpty]) + +Makefile.am: + +Include: +<pty.h> + +Link: +$(PTY_LIB) + +License: +LGPL + +Maintainer: +Simon Josefsson diff --git a/modules/forkpty-tests b/modules/forkpty-tests new file mode 100644 index 0000000..744d684 --- /dev/null +++ b/modules/forkpty-tests @@ -0,0 +1,8 @@ +Files: +tests/signature.h +tests/test-forkpty.c + +Makefile.am: +TESTS += test-forkpty +check_PROGRAMS += test-forkpty +test_forkpty_LDADD = $(LDADD) $(PTY_LIB) diff --git a/modules/openpty b/modules/openpty new file mode 100644 index 0000000..2a019a5 --- /dev/null +++ b/modules/openpty @@ -0,0 +1,26 @@ +Description: +Provide the openpty() function. + +Files: +m4/forkpty.m4 + +Depends-on: +pty + +configure.ac: +gl_OPENPTY +gl_PTY_MODULE_INDICATOR([openpty]) + +Makefile.am: + +Include: +<pty.h> + +Link: +$(PTY_LIB) + +License: +LGPL + +Maintainer: +Simon Josefsson diff --git a/modules/pty b/modules/pty index ef064be..8ea7ed3 100644 --- a/modules/pty +++ b/modules/pty @@ -25,6 +25,8 @@ pty.h: pty.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_PTY_H''@|$(NEXT_PTY_H)|g' \ + -e 's|@''GNULIB_FORKPTY''@|$(GNULIB_FORKPTY)|g' \ + -e 's|@''GNULIB_OPENPTY''@|$(GNULIB_OPENPTY)|g' \ -e 's|@''HAVE_UTIL_H''@|$(HAVE_UTIL_H)|g' \ -e 's|@''HAVE_LIBUTIL_H''@|$(HAVE_LIBUTIL_H)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ diff --git a/modules/pty-tests b/modules/pty-tests deleted file mode 100644 index 870d518..0000000 --- a/modules/pty-tests +++ /dev/null @@ -1,8 +0,0 @@ -Files: -tests/signature.h -tests/test-pty.c - -Makefile.am: -TESTS += test-pty -check_PROGRAMS += test-pty -test_pty_LDADD = $(LDADD) $(PTY_LIB) diff --git a/tests/test-pty.c b/tests/test-forkpty.c similarity index 100% rename from tests/test-pty.c rename to tests/test-forkpty.c -- 1.6.6.1