From: Stefano Zacchiroli <zack@debian.org>
Date: Sat, 3 Mar 2012 12:25:40 +0100
Subject: Use camlp5

Build (and install) using camlp5 instead of camlp4.

Signed-off-by: Stefano Zacchiroli <zack@debian.org>
Signed-off-by: Stephane Glondu <steph@glondu.net>
---
 META           |    2 +-
 Makefile       |    8 ++++----
 README         |    2 +-
 mk_pa_ulex.ml  |    6 ------
 pa_ulex.ml.src |    2 +-
 5 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/META b/META
index 416de11..b2f25ef 100644
--- a/META
+++ b/META
@@ -1,5 +1,5 @@
 version = "0.8"
-requires = "camlp4"
+requires = "camlp5"
 description = "Runtime support for ulex"
 archive(byte) = "ulexing.cma"
 archive(native) = "ulexing.cmxa"
diff --git a/Makefile b/Makefile
index aa29315..86c5e43 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ ulexing.cmxa: $(ULEXING)
 	ocamlopt -a -o ulexing.cmxa $(ULEXING)
 
 pa_ulex.cma: $(ULEX)
-	ocamlc -a -o pa_ulex.cma -pp 'camlp4o pa_extend.cmo q_MLast.cmo' -I +camlp4 $(ULEX)
+	ocamlc -a -o pa_ulex.cma -pp 'camlp5o pa_extend.cmo q_MLast.cmo' -I +camlp5 $(ULEX)
 
 pa_ulex.ml: pa_ulex.ml.src
 	ocaml mk_pa_ulex.ml
@@ -29,14 +29,14 @@ clean:
 	rm -f *.cm* *~ test custom_ulexing *.o *.a *.html *.css pa_ulex.ml
 
 view_test: pa_ulex.cma
-	camlp4o ./pa_ulex.cma pr_o.cmo -sep "\n" test.ml
+	camlp5o ./pa_ulex.cma pr_o.cmo -sep "\n" test.ml
 
 run_test: ulexing.cma pa_ulex.cma
-	ocamlc -o test -pp 'camlp4o ./pa_ulex.cma' ulexing.cma test.ml
+	ocamlc -o test -pp 'camlp5o ./pa_ulex.cma' ulexing.cma test.ml
 	./test
 
 custom_ulexing: ulexing.cma pa_ulex.cma
-	ocamlc -o custom_ulexing -pp 'camlp4o ./pa_ulex.cma' ulexing.cma custom_ulexing.ml
+	ocamlc -o custom_ulexing -pp 'camlp5o ./pa_ulex.cma' ulexing.cma custom_ulexing.ml
 
 
 doc:
diff --git a/README b/README
index f5eee7b..52080e0 100644
--- a/README
+++ b/README
@@ -142,7 +142,7 @@ Installation:
 
 Compilation of OCaml files with lexer specifications:
 
-  ocamlfind ocamlc -c -package ulex -syntax camlp4o my_file.ml
+  ocamlfind ocamlc -c -package ulex -syntax camlp5o my_file.ml
 
 When linking, you must also include the ulex package:
   ocamlfind ocamlc -o my_prog -linkpkg -package ulex my_file.cmo
diff --git a/mk_pa_ulex.ml b/mk_pa_ulex.ml
index e9d7159..c36c84c 100644
--- a/mk_pa_ulex.ml
+++ b/mk_pa_ulex.ml
@@ -1,10 +1,4 @@
 let s = float_of_string (String.sub (Sys.ocaml_version) 0 4) in
-if (s < 3.09) then (
   print_endline "Old camlp4 (loc)";
   Sys.command "sed s/_loc/loc/ < pa_ulex.ml.src > pa_ulex.ml"
-)
-else  (
-  print_endline "New camlp4 (_loc)";
-  Sys.command "cp pa_ulex.ml.src pa_ulex.ml"
-)
 
diff --git a/pa_ulex.ml.src b/pa_ulex.ml.src
index a56bd01..b8e1cd6 100644
--- a/pa_ulex.ml.src
+++ b/pa_ulex.ml.src
@@ -1,4 +1,4 @@
-let _loc = (Lexing.dummy_pos,Lexing.dummy_pos)
+let _loc = Stdpp.dummy_loc
 
 (* Named regexp *)
 
-- 
