enable support for curl and taglib automatically if appropriate headers/libs are available

This commit is contained in:
Andrzej Rybczak
2009-03-29 17:46:31 +02:00
parent 18271fb616
commit ba58bed5be

View File

@@ -11,8 +11,8 @@ AM_PROG_LIBTOOL
AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen]), [clock=$enableval], [clock=no])
AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support]), [unicode=$enableval], [unicode=yes])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor]), [taglib=$withval], [taglib=no])
AC_ARG_WITH(curl, AS_HELP_STRING([--with-curl], [Enable fetching lyrics from the Internet]), [curl=$withval], [curl=no])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor]), [taglib=$withval], [taglib=auto])
AC_ARG_WITH(curl, AS_HELP_STRING([--with-curl], [Enable fetching lyrics from the Internet]), [curl=$withval], [curl=auto])
AC_ARG_WITH(pdcurses, AS_HELP_STRING([--with-pdcurses[=LIBNAME]], [Link against pdcurses instead of ncurses @<:@default=XCurses@:>@]), [pdcurses=$withval], [pdcurses=no])
if test "$clock" = "yes"; then
@@ -78,29 +78,47 @@ AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing ncurses.h header]))
dnl =================================
dnl = checking for curl and pthread =
dnl =================================
if test "$curl" = "yes" ; then
AC_CHECK_HEADERS([pthread.h], AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread", AC_MSG_ERROR([pthread library is required])), )
if test "$curl" != "no" ; then
AC_CHECK_HEADERS([pthread.h], AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread", AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])), )
AC_PATH_PROG(CURL_CONFIG, curl-config)
if test "$CURL_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`", AC_MSG_ERROR([curl library is required]))
AC_CHECK_HEADERS([curl/curl.h], , AC_MSG_ERROR([missing curl.h header]))
AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
if test "$curl" = "yes" ; then
AC_MSG_ERROR([curl library is required])
fi
)
AC_CHECK_HEADERS([curl/curl.h], ,
if test "$curl" = "yes" ; then
AC_MSG_ERROR([missing curl.h header])
fi
)
else
AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl", AC_MSG_ERROR([curl library is required]))
AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
if test "$curl" = "yes" ; then
AC_MSG_ERROR([curl library is required])
fi
)
fi
fi
dnl =======================
dnl = checking for taglib =
dnl =======================
if test "$taglib" = "yes" ; then
if test "$taglib" != "no" ; then
AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
if test "$TAGLIB_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
AC_CHECK_HEADERS([taglib.h], , AC_MSG_ERROR([missing taglib.h header]))
AC_CHECK_HEADERS([taglib.h], ,
if test "$taglib" = "yes" ; then
AC_MSG_ERROR([missing taglib.h header])
fi
)
else
AC_MSG_ERROR([taglib-config executable is missing])
if test "$taglib" = "yes" ; then
AC_MSG_ERROR([taglib-config executable is missing])
fi
fi
fi