Check OCaml compiler word size
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 29 Apr 2008 12:40:21 +0000 (13:40 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 29 Apr 2008 12:40:21 +0000 (13:40 +0100)
aclocal.m4
configure.ac

index 38ad15f..fad331a 100644 (file)
@@ -168,3 +168,18 @@ else
   $2=no
 fi
 AC_SUBST($2)])
+
+
+dnl AC_CHECK_OCAML_WORD_SIZE(var) sets var=32 or var=64
+dnl according to the compiler word size.
+dnl Contributed by Richard W.M. Jones <rjones@redhat.com>
+dnl XXX This completely fails to deal with cross-compiler case.
+AC_DEFUN([AC_CHECK_OCAML_WORD_SIZE],
+[dnl
+AC_MSG_CHECKING(for OCaml compiler word size)
+cat > conftest.ml <<EOF
+print_endline (string_of_int Sys.word_size)
+EOF
+$1=`ocaml conftest.ml`
+AC_MSG_RESULT($$1)
+AC_SUBST($1)])
index df4cf8c..6800654 100644 (file)
@@ -29,6 +29,8 @@ if test "x$OCAMLFIND" = "x"; then
     AC_MSG_ERROR([OCaml findlib is required])
 fi
 
+AC_CHECK_OCAML_WORD_SIZE(OCAML_WORD_SIZE)
+
 dnl Use ocamlfind to find the required packages ...
 
 dnl Check for required OCaml packages.