Use curl-config to locate lib curl when possible

If libcurl.a is located on a non-standard path, the test for libcurl in the configure script fails, even if the path is specified in LDFLAGS.

To work around this we can use curl-config to provide the needed path and link options to the compiler.

This patch modifies configure.ac to check for curl-config and use its output as an argument to AC\_CHECK\_LIB if possible.

Review: https://reviews.apache.org/r/24407
Minor style fixes from: https://reviews.apache.org/r/24407/