-
Kirill Smelkov authored
Recently I was playing with custom builds of libsqlite3 and neither -lsqlite3 without other options find the library, not the compilation at all works because libsqlite3 headers cannot be found. There is established way to make this all working: by using pkg-config builder can query it for a "package" cflags or libs e.g. this way: $ pkg-config --cflags sqlite3 -I/home/kirr/local/sqlite/include $ pkg-config --libs sqlite3 -L/home/kirr/local/sqlite/lib -lsqlite3 and use so-provided flags for the build. And if the build is not custom pkg-config will just report cflags/libs for a system package: $ pkg-config --cflags sqlite3 $ pkg-config --libs sqlite3 -lsqlite3 Since CGo provides support for pkg-config out of the box [1] we can use it to get proper libsqlite3 CFLAGS/LDFLAGS. I guess FreeBSD flags (added in e90ca0e4) becomes also not needed, because by default pkg-config searches for package descriptions in /usr/local/{lib,share}/pkgconfig too, so I'm switching that to pkg-config too. We leave explicit `-lsqlite3` to be there for non-(linux or freebsd) to support Windows and Mac where pkg-config is probably not available by default. [1] https://golang.org/cmd/cgo/#Shdr-Using_cgo_with_the_go_command
355427a8