[Libguestfs] [PATCH 2/2] lib: Check if crypt() comes from a separate library
Pino Toscano
ptoscano at redhat.com
Fri Feb 13 10:07:29 UTC 2015
On Thursday 12 February 2015 22:37:07 Margaret Lewicka wrote:
> Mac OS X includes crypt() in libc.
> ---
> builder/link.sh.in | 2 +-
> configure.ac | 9 +++++++++
> customize/link.sh.in | 2 +-
> mllib/link.sh.in | 2 +-
> sysprep/link.sh.in | 2 +-
> v2v/link.sh.in | 2 +-
> 6 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/builder/link.sh.in b/builder/link.sh.in
> index 59f3c6f..964617f 100644
> --- a/builder/link.sh.in
> +++ b/builder/link.sh.in
> @@ -19,4 +19,4 @@
> # Hack automake to link binary properly. There is no other way to add
> # the -cclib parameter to the end of the command line.
>
> -exec "$@" -linkpkg -cclib '-pthread -lpthread -lutils @LIBTINFO_LIBS@ -lcrypt @LIBLZMA_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> +exec "$@" -linkpkg -cclib '-pthread -lpthread -lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBLZMA_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> diff --git a/configure.ac b/configure.ac
> index d68190a..9d95c2c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -590,6 +590,15 @@ AC_ARG_WITH([extra-packages],
> [EXTRA_PACKAGES=])
> AC_SUBST([EXTRA_PACKAGES])
>
> +dnl Check if crypt() is provided by a separate library.
> +old_LIBS="$LIBS"
> +AC_SEARCH_LIBS([crypt],[crypt])
> +LIBS="$old_LIBS"
> +if test "$ac_cv_search_crypt" = "-lcrypt" ; then
> + LIBCRYPT_LIBS="-lcrypt"
> +fi
That's a good start; I'd just make this slightly more robust,
since we do require crypt():
AS_CASE([$ac_cv_search_crypt],
["none required"],[],
[no],[AC_MSG_FAILURE([crypt() is needed])],
[LIBCRYPT_LIBS="$ac_cv_search_crypt"])
(untested)
> +AC_SUBST([LIBCRYPT_LIBS])
> +
> dnl Check for libdl/dlopen (optional - only used to test if the library
> dnl can be used with libdl).
> AC_CHECK_LIB([dl],[dlopen],[have_libdl=yes],[have_libdl=no])
> diff --git a/customize/link.sh.in b/customize/link.sh.in
> index 79dc847..15b6e66 100644
> --- a/customize/link.sh.in
> +++ b/customize/link.sh.in
> @@ -19,4 +19,4 @@
> # Hack automake to link binary properly. There is no other way to add
> # the -cclib parameter to the end of the command line.
>
> -exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> +exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> diff --git a/mllib/link.sh.in b/mllib/link.sh.in
> index 79dc847..15b6e66 100644
> --- a/mllib/link.sh.in
> +++ b/mllib/link.sh.in
> @@ -19,4 +19,4 @@
> # Hack automake to link binary properly. There is no other way to add
> # the -cclib parameter to the end of the command line.
>
> -exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> +exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> diff --git a/sysprep/link.sh.in b/sysprep/link.sh.in
> index 8584faf..7d8ccec 100644
> --- a/sysprep/link.sh.in
> +++ b/sysprep/link.sh.in
> @@ -19,4 +19,4 @@
> # Hack automake to link binary properly. There is no other way to add
> # the -cclib parameter to the end of the command line.
>
> -exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> +exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> diff --git a/v2v/link.sh.in b/v2v/link.sh.in
> index 79dc847..15b6e66 100644
> --- a/v2v/link.sh.in
> +++ b/v2v/link.sh.in
> @@ -19,4 +19,4 @@
> # Hack automake to link binary properly. There is no other way to add
> # the -cclib parameter to the end of the command line.
>
> -exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
> +exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
>
Thanks,
--
Pino Toscano
More information about the Libguestfs
mailing list