-dnl ---------------------
-dnl CHECK TERMCAP LIBRARY
-dnl ---------------------
-
-dnl Add the termcap library, so that the following configure
-dnl tests will find it when it tries to link test programs.
-nmh_save_LIBS="$LIBS"
-LIBS="$TERMLIB $LIBS"
-
-dnl Check if tgetent accepts NULL (and will allocate its own termcap buffer)
-dnl Some termcaps reportedly accept a zero buffer, but then dump core
-dnl in tgetstr().
-dnl Under Cygwin test program crashes but exit code is still 0. So,
-dnl we test for a file that porgram should create
-AH_TEMPLATE([TGETENT_ACCEPTS_NULL],
-[Define to 1 if tgetent() accepts NULL as a buffer.])
-AC_CACHE_CHECK(if tgetent accepts NULL,
-nmh_cv_func_tgetent_accepts_null,
-[AC_TRY_RUN([
-main()
-{
- char buf[4096];
- int r1 = tgetent(buf, "vt100");
- int r2 = tgetent((char*)0,"vt100");
- if (r1 >= 0 && r1 == r2) {
- char tbuf[1024], *u;
- u = tbuf;
- tgetstr("cl", &u);
- creat("conftest.tgetent", 0640);
- }
- exit((r1 != r2) || r2 == -1);
-}
-],
- if test -f conftest.tgetent; then
- nmh_cv_func_tgetent_accepts_null=yes
- else
- nmh_cv_func_tgetent_accepts_null=no
- fi,
- nmh_cv_func_tgetent_accepts_null=no,
- nmh_cv_func_tgetent_accepts_null=no)])
-if test x$nmh_cv_func_tgetent_accepts_null = xyes; then
- AC_DEFINE(TGETENT_ACCEPTS_NULL)
-fi
-AC_CACHE_CHECK(if tgetent returns 0 on success,
-nmh_cv_func_tgetent_zero_success,
-[AC_TRY_RUN([
-main()
-{
- char buf[4096];
- int r1 = tgetent(buf, "!@#$%^&*");
- int r2 = tgetent(buf, "vt100");
- if (r1 < 0 && r2 == 0) {
- char tbuf[1024], *u;
- u = tbuf;
- tgetstr("cl", &u);
- creat("conftest.tgetent0", 0640);
- }
- exit(r1 == r2);
-}
-],
- if test -f conftest.tgetent0; then
- nmh_cv_func_tgetent_zero_success=yes
- else
- nmh_cv_func_tgetent_zero_success=no
- fi,
- nmh_cv_func_tgetent_zero_success=no,
- nmh_cv_func_tgetent_zero_success=no)])
-AH_TEMPLATE([TGETENT_SUCCESS],
-[Define to what tgetent() returns on success (0 on HP-UX X/Open curses).])
-if test x$nmh_cv_func_tgetent_zero_success = xyes; then
- AC_DEFINE(TGETENT_SUCCESS, 0)
-else
- AC_DEFINE(TGETENT_SUCCESS, 1)
-fi
+dnl -----------------
+dnl CHECK FOR CURL
+dnl -----------------
+dnl Look for curl if oauth not disabled (--without-oauth).
+AC_PATH_PROG([curl_config], [curl-config])
+AS_IF([test "x$with_oauth" != xno && test -n "$curl_config"], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS `$curl_config --cflags`"
+ AC_CHECK_HEADER([curl/curl.h], [
+ HAVE_CURL_H=1
+ AC_CHECK_LIB([curl], [curl_easy_init], [
+ CURLLIB="`$curl_config --libs`"
+ AC_SUBST([CURLLIB])
+ CURL_USER_AGENT="`$curl_config --version | sed 's|^libcurl *|libcurl/|; q'`"
+ AS_IF([test "x$CURL_USER_AGENT" != "x`echo $CURL_USER_AGENT | sed 's/ //'`"],
+ [AC_MSG_WARN([unexpected curl-config --version: $CURL_USER_AGENT])
+ CURL_USER_AGENT=libcurl/UNKNOWN])
+ echo "HEYEPG ($CURL_USER_AGENT)"
+ AC_SUBST([CURL_USER_AGENT])
+ ])
+ ], [
+ CFLAGS="$save_CFLAGS"
+ ])
+ ])