--- a/configure.ac +++ b/configure.ac @@ -622,9 +622,10 @@ elif test "x$with_curl" != "xauto"; then fi AC_CHECK_HEADER(curl/curl.h, [libcurl=yes]) if test "x$libcurl" = "xyes"; then - AC_MSG_CHECKING([whether with-curl compiles and links fine]) - AC_TRY_LINK([], [curl_easy_init();], [libcurl=yes], [libcurl=no]) - AC_MSG_RESULT([$libcurl]) + AC_CHECK_LIB([curl], [curl_easy_init], + [libcurl=yes; LIBS="$LIBS -lcurl -lz";], + [libcurl=no], + [-lz]) fi if test "x$libcurl" = "xno"; then CPPFLAGS="$OCPPFLAGS" @@ -680,9 +681,8 @@ elif test "x$with_expat" != "xauto"; the fi AC_CHECK_HEADER(expat.h, [libexpat=yes]) if test "x$libexpat" = "xyes"; then - AC_MSG_CHECKING([whether with-expat compiles and links fine]) - AC_TRY_LINK([], [XML_SetElementHandler();], [libexpat=yes], [libexpat=no]) - AC_MSG_RESULT([$libexpat]) + AC_CHECK_LIB([expat], [XML_SetElementHandler], + [libexpat=yes;LIBS="$LIBS -lexpat";], [libexpat=no]) fi if test "x$libexpat" = "xno"; then CPPFLAGS="$OCPPFLAGS" @@ -691,13 +691,10 @@ elif test "x$with_expat" != "xauto"; the else AC_CHECK_HEADER(expat.h, [libexpat=yes]) if test "x$libexpat" = "xyes"; then - AC_MSG_CHECKING([whether libexpat compiles and links fine]) - OLDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -lexpat" - AC_TRY_LINK([], [XML_SetElementHandler();], [libexpat=yes], [libexpat=no]) - AC_MSG_RESULT([$libexpat]) - if test "x$libexpat" = "xno"; then - LDFLAGS="$OLDFLAGS" + AC_CHECK_LIB([expat], [XML_SetElementHandler], + [libexpat=yes;LIBS="$LIBS -lexpat"], [libexpat=no]) + if test "x$libexpat" = "xyes"; then + LDFLAGS="$LDFLAGS -lexpat" fi fi fi