build: always call PKG_PROG_PKG_CONFIG in configure

pkg-config will be used for detecting 'curses' library in a future
commit. We have been using pkg-config for detecting multiple libraries
('hwloc' and formerly 'libnl'), thus the PKG_PROG_PKG_CONFIG macro
should be called early.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
diff --git a/configure.ac b/configure.ac
index 3bbaa71..f0bf7e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -379,6 +379,13 @@
 # Checks for cross-platform features and flags.
 # ----------------------------------------------------------------------
 
+dnl PKG_PROG_PKG_CONFIG initializes $PKG_CONFIG and related variables.
+dnl If the macro is not called, some pkg-config checks might be skipped
+dnl and $PKG_CONFIG might be unset.
+m4_ifdef([PKG_PROG_PKG_CONFIG], [
+   PKG_PROG_PKG_CONFIG()
+])
+
 # HTOP_CHECK_SCRIPT(LIBNAME, FUNCTION, DEFINE, CONFIG_SCRIPT, ELSE_PART)
 m4_define([HTOP_CHECK_SCRIPT],
 [
@@ -569,7 +576,6 @@
       ;;
    yes)
       m4_ifdef([PKG_PROG_PKG_CONFIG], [
-         PKG_PROG_PKG_CONFIG()
          PKG_CHECK_MODULES(HWLOC, hwloc, [
                AM_CFLAGS="$AM_CFLAGS $HWLOC_CFLAGS"
                LIBS="$LIBS $HWLOC_LIBS"