--- curl-7.58.0/configure.ac.orig	2018-02-12 11:45:28.253147200 +0300
+++ curl-7.58.0/configure.ac	2018-02-12 11:51:12.894795500 +0300
@@ -2618,14 +2618,30 @@
            with_libpsl=$withval,
            with_libpsl=yes)
 if test $with_libpsl != "no"; then
-  AC_SEARCH_LIBS(psl_builtin, psl,
-    [curl_psl_msg="enabled";
-     AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
-     ],
-    [curl_psl_msg="no      (libpsl not found)";
-     AC_MSG_WARN([libpsl was not found])
-     ]
-  )
+  CURL_CHECK_PKGCONFIG(libpsl)
+  if test "$PKGCONFIG" != "no" ; then
+    LIB_PSL=`$PKGCONFIG --libs-only-l libpsl`
+    LD_PSL=`$PKGCONFIG --libs-only-L libpsl`
+    CPP_PSL=`$PKGCONFIG --cflags-only-I libpsl`
+    version=`$PKGCONFIG --modversion libpsl`
+    DIR_PSL=`echo $LD_PSL | $SED -e 's/-L//'`
+    
+    AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
+    LDFLAGS="$LDFLAGS $LD_PSL"
+    CPPFLAGS="$CPPFLAGS $CPP_PSL"
+    LIBS="$LIB_PSL $LIBS"
+  else
+    dnl no nghttp2 pkg-config found, deal with it
+    AC_SEARCH_LIBS(psl_builtin, psl,
+      [curl_psl_msg="yes";
+        AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
+      ],
+      [curl_psl_msg="no      (libpsl not found)";
+        AC_MSG_WARN([libpsl was not found])
+      ]
+    )
+  fi
+
 fi
 AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "enabled"])
 
