Commits

camlspotter committed 421481a

added pkg_config version checker and applied to libgif, but I am afraid libgif is not usually with pkg_config

Comments (0)

Files changed (2)

   LDFLAGS_gif=
   SUPPORT_GIF=false 
   if $(true_if_not_defined ARG_WANT_GIF)
-    if $(not $(pkg_config gif, libgif))
+    if $(not $(pkg_config_between_vers gif, libgif, 4.0.0, 5.0.0))
       HAVE_GIF = $(Check_header_library gif, gif_lib.h, DGifOpenFileName)
       SUPPORT_GIF = $(HAVE_GIF)
       if $(SUPPORT_GIF)
     ConfMsgResult(failed $(PATH_PKG_CONFIG) $(libname))
     value false
   export
+
+# PATH_PKG_CONFIG must be well defined
+pkg_config_version(libname) =
+  value $(shell $(PATH_PKG_CONFIG) $(libname) --modversion) 
+
+pkg_config_between_vers(name, libname, min_ver, too_high_ver) =
+  if $(pkg_config $(name), $(libname))
+    ConfMsgChecking($(libname): $(min_ver) <= version < $(too_high_ver))
+    ver=$(pkg_config_version $(libname)) 
+    if $(and $(le $(cmp-versions $(min_ver), $(ver)), 0), $(lt $(cmp-versions $(ver), $(too_high_ver)), 0))
+      ConfMsgResult($(ver) ... yes)
+      value true
+      export
+    else
+      ConfMsgResult($(ver) ... no)
+      value false # do not export
+    export
+  else
+    value false
+  export