diff --git a/daemon/Makefile.am b/daemon/Makefile.am index bb2e58d01..b30153bab 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -374,9 +374,11 @@ OCAML_LIBS = \ -lmlstdutils \ -lmlaugeas \ -lmlhivex \ - -lcamlstr \ - -lunix \ - -l$(CAMLRUN) -ldl -lm + -l$(CAMLSTR) \ + -l$(CAMLUNIX) \ + -l$(CAMLRUN) \ + $(LIBZSTD_LIBS) \ + -ldl -lm CLEANFILES += camldaemon.o diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4 index 29d012a37..18c4cd307 100644 --- a/m4/guestfs-libraries.m4 +++ b/m4/guestfs-libraries.m4 @@ -248,6 +248,9 @@ PKG_CHECK_MODULES([PCRE2], [libpcre2-8], [], [ PCRE_LIBS=`$PCRE2_CONFIG --libs8` ]) +dnl Check for zstd (required since OCaml 5.1) +PKG_CHECK_MODULES([LIBZSTD], [libzstd]) + dnl Check for Augeas >= 1.2.0 (required). PKG_CHECK_MODULES([AUGEAS],[augeas >= 1.2.0]) diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4 index 39a8346f3..25b06408c 100644 --- a/m4/guestfs-ocaml.m4 +++ b/m4/guestfs-ocaml.m4 @@ -122,6 +122,47 @@ if test "x$enable_daemon" = "xyes"; then AC_MSG_ERROR([could not find or link to libasmrun or libcamlrun]) fi AC_SUBST([CAMLRUN]) + + dnl OCaml 5.1 changed -lcamlstr to -lcamlstrnat / -lcamlstrbyt + dnl and -lunix to -lunixnat / -lunixbyt so we need to detect + dnl the new or old libraries. As above we cannot use AC_CHECK_LIB. + AC_MSG_CHECKING([how to link the daemon with -lcamlstr*]) + if test "x$OCAMLOPT" != "xno"; then + choices="camlstrnat camlstr" + else + choices="camlstrbyt camlstr" + fi + for f in $choices; do + if test -f "$OCAMLLIB/lib$f.a"; then + CAMLSTR=$f + break + fi + done + if test "x$CAMLSTR" != "x"; then + AC_MSG_RESULT([$CAMLSTR]) + else + AC_MSG_ERROR([could not find or link to -lcamlstr*]) + fi + AC_SUBST([CAMLSTR]) + + AC_MSG_CHECKING([how to link the daemon with -lunix*]) + if test "x$OCAMLOPT" != "xno"; then + choices="unixnat unix" + else + choices="unixbyt unix" + fi + for f in $choices; do + if test -f "$OCAMLLIB/lib$f.a"; then + CAMLUNIX=$f + break + fi + done + if test "x$CAMLUNIX" != "x"; then + AC_MSG_RESULT([$CAMLUNIX]) + else + AC_MSG_ERROR([could not find or link to -lunix*]) + fi + AC_SUBST([CAMLUNIX]) fi dnl Define HIVEX_OPEN_UNSAFE_FLAG based on test above.