[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: AC_DEFINE_REPLACE
From: |
Paul Eggert |
Subject: |
Re: RFC: AC_DEFINE_REPLACE |
Date: |
Tue, 26 Mar 2002 17:47:11 -0800 (PST) |
> From: Bruce Korb <address@hidden>
> Date: Tue, 26 Mar 2002 14:26:42 -0800
>
> #ifndef FUNC_BROKEN
> # define posix_func func
> #else
> # define posix_func autoconf_rpl_func
> #endif
Yes, that is more portable. Though we shouldn't use the "posix_"
prefix, as POSIX itself uses it these days for functions like
posix_madvise. Perhaps "ac_" or "portable_" would be better.
GNU Emacs does something like that with functions like "open" and
"read". It uses functions rather than a macros, as the functions are
easier to debug. For example:
int
emacs_open (path, oflag, mode)
char *path;
int oflag, mode;
{
register int rtnval;
while ((rtnval = open (path, oflag, mode)) == -1
&& (errno == EINTR));
return (rtnval);
}
I think Autoconf would do well to follow in that tradition. In the
end it is probably the only one that will actually work portably, for
all POSIX functions.
I hope I never have to use it myself, though, as it makes the code
painful to maintain. For example, when importing code from other
packages I would have to substitute "ac_open" for each instance of
"open".