Merge branch 'local-ocamlbuild' into local-trunk
[SXSI/xpathcomp.git] / configure
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..c985457
--- /dev/null
+++ b/configure
@@ -0,0 +1,48 @@
+#!/usr/bin/env ocaml
+
+#directory "utils";;
+#use "conf.ml";;
+
+Conf.start ();;
+
+Conf.check_prog "C compiler" "gcc --version";;
+Conf.check_prog "C++ compiler" "g++ --version";;
+let _,version, _ = Conf.prog "Ocaml bytecode compiler" "ocamlc -version";;
+Conf.check "Ocaml version >= 3.11.0" Conf.version version (fun c -> c >= (3,11,0));;
+Conf.check_prog ~required:false "Ocaml native compiler" "ocamlopt -version";;
+Conf.check_prog "ocamlbuild" "ocamlbuild -version";;
+Conf.check_prog "ocamlfind" "ocamlfind printconf";;
+Conf.check_prog "pkg-config" "pkg-config --version";;
+
+Conf.check_prog "libxml++-2.6" "pkg-config --exists libxml++-2.6" ;;
+Conf.check_prog "ulex" "ocamlfind query ulex";;
+Conf.check "XMLTree" (Conf.absolute) ("%s/src/XMLTree/libXMLTree.a") (Sys.file_exists);;
+
+let _, libxmlI, _ = Conf.exec "pkg-config --cflags-only-I libxml++-2.6";;
+let libxmlI = Conf.explode (libxmlI);;
+
+let _, libxmlL, _ = Conf.exec "pkg-config --libs-only-L libxml++-2.6";;
+let libxmlL = Conf.explode (libxmlL);;
+
+let _, libxmll, _ = Conf.exec "pkg-config --libs-only-l libxml++-2.6";;
+let libxmll = Conf.explode (libxmll);;
+
+let libXMLTreeI = [ Conf.absolute "-I%s/src/XMLTree";
+                         Conf.absolute "-I%s/src/XMLTree/libcds/includes";
+                         Conf.absolute "-I%s/src/XMLTree/TextCollection" ]
+;;
+let libXMLTreeL = [ Conf.absolute "-L%s/src/XMLTree" ];;
+let libXMLTreel = [ "-lXMLTree" ];;
+
+let _,ocamlI,_ = Conf.exec "ocamlc -where";;
+let ocamlI = [ "-I" ^ ocamlI ];;
+
+Conf.def_str "cxx_cmd" "g++";;
+
+Conf.def_list "cxx_includes" (libxmlI @ libXMLTreeI @ ocamlI);;
+Conf.def_list "cxx_lpaths" (libxmlL @ libXMLTreeL);;
+Conf.def_list "cxx_libs" ( libXMLTreel @ libxmll );;
+
+
+
+Conf.finish ();;