In the last example, we used a macro called PKG_CHECK_MODULES. This is not packaged with autoconf by default.
Instead, the pkg-config application provides this macro when it is installed and installs the macro in (typically) /usr/share/aclocal/.
This directory is searched when aclocal is run as part of autogen.sh and all of the relevant macros that are need by configure.in are pulled into aclocal.m4.