hivex/hivex-1.2.0-ocaml.patch

154 lines
4.9 KiB
Diff

diff -ur hivex-1.2.0.orig/ChangeLog hivex-1.2.0/ChangeLog
--- hivex-1.2.0.orig/ChangeLog 2010-03-01 13:54:10.000000000 +0000
+++ hivex-1.2.0/ChangeLog 2010-03-01 17:36:51.000000000 +0000
@@ -1,6 +1,9 @@
2010-03-01 Richard Jones <rjones@redhat.com>
Prepare for version 1.2.0.
+ Fix hivexsh_SOURCES.
+
+ Update PO files.
2010-03-01 Daniel Cabrera <logan@fedoraproject.org>
diff -ur hivex-1.2.0.orig/config.h.in hivex-1.2.0/config.h.in
--- hivex-1.2.0.orig/config.h.in 2010-03-01 13:52:10.000000000 +0000
+++ hivex-1.2.0/config.h.in 2010-03-01 17:34:04.000000000 +0000
@@ -70,6 +70,12 @@
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
+/* Defined if function caml_raise_with_args exists. */
+#undef HAVE_CAML_RAISE_WITH_ARGS
+
+/* Define to 1 if you have the <caml/unixsupport.h> header file. */
+#undef HAVE_CAML_UNIXSUPPORT_H
+
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYCURRENT
diff -ur hivex-1.2.0.orig/configure hivex-1.2.0/configure
--- hivex-1.2.0.orig/configure 2010-03-01 13:51:21.000000000 +0000
+++ hivex-1.2.0/configure 2010-03-01 17:33:44.000000000 +0000
@@ -24395,6 +24395,48 @@
fi
+if test "x$OCAMLC" != "xno"; then
+ old_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -I$OCAMLLIB"
+ for ac_header in caml/unixsupport.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "caml/unixsupport.h" "ac_cv_header_caml_unixsupport_h" "
+ #include <caml/config.h>
+ #include <caml/mlvalues.h>
+
+"
+if test "x$ac_cv_header_caml_unixsupport_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_CAML_UNIXSUPPORT_H 1
+_ACEOF
+
+fi
+
+done
+
+ CFLAGS="$old_CFLAGS"
+
+ f=caml_raise_with_args
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $f" >&5
+$as_echo_n "checking for function $f... " >&6; }
+ echo "char $f (); char foo() { return $f (); }" > conftest.c
+ rm -f conftest_ml.ml
+ touch conftest_ml.ml
+ if $OCAMLOPT -c conftest.c 2>/dev/null && \
+ $OCAMLOPT -c conftest_ml.ml 2>/dev/null && \
+ $OCAMLOPT conftest.o conftest_ml.cmx -o conftest 2>/dev/null ; then
+
+$as_echo "#define HAVE_CAML_RAISE_WITH_ARGS 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ fi
+ rm -f conftest conftest.* conftest_ml.*
+fi
+
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
diff -ur hivex-1.2.0.orig/configure.ac hivex-1.2.0/configure.ac
--- hivex-1.2.0.orig/configure.ac 2010-03-01 13:50:23.000000000 +0000
+++ hivex-1.2.0/configure.ac 2010-03-01 17:32:48.000000000 +0000
@@ -167,6 +167,35 @@
AC_PROG_FINDLIB
AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLC" != "xno" -a "x$OCAMLFIND" != "xno"])
+if test "x$OCAMLC" != "xno"; then
+ dnl Check if we have caml/unixsupport.h header (OCaml bindings only).
+ old_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -I$OCAMLLIB"
+ AC_CHECK_HEADERS([caml/unixsupport.h],[],[],
+ [
+ #include <caml/config.h>
+ #include <caml/mlvalues.h>
+ ])
+ CFLAGS="$old_CFLAGS"
+
+ dnl Do we have function caml_raise_with_args?
+ f=caml_raise_with_args
+ AC_MSG_CHECKING([for function $f])
+ echo "char $f (); char foo() { return $f (); }" > conftest.c
+ rm -f conftest_ml.ml
+ touch conftest_ml.ml
+ if $OCAMLOPT -c conftest.c 2>/dev/null && \
+ $OCAMLOPT -c conftest_ml.ml 2>/dev/null && \
+ $OCAMLOPT conftest.o conftest_ml.cmx -o conftest 2>/dev/null ; then
+ AC_DEFINE([HAVE_CAML_RAISE_WITH_ARGS],[1],
+ [Defined if function caml_raise_with_args exists.])
+ AC_MSG_RESULT([found])
+ else
+ AC_MSG_RESULT([not found])
+ fi
+ rm -f conftest conftest.* conftest_ml.*
+fi
+
dnl Check for Perl (optional, for Perl bindings).
dnl XXX This isn't quite right, we should check for Perl devel library.
AC_CHECK_PROG([PERL],[perl],[perl],[no])
diff -ur hivex-1.2.0.orig/ocaml/hivex_c.c hivex-1.2.0/ocaml/hivex_c.c
--- hivex-1.2.0.orig/ocaml/hivex_c.c 2010-02-26 22:33:16.000000000 +0000
+++ hivex-1.2.0/ocaml/hivex_c.c 2010-03-01 17:35:58.000000000 +0000
@@ -40,7 +40,29 @@
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/signals.h>
+
+#ifdef HAVE_CAML_UNIXSUPPORT_H
#include <caml/unixsupport.h>
+#else
+extern value unix_error_of_code (int errcode);
+#endif
+
+#ifndef HAVE_CAML_RAISE_WITH_ARGS
+static void
+caml_raise_with_args (value tag, int nargs, value args[])
+{
+ CAMLparam1 (tag);
+ CAMLxparamN (args, nargs);
+ value bucket;
+ int i;
+
+ bucket = caml_alloc_small (1 + nargs, 0);
+ Field(bucket, 0) = tag;
+ for (i = 0; i < nargs; i++) Field(bucket, 1 + i) = args[i];
+ caml_raise(bucket);
+ CAMLnoreturn;
+}
+#endif
#include <hivex.h>