Skip to content

Instantly share code, notes, and snippets.

@shulima
Last active August 29, 2015 14:17
Show Gist options
  • Save shulima/2feb769e9fcbb2f7a84f to your computer and use it in GitHub Desktop.
Save shulima/2feb769e9fcbb2f7a84f to your computer and use it in GitHub Desktop.
Check whether lcrypt comes from a separate library
diff --git a/builder/Makefile.am b/builder/Makefile.am
index f6225a6..4f64f0b 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -172,7 +172,7 @@ OCAMLCLIBS = \
-L../src/.libs -lutils \
-L../gnulib/lib/.libs -lgnu \
-pthread -lpthread \
- $(LIBTINFO_LIBS) -lcrypt
+ $(LIBTINFO_LIBS) $(LIBCRYPT_LIBS)
if HAVE_OCAMLOPT
virt-builder: $(OBJECTS)
diff --git a/configure b/configure
index 076d323..61c715d 100755
--- a/configure
+++ b/configure
@@ -855,6 +855,7 @@ HAVE_XDR_U_INT64_T_TRUE
HAVE_RPCGEN_FALSE
HAVE_RPCGEN_TRUE
RPCGEN
+LIBCRYPT_LIBS
EXTRA_PACKAGES
DISTRO
SUPERMIN_EXTRA_OPTIONS
@@ -52641,6 +52642,69 @@ fi
+old_LIBS="$LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing crypt" >&5
+$as_echo_n "checking for library containing crypt... " >&6; }
+if ${ac_cv_search_crypt+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char crypt ();
+int
+main ()
+{
+return crypt ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' crypt; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_crypt=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_crypt+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_crypt+:} false; then :
+
+else
+ ac_cv_search_crypt=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_crypt" >&5
+$as_echo "$ac_cv_search_crypt" >&6; }
+ac_res=$ac_cv_search_crypt
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+LIBS="$old_LIBS"
+if test "$ac_cv_search_crypt" = "-lcrypt" ; then
+ LIBCRYPT_LIBS="-lcrypt"
+fi
+
+
# Extract the first word of "rpcgen", so it can be a program name with args.
set dummy rpcgen; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 634934d..80fedd4 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -121,7 +121,7 @@ OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
OCAMLCLIBS = \
- $(LIBXML2_LIBS) $(LIBINTL) $(LIBTINFO_LIBS) -lcrypt \
+ $(LIBXML2_LIBS) $(LIBINTL) $(LIBTINFO_LIBS) $(LIBCRYPT_LIBS) \
-L../src/.libs -lutils \
-L../gnulib/lib/.libs -lgnu
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index c4e64d2..8b6ceb4 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -99,7 +99,7 @@ OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
OCAMLCLIBS = \
- $(LIBXML2_LIBS) $(LIBINTL) $(LIBTINFO_LIBS) -lcrypt \
+ $(LIBXML2_LIBS) $(LIBINTL) $(LIBTINFO_LIBS) $(LIBCRYPT_LIBS) \
-L../src/.libs -lutils \
-L../gnulib/lib/.libs -lgnu
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 3ee0469..01b6ab8 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -135,7 +135,7 @@ OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
OCAMLCLIBS = \
- $(LIBXML2_LIBS) $(LIBINTL) $(LIBTINFO_LIBS) -lcrypt \
+ $(LIBXML2_LIBS) $(LIBINTL) $(LIBTINFO_LIBS) $(LIBCRYPT_LIBS) \
-L../src/.libs -lutils \
-L../gnulib/lib/.libs -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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment