Sevan Janiyan <[email protected]> writes: > Hi, > realpath(3) has been around for quite some time now, but with > POSIX.1-2008 its signature changed and gained the ability to > auto-allocate memory, whereas the original implementation needed > things to be done in prep before calling realpath().
The only prototype change I see for realpath is the addition of the restrict keyword. > It seems it's not so much a problem on Solaris 10 as you can assume > the new behaviour and check the value of $errno, and if it was > invalid, resort to the old way of doing things. > > That's Solaris 10, on ancient OS X (darwin 8 and older), program > crashes on the first call to realpath with bus error, so you never get > beyond that. > > Would this be something that autoconf could check for out of the box > and provide the relevant definitions to the use in code? so you can > skip on implementing the logic to work out which realpath is > available, whether in code, or as an autoconf check. I would just copy some of the code from Gnulib's m4/canonicalize.m4 into your project [1]. Most (all?) of Gnulib's m4 files are permissively licensed, so as long as you keep the notice you should be fine to use them. My personal opinion is that there are too many portability issues like this realpath one for Autoconf to handle. Collin [1] https://github.com/coreutils/gnulib/blob/master/m4/canonicalize.m4
