remove optional pthread support - it's mandatory now
This commit is contained in:
24
configure.in
24
configure.in
@@ -17,7 +17,6 @@ AC_ARG_WITH(curl, AS_HELP_STRING([--with-curl], [Enable fetching lyrics from the
|
|||||||
AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto])
|
AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto])
|
||||||
AC_ARG_WITH(iconv, AS_HELP_STRING([--with-iconv], [Enable iconv support (Note: if you use utf-8 system wide, you can disable this) @<:@default=auto@:>@]), [iconv=$withval], [iconv=auto])
|
AC_ARG_WITH(iconv, AS_HELP_STRING([--with-iconv], [Enable iconv support (Note: if you use utf-8 system wide, you can disable this) @<:@default=auto@:>@]), [iconv=$withval], [iconv=auto])
|
||||||
AC_ARG_WITH(pdcurses, AS_HELP_STRING([--with-pdcurses[=LIBNAME]], [Link against pdcurses instead of ncurses @<:@default=XCurses@:>@]), [pdcurses=$withval], [pdcurses=no])
|
AC_ARG_WITH(pdcurses, AS_HELP_STRING([--with-pdcurses[=LIBNAME]], [Link against pdcurses instead of ncurses @<:@default=XCurses@:>@]), [pdcurses=$withval], [pdcurses=no])
|
||||||
AC_ARG_WITH(threads, AS_HELP_STRING([--with-threads], [Enable threading support using posix threads @<:@default=auto@:>@]), [threads=$withval], [threads=auto])
|
|
||||||
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
|
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
|
||||||
|
|
||||||
if test "$outputs" = "yes"; then
|
if test "$outputs" = "yes"; then
|
||||||
@@ -71,6 +70,15 @@ PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.1], [
|
|||||||
AC_MSG_ERROR([libmpdclient >= 2.1 is required!])
|
AC_MSG_ERROR([libmpdclient >= 2.1 is required!])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dnl ========================
|
||||||
|
dnl = checking for pthread =
|
||||||
|
dnl ========================
|
||||||
|
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])
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
dnl ======================
|
dnl ======================
|
||||||
dnl = checking for iconv =
|
dnl = checking for iconv =
|
||||||
dnl ======================
|
dnl ======================
|
||||||
@@ -157,17 +165,10 @@ if test "$visualizer" = "yes" ; then
|
|||||||
AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
|
AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl =================================
|
dnl =====================
|
||||||
dnl = checking for curl and pthread =
|
dnl = checking for curl =
|
||||||
dnl =================================
|
dnl =====================
|
||||||
if test "$curl" != "no" ; then
|
if test "$curl" != "no" ; then
|
||||||
if test "$threads" != "no" ; then
|
|
||||||
AC_CHECK_HEADERS([pthread.h], AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
|
|
||||||
if test "$threads" = "yes" ; then
|
|
||||||
AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
|
|
||||||
fi
|
|
||||||
), )
|
|
||||||
fi
|
|
||||||
AC_PATH_PROG(CURL_CONFIG, curl-config)
|
AC_PATH_PROG(CURL_CONFIG, curl-config)
|
||||||
if test "$CURL_CONFIG" != "" ; then
|
if test "$CURL_CONFIG" != "" ; then
|
||||||
CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
|
CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
|
||||||
@@ -190,6 +191,7 @@ if test "$curl" != "no" ; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
dnl =======================
|
dnl =======================
|
||||||
dnl = checking for taglib =
|
dnl = checking for taglib =
|
||||||
dnl =======================
|
dnl =======================
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ namespace
|
|||||||
|
|
||||||
CURLcode Curl::perform(const std::string &URL, std::string &data, unsigned timeout)
|
CURLcode Curl::perform(const std::string &URL, std::string &data, unsigned timeout)
|
||||||
{
|
{
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
pthread_mutex_lock(&lock);
|
pthread_mutex_lock(&lock);
|
||||||
# endif
|
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
CURL *c = curl_easy_init();
|
CURL *c = curl_easy_init();
|
||||||
curl_easy_setopt(c, CURLOPT_URL, URL.c_str());
|
curl_easy_setopt(c, CURLOPT_URL, URL.c_str());
|
||||||
@@ -49,9 +47,7 @@ CURLcode Curl::perform(const std::string &URL, std::string &data, unsigned timeo
|
|||||||
curl_easy_setopt(c, CURLOPT_NOSIGNAL, 1);
|
curl_easy_setopt(c, CURLOPT_NOSIGNAL, 1);
|
||||||
result = curl_easy_perform(c);
|
result = curl_easy_perform(c);
|
||||||
curl_easy_cleanup(c);
|
curl_easy_cleanup(c);
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
pthread_mutex_unlock(&lock);
|
pthread_mutex_unlock(&lock);
|
||||||
# endif
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,6 @@
|
|||||||
|
|
||||||
#ifdef HAVE_CURL_CURL_H
|
#ifdef HAVE_CURL_CURL_H
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_H
|
|
||||||
# include <pthread.h>
|
|
||||||
#endif // HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "curl/curl.h"
|
#include "curl/curl.h"
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,6 @@ namespace Global
|
|||||||
extern size_t MainStartY;
|
extern size_t MainStartY;
|
||||||
extern size_t MainHeight;
|
extern size_t MainHeight;
|
||||||
|
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
extern pthread_mutex_t CurlLock;
|
|
||||||
# endif // HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
extern bool BlockItemListUpdate;
|
extern bool BlockItemListUpdate;
|
||||||
|
|
||||||
extern bool UpdateStatusImmediately;
|
extern bool UpdateStatusImmediately;
|
||||||
|
|||||||
@@ -105,9 +105,6 @@ void ParseArgv(int argc, char **argv)
|
|||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
<< " taglib"
|
<< " taglib"
|
||||||
# endif
|
# endif
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
<< " threads"
|
|
||||||
# endif
|
|
||||||
# ifdef _UTF8
|
# ifdef _UTF8
|
||||||
<< " unicode"
|
<< " unicode"
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
15
src/info.cpp
15
src/info.cpp
@@ -49,9 +49,7 @@ using Global::myOldScreen;
|
|||||||
const std::string Info::Folder = home_path + HOME_FOLDER"artists";
|
const std::string Info::Folder = home_path + HOME_FOLDER"artists";
|
||||||
bool Info::ArtistReady = 0;
|
bool Info::ArtistReady = 0;
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_H
|
|
||||||
pthread_t *Info::Downloader = 0;
|
pthread_t *Info::Downloader = 0;
|
||||||
#endif // HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
#endif // HAVE_CURL_CURL_H
|
#endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
@@ -91,7 +89,7 @@ std::basic_string<my_char_t> Info::Title()
|
|||||||
return TO_WSTRING(itsTitle);
|
return TO_WSTRING(itsTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
|
#ifdef HAVE_CURL_CURL_H
|
||||||
void Info::Update()
|
void Info::Update()
|
||||||
{
|
{
|
||||||
if (!ArtistReady)
|
if (!ArtistReady)
|
||||||
@@ -103,7 +101,7 @@ void Info::Update()
|
|||||||
Downloader = 0;
|
Downloader = 0;
|
||||||
ArtistReady = 0;
|
ArtistReady = 0;
|
||||||
}
|
}
|
||||||
#endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
|
#endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
void Info::GetSong()
|
void Info::GetSong()
|
||||||
{
|
{
|
||||||
@@ -149,7 +147,6 @@ void Info::GetArtist()
|
|||||||
if (!isInitialized)
|
if (!isInitialized)
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
if (Downloader && !ArtistReady)
|
if (Downloader && !ArtistReady)
|
||||||
{
|
{
|
||||||
ShowMessage("Artist info is being downloaded...");
|
ShowMessage("Artist info is being downloaded...");
|
||||||
@@ -157,7 +154,6 @@ void Info::GetArtist()
|
|||||||
}
|
}
|
||||||
else if (ArtistReady)
|
else if (ArtistReady)
|
||||||
Update();
|
Update();
|
||||||
# endif // HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
MPD::Song *s = myScreen->CurrentSong();
|
MPD::Song *s = myScreen->CurrentSong();
|
||||||
|
|
||||||
@@ -179,9 +175,7 @@ void Info::GetArtist()
|
|||||||
w->Reset();
|
w->Reset();
|
||||||
static_cast<Window &>(*w) << "Fetching artist info...";
|
static_cast<Window &>(*w) << "Fetching artist info...";
|
||||||
w->Window::Refresh();
|
w->Window::Refresh();
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
if (!Downloader)
|
if (!Downloader)
|
||||||
# endif // HAVE_PTHREAD_H
|
|
||||||
{
|
{
|
||||||
locale_to_utf(itsArtist);
|
locale_to_utf(itsArtist);
|
||||||
|
|
||||||
@@ -219,13 +213,8 @@ void Info::GetArtist()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
Downloader = new pthread_t;
|
Downloader = new pthread_t;
|
||||||
pthread_create(Downloader, 0, PrepareArtist, this);
|
pthread_create(Downloader, 0, PrepareArtist, this);
|
||||||
# else
|
|
||||||
PrepareArtist(this);
|
|
||||||
w->Flush();
|
|
||||||
# endif // HAVE_PTHREAD_H
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ class Info : public Screen<Scrollpad>
|
|||||||
|
|
||||||
virtual std::basic_string<my_char_t> Title();
|
virtual std::basic_string<my_char_t> Title();
|
||||||
|
|
||||||
# if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
|
# ifdef HAVE_CURL_CURL_H
|
||||||
virtual void Update();
|
virtual void Update();
|
||||||
# endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
|
# endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
virtual void EnterPressed() { }
|
virtual void EnterPressed() { }
|
||||||
virtual void SpacePressed() { }
|
virtual void SpacePressed() { }
|
||||||
@@ -74,9 +74,7 @@ class Info : public Screen<Scrollpad>
|
|||||||
static const std::string Folder;
|
static const std::string Folder;
|
||||||
static bool ArtistReady;
|
static bool ArtistReady;
|
||||||
|
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
static pthread_t *Downloader;
|
static pthread_t *Downloader;
|
||||||
# endif // HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
# endif // HAVE_CURL_CURL_H
|
# endif // HAVE_CURL_CURL_H
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,9 +63,7 @@ bool Lyrics::Reload = 0;
|
|||||||
#ifdef HAVE_CURL_CURL_H
|
#ifdef HAVE_CURL_CURL_H
|
||||||
bool Lyrics::Ready = 0;
|
bool Lyrics::Ready = 0;
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_H
|
|
||||||
pthread_t *Lyrics::Downloader = 0;
|
pthread_t *Lyrics::Downloader = 0;
|
||||||
#endif // HAVE_PTHREAD_H
|
|
||||||
#endif // HAVE_CURL_CURL_H
|
#endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
Lyrics *myLyrics = new Lyrics;
|
Lyrics *myLyrics = new Lyrics;
|
||||||
@@ -85,18 +83,16 @@ void Lyrics::Resize()
|
|||||||
|
|
||||||
void Lyrics::Update()
|
void Lyrics::Update()
|
||||||
{
|
{
|
||||||
# if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
|
# ifdef HAVE_CURL_CURL_H
|
||||||
if (Ready)
|
if (Ready)
|
||||||
Take();
|
Take();
|
||||||
# endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
if (Downloader)
|
if (Downloader)
|
||||||
{
|
{
|
||||||
w->Flush();
|
w->Flush();
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
}
|
}
|
||||||
# endif
|
# endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
if (Reload)
|
if (Reload)
|
||||||
SwitchTo();
|
SwitchTo();
|
||||||
@@ -113,7 +109,7 @@ void Lyrics::SwitchTo()
|
|||||||
if (!isInitialized)
|
if (!isInitialized)
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
# if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
|
# ifdef HAVE_CURL_CURL_H
|
||||||
if (Downloader && !Ready)
|
if (Downloader && !Ready)
|
||||||
{
|
{
|
||||||
ShowMessage("Lyrics are being downloaded...");
|
ShowMessage("Lyrics are being downloaded...");
|
||||||
@@ -121,7 +117,7 @@ void Lyrics::SwitchTo()
|
|||||||
}
|
}
|
||||||
else if (Ready)
|
else if (Ready)
|
||||||
Take();
|
Take();
|
||||||
# endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
|
# endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
const MPD::Song *s = Reload ? myPlaylist->NowPlayingSong() : myScreen->CurrentSong();
|
const MPD::Song *s = Reload ? myPlaylist->NowPlayingSong() : myScreen->CurrentSong();
|
||||||
|
|
||||||
@@ -143,9 +139,9 @@ void Lyrics::SwitchTo()
|
|||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = 1;
|
||||||
w->Clear();
|
w->Clear();
|
||||||
w->Reset();
|
w->Reset();
|
||||||
# ifdef HAVE_PTHREAD_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
if (!Downloader)
|
if (!Downloader)
|
||||||
# endif // HAVE_PTHREAD_H
|
# endif // HAVE_CURL_CURL_H
|
||||||
{
|
{
|
||||||
std::string file = locale_to_utf_cpy(itsSong.GetArtist()) + " - " + locale_to_utf_cpy(itsSong.GetTitle()) + ".txt";
|
std::string file = locale_to_utf_cpy(itsSong.GetArtist()) + " - " + locale_to_utf_cpy(itsSong.GetTitle()) + ".txt";
|
||||||
EscapeUnallowedChars(file);
|
EscapeUnallowedChars(file);
|
||||||
@@ -176,12 +172,9 @@ void Lyrics::SwitchTo()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
|
# ifdef HAVE_CURL_CURL_H
|
||||||
Downloader = new pthread_t;
|
Downloader = new pthread_t;
|
||||||
pthread_create(Downloader, 0, Get, this);
|
pthread_create(Downloader, 0, Get, this);
|
||||||
# elif defined(HAVE_CURL_CURL_H)
|
|
||||||
Get(this);
|
|
||||||
w->Flush();
|
|
||||||
# else
|
# else
|
||||||
*w << "Local lyrics not found. As ncmpcpp has been compiled without curl support, you can put appropriate lyrics into " << Folder << " directory (file syntax is \"$ARTIST - $TITLE.txt\") or recompile ncmpcpp with curl support.";
|
*w << "Local lyrics not found. As ncmpcpp has been compiled without curl support, you can put appropriate lyrics into " << Folder << " directory (file syntax is \"$ARTIST - $TITLE.txt\") or recompile ncmpcpp with curl support.";
|
||||||
w->Flush();
|
w->Flush();
|
||||||
@@ -285,7 +278,7 @@ void Lyrics::FetchAgain()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
|
#ifdef HAVE_CURL_CURL_H
|
||||||
void Lyrics::Take()
|
void Lyrics::Take()
|
||||||
{
|
{
|
||||||
if (!Ready)
|
if (!Ready)
|
||||||
@@ -297,5 +290,5 @@ void Lyrics::Take()
|
|||||||
Downloader = 0;
|
Downloader = 0;
|
||||||
Ready = 0;
|
Ready = 0;
|
||||||
}
|
}
|
||||||
#endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
|
#endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
|
|||||||
@@ -61,15 +61,11 @@ class Lyrics : public Screen<Scrollpad>
|
|||||||
# ifdef HAVE_CURL_CURL_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
static void *Get(void *);
|
static void *Get(void *);
|
||||||
|
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
void Take();
|
void Take();
|
||||||
# endif // HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
static bool Ready;
|
static bool Ready;
|
||||||
|
|
||||||
# ifdef HAVE_PTHREAD_H
|
|
||||||
static pthread_t *Downloader;
|
static pthread_t *Downloader;
|
||||||
# endif // HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
# endif // HAVE_CURL_CURL_H
|
# endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,6 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "scrollpad.h"
|
#include "scrollpad.h"
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_H
|
|
||||||
# include <pthread.h>
|
|
||||||
#else
|
|
||||||
# define pthread_exit(x) return (x)
|
|
||||||
#endif // HAVE_PTHREAD_H
|
|
||||||
|
|
||||||
using namespace NCurses;
|
using namespace NCurses;
|
||||||
|
|
||||||
typedef std::pair<std::string, std::string> string_pair;
|
typedef std::pair<std::string, std::string> string_pair;
|
||||||
|
|||||||
Reference in New Issue
Block a user