summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-23 03:00:04 +0700
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-22 21:34:54 +0100
commit706a6f88f46a203adfeada1f3d98262d7cc47e47 (patch)
tree3b42d47a03cedc795a64e5fa02ada74f74de5049
parent11fa9174dad72268c5468765ecc81112b1ca95d3 (diff)
bsd compile fixes
-rw-r--r--Makefile.am2
-rw-r--r--cdumb.c6
-rw-r--r--configure.ac6
-rw-r--r--csid.cpp4
-rw-r--r--dumb/dumb-kode54/src/it/itrender.c3
-rw-r--r--junklib.c7
-rw-r--r--main.c2
-rw-r--r--playlist.c4
-rw-r--r--plugins.c2
-rw-r--r--plugins/ffap/ffap.c2
-rw-r--r--plugins/ffmpeg/ffmpeg.c5
-rw-r--r--plugins/nullout/nullout.c4
-rw-r--r--utf8.c2
13 files changed, 43 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 90b873ba..7509601a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,7 +51,7 @@ deadbeef_SOURCES =\
sdkdir = $(pkgincludedir)
sdk_HEADERS = deadbeef.h
-deadbeef_LDADD = $(LDADD) $(DEPS_LIBS) gme/Game_Music_Emu-0.5.2/gme/libgme.a sid/sidplay-libs-2.1.0/libsidplay2.a dumb/libdumb.a -lstdc++
+deadbeef_LDADD = $(LDADD) $(DEPS_LIBS) $(ICONV_LIB) gme/Game_Music_Emu-0.5.2/gme/libgme.a sid/sidplay-libs-2.1.0/libsidplay2.a dumb/libdumb.a -lstdc++ -lm
AM_CFLAGS = $(DEPS_CFLAGS) -I$(gmepath) -std=c99
AM_CPPFLAGS = $(DEPS_CFLAGS) -I$(sidpath)/libsidplay/include -I$(sidpath)/builders/resid-builder/include
diff --git a/cdumb.c b/cdumb.c
index 549063ad..f2a522e8 100644
--- a/cdumb.c
+++ b/cdumb.c
@@ -710,7 +710,11 @@ static const char *convstr (const char* str, int sz) {
cd = iconv_open ("utf8", "utf8");
size_t inbytesleft = sz;
size_t outbytesleft = 2047;
- char *pin = (char*)str;
+#ifdef __linux__
+ char *pin = (char*)str;
+#else
+ const char *pin = str;
+#endif
char *pout = out;
memset (out, 0, sizeof (out));
size_t res = iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft);
diff --git a/configure.ac b/configure.ac
index 38161413..104d8e6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,12 @@ PKG_CHECK_MODULES(ALSA_DEPS, alsa, HAVE_ALSA=1, NO_ALSA=1)
PKG_CHECK_MODULES(FFMPEG_DEPS, libavcodec >= 51.0.0 libavutil libavformat >= 52.0.0, HAVE_FFMPEG=1, NO_FFMPEG=1)
AC_CHECK_LIB([pthread], [main])
AC_CHECK_LIB([dl], [main])
+AC_CHECK_LIB([iconv], [main], [have_iconv=yes], [have_iconv=no])
+if test "x${have_iconv}" = "xyes" ; then
+ICONV_LIB="-liconv"
+ AC_SUBST(ICONV_LIB)
+ AC_DEFINE(HAVE_LIBICONV,1,[Use libiconv instead of glibc iconv])
+fi
AX_CHECK_COMPILER_FLAGS(-msse2, HAVE_SSE2=1, [])
if test ${HAVE_SSE2}; then
diff --git a/csid.cpp b/csid.cpp
index b6903c92..8048ff68 100644
--- a/csid.cpp
+++ b/csid.cpp
@@ -450,7 +450,11 @@ convstr (const char* str) {
else {
size_t inbytesleft = sz;
size_t outbytesleft = 2047;
+#ifdef __linux__
char *pin = (char*)str;
+#else
+ const char *pin = str;
+#endif
char *pout = out;
memset (out, 0, sizeof (out));
size_t res = iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft);
diff --git a/dumb/dumb-kode54/src/it/itrender.c b/dumb/dumb-kode54/src/it/itrender.c
index 2b7d29fc..5dd8e4ef 100644
--- a/dumb/dumb-kode54/src/it/itrender.c
+++ b/dumb/dumb-kode54/src/it/itrender.c
@@ -3537,6 +3537,9 @@ static void process_playing(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playin
}
//static float log2(float x) {return (float)log(x)/(float)log(2.0f);}
+#ifndef __linux__
+static inline float log2(float x) {return (float)log(x)/(float)log(2.0f);}
+#endif
static int delta_to_note(float delta, int base)
{
diff --git a/junklib.c b/junklib.c
index 98f7471e..3439ea59 100644
--- a/junklib.c
+++ b/junklib.c
@@ -23,6 +23,13 @@
#include "playlist.h"
#include "utf8.h"
#include "plugins.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#if HAVE_LIBICONV
+#define iconv_open libiconv_open
+#define iconv_close libiconv_close
+#endif
//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
#define trace(fmt,...)
diff --git a/main.c b/main.c
index 353bcfa1..edbb7186 100644
--- a/main.c
+++ b/main.c
@@ -394,7 +394,9 @@ sigterm_handler (int sig) {
int
main (int argc, char *argv[]) {
srand (time (NULL));
+#ifdef __linux__
prctl (PR_SET_NAME, "deadbeef-main", 0, 0, 0, 0);
+#endif
char *homedir = getenv ("HOME");
if (!homedir) {
fprintf (stderr, "unable to find home directory. stopping.\n");
diff --git a/playlist.c b/playlist.c
index 946ea66c..bce039b4 100644
--- a/playlist.c
+++ b/playlist.c
@@ -26,6 +26,10 @@
#include <unistd.h>
#include <assert.h>
#include <time.h>
+#ifndef __linux__
+#define _POSIX_C_SOURCE
+#endif
+#include <limits.h>
#include "playlist.h"
#include "codec.h"
#include "streamer.h"
diff --git a/plugins.c b/plugins.c
index 06db3aa5..67323d35 100644
--- a/plugins.c
+++ b/plugins.c
@@ -21,7 +21,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
-#include <alloca.h>
+//#include <alloca.h>
#include <string.h>
#ifndef __linux__
#define _POSIX_C_SOURCE
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c
index 53990014..60985729 100644
--- a/plugins/ffap/ffap.c
+++ b/plugins/ffap/ffap.c
@@ -33,7 +33,7 @@
#include <string.h>
#include <limits.h>
#include <stdlib.h>
-#include <alloca.h>
+//#include <alloca.h>
#include <assert.h>
#include "../../deadbeef.h"
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index c87f8cf6..bcaa2632 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <alloca.h>
+//#include <alloca.h>
#include <errno.h>
#include "../../deadbeef.h"
@@ -39,7 +39,10 @@
#include <ffmpeg/avutil.h>
#include <ffmpeg/avstring.h>
#define AVERROR_EOF AVERROR(EPIPE)
+
+#if LIBAVFORMAT_VERSION_MAJOR < 53
#define av_register_protocol register_protocol
+#endif
#endif
diff --git a/plugins/nullout/nullout.c b/plugins/nullout/nullout.c
index e8da5255..8720de6d 100644
--- a/plugins/nullout/nullout.c
+++ b/plugins/nullout/nullout.c
@@ -17,7 +17,9 @@
*/
#include <stdint.h>
#include <unistd.h>
+#ifdef __linux__
#include <sys/prctl.h>
+#endif
#include <stdio.h>
#include <string.h>
#include "../../deadbeef.h"
@@ -164,7 +166,9 @@ pnull_get_endianness (void) {
static void
pnull_thread (void *context) {
+#ifdef __linux__
prctl (PR_SET_NAME, "deadbeef-null", 0, 0, 0, 0);
+#endif
for (;;) {
if (null_terminate) {
break;
diff --git a/utf8.c b/utf8.c
index 19b6a72c..b55bc0de 100644
--- a/utf8.c
+++ b/utf8.c
@@ -23,7 +23,7 @@
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
-#include <alloca.h>
+//#include <alloca.h>
#include "ctype.h"
#include "utf8.h"