Also, it is not clear to me what is the purpose of the following check in configure.ac:
AC_CHECK_LIB(curl, curl_easy_init, ,
<------>AC_MSG_ERROR([Could not find curl library - please install libcurl-dev]))
it comes *before* PKGCONFIG detection, so unless curl is installed in a standard location it just can't succeed. Also, LIBCURL_CPPFLAGS / LIBCURL_LIBS are substituted after the pkgconfig check, and if the check fails, then configure fails. So they don't make much sense, because if pkgconfig is non-existant or doesn't find the lib, it will AC_MSG_ERROR.
LIBCURL_CFLAGS
C compiler flags for LIBCURL, overriding pkg-config
LIBCURL_LIBS
linker flags for LIBCURL, overriding pkg-config
My suggestions:
1) Only pkgconfig if LIBCURL_CPPFLAGS / LIBCURL_LIBS are NOT set
2) Move AC_CHECK_LIB *after* pkgconfig
3) Add LIBCURL_CPPFLAGS / LIBCURL_LIBS to CPPFLAGS / LDFLAGS before AC_CHECK_LIB and restore afterwards
Right now I basically can't compile cgminer against a statically linked libcurl.a
