2 # add output to var $(2)
3 # return resulting (non-empty) string if library is present
4 # if $(2) = "" -- don't add flags, just return
5 # [ lib-config-ex "pkg-config sdl --cflags" : "CFLAGS" ]
8 cf = [ Command "$(1) 2>/dev/null" : parse-output exit-code code-first ] ;
9 if $(cf[1]) = "0" && $(cf[2]) {
21 # call $(1) --cflags and $(1) --libs (many libs provides such configurators)
22 # add necessary flags to compiler and linker vars
23 # return "tan" (non-empty string) if library is present
24 # if $(2) != "" -- don't add flags, just check
25 # [ lib-config "pkg-config sdl" ]
29 cf = [ Command "$(1) --cflags 2>/dev/null" : parse-output exit-code code-first ] ;
31 if $(cf[1]) = "0" && $(cf[2]) {
33 #Echo "flags:" $(cf[2-]) ;
35 CCFLAGS += $(cf[2-]) ;
36 C++FLAGS += $(cf[2-]) ;
37 OBJCFLAGS += $(cf[2-]) ;
41 lf = [ Command "$(1) --libs 2>/dev/null" : parse-output exit-code code-first ] ;
43 if $(lf[1]) = "0" && $(lf[2]) {
45 #Echo "flags:" $(lf[2-]) ;
47 LINKFLAGS += $(lf[2-]) ;
48 C++LINKFLAGS += $(lf[2-]) ;
49 OBJCLINKFLAGS += $(lf[2-]) ;
58 res = [ lib-config "pkg-config $(1)" ] ;
65 res = [ lib-config-ex "pkg-config $(1) --cflags --libs" ] ;