build: check for udev and kmod using pkg-config
Using AC_CHECK_LIB is dangerous because it modifies the global LIBS
variable that will be passed to each linker invocation. If care is not
taken, each binary will end up depending on libraries listed in this
variable.
A typical way to avoid this is to save and restore the LIBS variable
before and after the AC_CHECK_LIB function, respectively. That's quite
tedious, though, and often a better solution is to detect the presence
as well as compile and linker flags with pkg-config. This can be done
using the PKG_CHECK_MODULES autoconf macro.
Both udev and kmod ship pkg-config files, so use PKG_CHECK_MODULES for
them.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>