diff options
author | Yang Tse <yangsita@gmail.com> | 2012-07-02 16:42:54 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-07-02 16:42:54 +0200 |
commit | 069b280f63a2ba5b0f7e751f7319719e6f52f7c7 (patch) | |
tree | b267940df921247c6edcdf334e9e8d9b9f99ee26 /configure.ac | |
parent | 89b431f60fd4d0a91ac120fbb78641f887671606 (diff) | |
download | curl-069b280f63a2ba5b0f7e751f7319719e6f52f7c7.tar.gz |
configure.ac: verify that libmetalink is new enough
Enabling test2017 to test2022.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index da9f75e19..f8771ef83 100644 --- a/configure.ac +++ b/configure.ac @@ -2318,15 +2318,42 @@ if test X"$OPT_LIBMETALINK" != Xno; then fi if test -n "$addlib"; then - AC_MSG_NOTICE([detected libmetalink version $version]) - curl_mtlnk_msg="enabled" - LIBMETALINK_LIBS=$addlib - LIBMETALINK_LDFLAGS=$addld - LIBMETALINK_CFLAGS=$addcflags - AC_SUBST([LIBMETALINK_LIBS]) - AC_SUBST([LIBMETALINK_LDFLAGS]) - AC_SUBST([LIBMETALINK_CFLAGS]) - AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support]) + clean_CPPFLAGS="$CPPFLAGS" + clean_LDFLAGS="$LDFLAGS" + clean_LIBS="$LIBS" + CPPFLAGS="$addcflags $clean_CPPFLAGS" + LDFLAGS="$addld $clean_LDFLAGS" + LIBS="$addlib $clean_LIBS" + AC_MSG_CHECKING([if libmetalink is recent enough]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +# include <metalink/metalink.h> + ]],[[ + if(0 != metalink_strerror(0)) /* added in 0.1.0 */ + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes ($version)]) + want_metalink="yes" + ],[ + AC_MSG_RESULT([no ($version)]) + AC_MSG_NOTICE([libmetalink library defective or too old]) + want_metalink="no" + ]) + CPPFLAGS="$clean_CPPFLAGS" + LDFLAGS="$clean_LDFLAGS" + LIBS="$clean_LIBS" + if test "$want_metalink" = "yes"; then + dnl finally libmetalink will be used + AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support]) + LIBMETALINK_LIBS=$addlib + LIBMETALINK_LDFLAGS=$addld + LIBMETALINK_CFLAGS=$addcflags + AC_SUBST([LIBMETALINK_LIBS]) + AC_SUBST([LIBMETALINK_LDFLAGS]) + AC_SUBST([LIBMETALINK_CFLAGS]) + curl_mtlnk_msg="enabled" + fi fi fi |