make it compile under mingw32 --without-curl --without-taglib

ncmpcpp can be built for windows \o/
pdcurses and regex libraries are needed for this though.
This commit is contained in:
Andrzej Rybczak
2009-03-25 22:08:18 +01:00
parent fcf4a44042
commit 65f52da949
7 changed files with 51 additions and 10 deletions

View File

@@ -19,6 +19,17 @@ if test "$clock" = "yes"; then
AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen]) AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen])
fi fi
dnl ====================================
dnl = checking for win32 related stuff =
dnl ====================================
AC_CHECK_LIB(ws2_32, _head_libws2_32_a, LDFLAGS="$LDFLAGS -lws2_32", )
AC_CHECK_LIB(regex, regcomp, LDFLAGS="$LDFLAGS -lregex", )
dnl ================================
dnl = checking for various headers =
dnl ================================
AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
dnl ====================== dnl ======================
dnl = checking for iconv = dnl = checking for iconv =
dnl ====================== dnl ======================
@@ -51,7 +62,7 @@ else
AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support]) AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
fi fi
AC_PATH_PROG(CURSES_CONFIG, $curses_config_bin) AC_PATH_PROG(CURSES_CONFIG, $curses_config_bin)
if test "$CURSES_CONFIG" != "" ; then if test "$pdcurses" = "XCurses" && test "$CURSES_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`" CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`" LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
AC_CHECK_LIB($curses_lib, initscr, , AC_MSG_ERROR([$curses_lib library is required])) AC_CHECK_LIB($curses_lib, initscr, , AC_MSG_ERROR([$curses_lib library is required]))

View File

@@ -22,7 +22,11 @@
#ifdef HAVE_CURL_CURL_H #ifdef HAVE_CURL_CURL_H
# include <fstream> # include <fstream>
# include <sys/stat.h> # ifdef WIN32
# include <io.h>
# else
# include <sys/stat.h>
# endif // WIN32
# include <pthread.h> # include <pthread.h>
# include "curl/curl.h" # include "curl/curl.h"
# include "helpers.h" # include "helpers.h"
@@ -167,7 +171,11 @@ void *Info::PrepareArtist(void *ptr)
EscapeUnallowedChars(filename); EscapeUnallowedChars(filename);
const string fullpath = Folder + "/" + filename; const string fullpath = Folder + "/" + filename;
mkdir(Folder.c_str(), 0755); mkdir(Folder.c_str()
# ifndef WIN32
, 0755
# endif // !WIN32
);
string result; string result;
std::ifstream input(fullpath.c_str()); std::ifstream input(fullpath.c_str());

View File

@@ -19,7 +19,11 @@
***************************************************************************/ ***************************************************************************/
#include <cstring> #include <cstring>
#include <sys/stat.h> #ifdef WIN32
# include <io.h>
#else
# include <sys/stat.h>
#endif // WIN32
#include <fstream> #include <fstream>
#include "lyrics.h" #include "lyrics.h"
@@ -166,7 +170,11 @@ void *Lyrics::Get(void *song)
EscapeUnallowedChars(filename); EscapeUnallowedChars(filename);
Filename = Folder + "/" + filename; Filename = Folder + "/" + filename;
mkdir(Folder.c_str(), 0755); mkdir(Folder.c_str()
# ifndef WIN32
, 0755
# endif // !WIN32
);
std::ifstream input(Filename.c_str()); std::ifstream input(Filename.c_str());

View File

@@ -180,10 +180,11 @@ int main(int argc, char *argv[])
string screen_title; string screen_title;
timeval now, past; timeval now, past;
// local variables end // local variables end
# ifndef WIN32
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
# endif // !WIN32
gettimeofday(&now, 0); gettimeofday(&now, 0);

View File

@@ -18,7 +18,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/ ***************************************************************************/
#include <sys/stat.h> #ifdef WIN32
# include <io.h>
#else
# include <sys/stat.h>
#endif // WIN32
#include <fstream> #include <fstream>
#include "helpers.h" #include "helpers.h"
@@ -77,7 +81,11 @@ namespace
void CreateConfigDir() void CreateConfigDir()
{ {
mkdir(config_dir.c_str(), 0755); mkdir(config_dir.c_str()
# ifndef WIN32
, 0755
# endif // !WIN32
);
} }
void DefaultKeys(ncmpcpp_keys &keys) void DefaultKeys(ncmpcpp_keys &keys)

View File

@@ -23,6 +23,11 @@
#include "window.h" #include "window.h"
/// FIXME: dirty workaround.
#ifdef WIN32
# define wcwidth(x) 1
#endif // WIN32
using namespace NCurses; using namespace NCurses;
using std::string; using std::string;

View File

@@ -25,9 +25,9 @@
#include <config.h> #include <config.h>
#endif #endif
#ifdef USE_PDCURSES #if !defined(WIN32) && defined(USE_PDCURSES)
# define XCURSES # define XCURSES
#endif #endif // !WIND32 && USE_PDCURSES
#include "curses.h" #include "curses.h"