diff --git a/daemon/autogen.sh b/daemon/autogen.sh
index 5ff82d15c74b7185ea5787834c2afa11d8fe69da..6980c6c34d9c42abfb0dcf4f962b2642e80f2425 100755
--- a/daemon/autogen.sh
+++ b/daemon/autogen.sh
@@ -6,11 +6,10 @@ if test -z $AUTORECONF; then
         exit 1
 fi
 
-PKGCONFIG=`which pkg-config`
-if test -z $PKGCONFIG; then
-        echo "*** No pkg-config found, please install it ***"
-        # warn without exiting, since pkg-config is only needed
-        # by configure, not autogen.sh
+if !"${PKG_CONFIG:-pkg-config}" --version >/dev/null 2>&1; then
+    echo "*** No pkg-config found, please install it ***"
+    # warn without exiting, since pkg-config is only needed
+    # by configure, not autogen.sh
 fi
 
 LIBTOOLIZE=`which libtoolize || which glibtoolize`