Commits

Anonymous committed a0d1d4b

added graphics package compilation check

Comments (0)

Files changed (3)

 config\.status$
 config\.log$
 config\.h$
-config\.h\.in$
 
 src/camlimages\.ml$
 src/META$
 
 ########################################################################
 
-VERSION=3.3.0
+VERSION=4.0.0
 
 # for src/META
 PACKAGE_NAME=camlimages
     OCAMLPACKS+=lablgtk2
     export
 
-  SUPPORT_GRAPHICS = $(Check_ocamlfind_package graphics)
+  # CR: ocamlfind registers graphics even if not available
+  SUPPORT_GRAPHICS = $(Check_ocamlfind_package_compilation graphics, Graphics)
   if $(SUPPORT_GRAPHICS)
     SUPPORTED_NON_FORMATS+=graphics
     OCAMLPACKS+=graphics
 println(ps:       $(SUPPORT_PS) \($(PATH_GS)\))
 println(rgb.txt:  $(SUPPORT_RGB_TXT) \($(PATH_RGB_TXT)\))
 println(lablgtk2: $(SUPPORT_LABLGTK2))
+println(graphics: $(SUPPORT_GRAPHICS))
 println(--- Summary)
 println(supported subpackages:  $(string $(SUPPORTED_SUBPACKAGES)))
 println(supported formats:  $(string $(SUPPORTED_FORMATS)))
   else
     value 8
 
+Check_ocamlfind_package_compilation(package, module) =
+    ConfMsgChecking(Checking $(package) compilability: open $(module))
+    tmp_ml = $(file $(tmpfile omake, .ml))
+    tmp = $(file $(replacesuffixes .ml, $"$(EMPTY)", $(tmp_ml)))
+    command[] = $(OCamlC) -c -package $(package) $(tmp_ml)
+
+    # The program
+    program = $"""(* Configuration file; you can remove this. *)
+open $(module)
+"""
+    
+    # Compile it
+    fprint($(tmp_ml), $(program))
+
+    protected.result = $(shell-success-null $(command))
+
+    rm -f $(tmp_ml) $(tmp).cmi $(tmp).cmo $(tmp)$(EXE)
+
+    return $(ConfMsgYesNo $(result))
+
 #################################################################### build rule
 
 # annot, spot, spit files