Re: [Libguestfs] [PATCH] macosx: Darwin-specific autoconf macros

Margaret Lewicka
Thu, 12 Feb 2015 18:54:48 -0000

On 12 February 2015 at 18:42, Pino Toscano <ptoscano@redhat.com> wrote:
[...]
> We link to libcrypt because it provides crypt(), at least on GNU libc
> and on the FreeBSD libc; it seems not the case on Mac OS X, looking
> at your patch.
> I'd say that this should turn into a proper configure check, trying to
> use crypt() without extra libraries and if not possible with libcrypt.

The crypt() thing is explained here:
https://developer.apple.com/library/mac/documentation/Porting/Conceptual/PortingUnix/compiling/compiling.html#//apple_ref/doc/uid/TP40002850-SW17
(Compiling... in OS X -> Other Porting Tips -> Functions -> crypt).
(TL;DR: crypt() comes from unistd.h)

[...]
> Is setting LD_LIBRARY_PATH somehow harmful/problematic on Mac OS X?
> If not, I'd say to use a variable for the library paths we want to add,
> then adding them to both LD_LIBRARY_PATH and DYLD_LIBRARY_PATH;
> something like
>   libdirs="$b/src/.libs:...etc"
>   # Set LD_LIBRARY_PATH to contain library.
>   if [ -z "$LD_LIBRARY_PATH" ]; then
>     LD_LIBRARY_PATH="$libdirs"
>   else
>     LD_LIBRARY_PATH="$libdirs:$LD_LIBRARY_PATH"
>   fi
>   export LD_LIBRARY_PATH
>   # ditto for DYLD_LIBRARY_PATH

You'll end up with two semi-identical blocks of code, though, because
you'll have to perform the same -z check for DYLD_LIBRARY_PATH. (As
far as I am aware, Darwin does not use LD_LIBRARY_PATH, hence the
substitution.)

--
M.