Re: Help with openpty

From:

Bruno Haible

Subject:

Re: Help with openpty

Date:

Thu, 29 Jul 2010 12:23:58 +0200

User-agent:

KMail/1.9.9

Hi,
> I am trying to use the openpty macro
When you use gnulib, you are supposed to use an entire module, in this
case the 'openpty' module, not just some .m4 macro without the
accompanying source files and dependencies. When you look at modules/openpty,
it guarantees you that when you use #include <pty.h> and link with
$(PTY_LIB), you will get a working openpty() function (modulo the
restrictions mentioned in doc/glibc-functions/openpty.texi).
> but I encounter a problem:
> everything works fine on a Mac OS X computer, but the test fails on a
> Linux one. In particular, the PTY headers are founds
>
> #define HAVE_DECL_OPENPTY 1
>
> but I still get no openpty function
>
> /* #undef HAVE_OPENPTY */
The module description does not say that you should use #if HAVE_OPENPTY.
Therefore why would you want to use this autoconf macro? The 'openpty'
module guarantees you a working openpty() function anyway.
In other words, the HAVE_OPENPTY macro in config.h is an undocumented
internal detail of the module, only used by lib/openpty.c.
When I do
$ ./gnulib-tool --create-testdir --dir=/tmp/testdir --with-tests openpty
then in the resulting testdir, on glibc/Linux, the test program 'test-openpty'
links fine and runs fine.
Bruno