@@ -719,18 +719,10 @@ let operating_system, osdeplibs =
719
719
720
720
(* * * lablgtk2 and CoqIDE *)
721
721
722
- type source = Manual | OCamlFind | Stdlib
723
-
724
- let get_source = function
725
- | Manual -> " manually provided"
726
- | OCamlFind -> " via ocamlfind"
727
- | Stdlib -> " in OCaml library"
728
-
729
722
(* * Is some location a suitable LablGtk2 installation ? *)
730
723
731
- let check_lablgtkdir ?(fatal =false ) src dir =
724
+ let check_lablgtkdir ?(fatal =false ) msg dir =
732
725
let yell msg = if fatal then die msg else (printf " %s\n " msg; false ) in
733
- let msg = get_source src in
734
726
if not (dir_exists dir) then
735
727
yell (sprintf " No such directory '%s' (%s)." dir msg)
736
728
else if not (Sys. file_exists (dir/ " gSourceView2.cmi" )) then
@@ -744,46 +736,22 @@ let check_lablgtkdir ?(fatal=false) src dir =
744
736
let get_lablgtkdir () =
745
737
match ! Prefs. lablgtkdir with
746
738
| Some dir ->
747
- let msg = Manual in
739
+ let msg = " manually provided " in
748
740
if check_lablgtkdir ~fatal: true msg dir then dir, msg
749
- else " " , msg
741
+ else " " , " "
750
742
| None ->
751
- let msg = OCamlFind in
743
+ let msg = " via ocamlfind " in
752
744
let d1,_ = tryrun " ocamlfind" [" query" ;" lablgtk2.sourceview2" ] in
753
745
if d1 <> " " && check_lablgtkdir msg d1 then d1, msg
754
746
else
755
747
(* In debian wheezy, ocamlfind knows only of lablgtk2 *)
756
748
let d2,_ = tryrun " ocamlfind" [" query" ;" lablgtk2" ] in
757
749
if d2 <> " " && d2 <> d1 && check_lablgtkdir msg d2 then d2, msg
758
750
else
759
- let msg = Stdlib in
751
+ let msg = " in OCaml library " in
760
752
let d3 = camllib^ " /lablgtk2" in
761
753
if check_lablgtkdir msg d3 then d3, msg
762
- else " " , msg
763
-
764
- (* * Detect and/or verify the Lablgtk2 version *)
765
-
766
- let check_lablgtk_version src dir = match src with
767
- | Manual | Stdlib ->
768
- let test accu f =
769
- if accu then
770
- let test = sprintf " grep -q -w %s %S/glib.mli" f dir in
771
- Sys. command test = 0
772
- else false
773
- in
774
- let heuristics = [
775
- " convert_with_fallback" ;
776
- " wrap_poll_func" ; (* * Introduced in lablgtk 2.16 *)
777
- ] in
778
- let ans = List. fold_left test true heuristics in
779
- if ans then printf " Warning: could not check the version of lablgtk2.\n " ;
780
- (ans, " an unknown version" )
781
- | OCamlFind ->
782
- let v, _ = tryrun " ocamlfind" [" query" ; " -format" ; " %v" ; " lablgtk2" ] in
783
- try
784
- let vi = List. map s2i (numeric_prefix_list v) in
785
- ([2 ; 16 ] < = vi, v)
786
- with _ -> (false , v)
754
+ else " " , " "
787
755
788
756
let pr_ide = function No -> " no" | Byte -> " only bytecode" | Opt -> " native"
789
757
@@ -807,9 +775,9 @@ let check_coqide () =
807
775
if ! Prefs. coqide = Some No then set_ide No " CoqIde manually disabled" ;
808
776
let dir, via = get_lablgtkdir () in
809
777
if dir = " " then set_ide No " LablGtk2 not found" ;
810
- let (ok, version) = check_lablgtk_version via dir in
811
- let found = sprintf " LablGtk2 found (%s, %s) " (get_source via) version in
812
- if not ok then set_ide No (found^ " , but too old (required >= 2.16, found " ^ version ^ " ) " );
778
+ let found = sprintf " LablGtk2 found (%s) " via in
779
+ let test = sprintf " grep -q -w convert_with_fallback %S/glib.mli " dir in
780
+ if Sys. command test <> 0 then set_ide No (found^ " but too old" );
813
781
(* We're now sure to produce at least one kind of coqide *)
814
782
lablgtkdir := shorten_camllib dir;
815
783
if ! Prefs. coqide = Some Byte then set_ide Byte (found^ " , bytecode requested" );
0 commit comments