From ba58bed5beef165f418a72e7348ed0d3dc725874 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 29 Mar 2009 17:46:31 +0200 Subject: [PATCH] enable support for curl and taglib automatically if appropriate headers/libs are available --- configure.in | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/configure.in b/configure.in index 3e2989d7..ed95a27d 100644 --- a/configure.in +++ b/configure.in @@ -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