summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Salinger ext:(%20) <Petr.Salinger@seznam.cz>2007-11-19 17:42:21 +0000
committerPetr Salinger ext:(%20) <Petr.Salinger@seznam.cz>2007-11-19 17:42:21 +0000
commitff8930972b4242d31e540a38f1d8053e846d68e6 (patch)
treed91fbd6ed9cb6930f81faa7a3d9884acf8c0d4a1
parentcbaade083f6378381a96eacf76b0d2a522c675ae (diff)
downloadxine-lib-ff8930972b4242d31e540a38f1d8053e846d68e6.tar.gz
xine-lib-ff8930972b4242d31e540a38f1d8053e846d68e6.tar.bz2
add support for GNU/kFreeBSD
It changes some "defined (__FreeBSD__)" into "defined (__FreeBSD_kernel__)" and "__FreeBSD_version" into "__FreeBSD_kernel_version". The changes are performed on places, where feature of kernel is tested. On some other places, feature of userland/libc is tested, on them "defined (__FreeBSD__)" remains. As proposed, include/configure.h cause __FreeBSD_kernel__ be defined if __FreeBSD__ is defined. --HG-- extra : transplant_source : %25%96K%05%E4Y%B15%94%60%15%FE1%8Ah%26Xy%8C/
-rw-r--r--configure.ac22
-rw-r--r--src/input/input_cdda.c23
-rw-r--r--src/input/input_vcd.c18
-rw-r--r--src/input/libdvdnav/dvd_reader.c2
-rw-r--r--src/input/media_helper.c4
-rw-r--r--src/input/vcd/libcdio/FreeBSD/freebsd.c1
-rw-r--r--src/input/vcd/libcdio/FreeBSD/freebsd.h2
-rw-r--r--src/libw32dll/wine/ldt_keeper.c10
-rw-r--r--src/libw32dll/wine/win32.c4
-rw-r--r--src/video_out/libdha/ports.c2
-rw-r--r--src/xine-engine/xine.c2
-rw-r--r--src/xine-engine/xine_interface.c2
12 files changed, 54 insertions, 38 deletions
diff --git a/configure.ac b/configure.ac
index f0561f927..3b4c6c191 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1143,7 +1143,7 @@ if test "x$check_vidix" = "xyes" -a "x$ac_cv_prog_AWK" != "xno"; then
enable_vidix="yes"
enable_linux="yes"
;;
- i?86-*-freebsd* | k?-*-freebsd* | athlon-*-freebsd*)
+ i?86-*-freebsd* | k?-*-freebsd* | athlon-*-freebsd* | i?86-*-kfreebsd*)
enable_vidix="yes"
enable_dha_kmod="no"
;;
@@ -1885,7 +1885,7 @@ int has_timeout=sizeof(test.timeout);]])],
AC_DEFINE([HAVE_WIN32_CDROM], [1],
[Define 1 if you have MinGW CD-ROM support])
;;
- freebsd4.*)
+ freebsd4.*|kfreebsd*-gnu)
AC_DEFINE([HAVE_FREEBSD_CDROM], [1],
[Define 1 if you have FreeBSD CD-ROM support])
;;
@@ -2588,6 +2588,24 @@ case $host in
esac
AC_SUBST([NOUNDEF])
+
+dnl signal FreeBSD have also FreeBSD based kernel.
+dnl
+
+AH_BOTTOM([
+#if defined (__FreeBSD__) && !defined (__FreeBSD_kernel__)
+#define __FreeBSD_kernel__ __FreeBSD__
+#endif
+
+#if defined (__FreeBSD_kernel__)
+#include <sys/param.h>
+# if defined (__FreeBSD_version) && !defined (__FreeBSD_kernel_version)
+# define __FreeBSD_kernel_version __FreeBSD_version
+# endif
+#endif
+])
+
+
dnl Common cflags for all platforms
CFLAGS="-D_REENTRANT -D_FILE_OFFSET_BITS=64 -DXINE_COMPILE \$(MULTIPASS_CFLAGS) $warnflags $CFLAGS"
DEBUG_CFLAGS="-D_REENTRANT -D_FILE_OFFSET_BITS=64 -DXINE_COMPILE $DEBUG_CFLAGS"
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index 35650c858..5f830a1d3 100644
--- a/src/input/input_cdda.c
+++ b/src/input/input_cdda.c
@@ -612,7 +612,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
return 0;
}
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD_kernel__) || defined(__NetBSD__)
#include <sys/cdio.h>
@@ -623,7 +623,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
static int read_cdrom_toc(int fd, cdrom_toc *toc) {
struct ioc_toc_header tochdr;
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
struct ioc_read_toc_single_entry tocentry;
#elif defined(__NetBSD__)
struct ioc_read_toc_entry tocentry;
@@ -654,7 +654,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
memset(&tocentry, 0, sizeof(tocentry));
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
tocentry.track = i;
tocentry.address_format = CD_MSF_FORMAT;
if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) {
@@ -673,7 +673,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
}
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
toc->toc_entries[i-1].track_mode = (tocentry.entry.control & 0x04) ? 1 : 0;
toc->toc_entries[i-1].first_frame_minute = tocentry.entry.addr.msf.minute;
toc->toc_entries[i-1].first_frame_second = tocentry.entry.addr.msf.second;
@@ -697,7 +697,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
/* fetch the leadout as well */
memset(&tocentry, 0, sizeof(tocentry));
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
tocentry.track = CD_LEADOUT_TRACK;
tocentry.address_format = CD_MSF_FORMAT;
if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) {
@@ -716,7 +716,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) {
}
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
toc->leadout_track.track_mode = (tocentry.entry.control & 0x04) ? 1 : 0;
toc->leadout_track.first_frame_minute = tocentry.entry.addr.msf.minute;
toc->leadout_track.first_frame_second = tocentry.entry.addr.msf.second;
@@ -745,8 +745,8 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
int fd = this_gen->fd;
while( num_frames ) {
-#if defined(__FreeBSD__)
-#if __FreeBSD_version < 501106
+#if defined(__FreeBSD_kernel__)
+#if __FreeBSD_kernel_version < 501106
struct ioc_read_audio cdda;
cdda.address_format = CD_MSF_FORMAT;
@@ -755,13 +755,10 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f
cdda.address.msf.frame = frame % CD_FRAMES_PER_SECOND;
cdda.nframes = 1;
cdda.buffer = data;
-#endif
-
-#if __FreeBSD_version >= 501106
- if (pread(fd, data, CD_RAW_FRAME_SIZE, frame * CD_RAW_FRAME_SIZE) != CD_RAW_FRAME_SIZE) {
-#else
/* read a frame */
if(ioctl(fd, CDIOCREADAUDIO, &cdda) < 0) {
+#else
+ if (pread(fd, data, CD_RAW_FRAME_SIZE, frame * CD_RAW_FRAME_SIZE) != CD_RAW_FRAME_SIZE) {
#endif
perror("CDIOCREADAUDIO");
return -1;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 31ba90436..007fa5946 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.c
@@ -37,7 +37,7 @@
#ifdef HAVE_SYS_CDIO_H
# include <sys/cdio.h>
/* TODO: not clean yet */
-# if defined (__FreeBSD__)
+# if defined (__FreeBSD_kernel__)
# include <sys/cdrio.h>
# endif
#endif
@@ -92,7 +92,7 @@ typedef struct {
#if defined (__linux__) || defined(__sun)
struct cdrom_tochdr tochdr;
struct cdrom_tocentry tocent[100];
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD_kernel__)
struct ioc_toc_header tochdr;
struct cd_toc_entry *tocent;
off_t cur_sec;
@@ -117,7 +117,7 @@ typedef struct {
int cur_track;
-#if defined (__linux__) || defined(__sun) || defined(__FreeBSD__)
+#if defined (__linux__) || defined(__sun) || defined (__FreeBSD_kernel__)
uint8_t cur_min, cur_sec, cur_frame;
#endif
@@ -177,7 +177,7 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) {
return 0;
}
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD_kernel__)
static int input_vcd_read_toc (vcd_input_class_t *this, int fd) {
struct ioc_read_toc_entry te;
@@ -393,7 +393,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen,
memcpy (buf, data.data, VCDSECTORSIZE); /* FIXME */
return VCDSECTORSIZE;
}
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD_kernel__)
static off_t vcd_plugin_read (input_plugin_t *this_gen,
char *buf, off_t nlen) {
vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen;
@@ -531,7 +531,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
memcpy (buf->mem, data.data, VCDSECTORSIZE); /* FIXME */
return buf;
}
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD_kernel__)
static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
fifo_buffer_t *fifo, off_t nlen) {
@@ -690,7 +690,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
return offset ; /* FIXME */
}
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD_kernel__)
static off_t vcd_plugin_seek (input_plugin_t *this_gen,
off_t offset, int origin) {
@@ -764,7 +764,7 @@ static off_t vcd_plugin_get_length (input_plugin_t *this_gen) {
return (off_t) 0;
}
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD_kernel__)
static off_t vcd_plugin_get_length (input_plugin_t *this_gen) {
vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen;
off_t len ;
@@ -859,7 +859,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen) {
this->cur_min = this->cls->tocent[this->cur_track].cdte_addr.msf.minute;
this->cur_sec = this->cls->tocent[this->cur_track].cdte_addr.msf.second;
this->cur_frame = this->cls->tocent[this->cur_track].cdte_addr.msf.frame;
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD_kernel__)
{
int bsize = 2352;
if (ioctl (this->fd, CDRIOCSETBLOCKSIZE, &bsize) == -1) {
diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c
index 1cf493ef1..200a1dbec 100644
--- a/src/input/libdvdnav/dvd_reader.c
+++ b/src/input/libdvdnav/dvd_reader.c
@@ -58,7 +58,7 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz )
#define lseek64 _lseeki64
#endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
+#if defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
#define SYS_BSD 1
#endif
diff --git a/src/input/media_helper.c b/src/input/media_helper.c
index d2b1772a4..288ed4205 100644
--- a/src/input/media_helper.c
+++ b/src/input/media_helper.c
@@ -36,7 +36,7 @@
#include <unistd.h>
#include <string.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
#include <sys/cdio.h> /* CDIOCALLOW etc... */
#elif defined(HAVE_LINUX_CDROM_H)
#include <linux/cdrom.h>
@@ -130,7 +130,7 @@ int media_eject_media (xine_t *xine, const char *device)
return 0;
}
-#elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__)
+#elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD_kernel__)
if (ioctl(fd, CDIOCALLOW) == -1) {
xprintf(xine, XINE_VERBOSITY_DEBUG, "ioctl(cdromallow): %s\n", strerror(errno));
diff --git a/src/input/vcd/libcdio/FreeBSD/freebsd.c b/src/input/vcd/libcdio/FreeBSD/freebsd.c
index daea9b3f5..5a3443e95 100644
--- a/src/input/vcd/libcdio/FreeBSD/freebsd.c
+++ b/src/input/vcd/libcdio/FreeBSD/freebsd.c
@@ -29,6 +29,7 @@
static const char _rcsid[] = "$Id: freebsd.c,v 1.1 2005/01/01 02:43:57 rockyb Exp $";
+#include <arpa/inet.h>
#include "freebsd.h"
#ifdef HAVE_FREEBSD_CDROM
diff --git a/src/input/vcd/libcdio/FreeBSD/freebsd.h b/src/input/vcd/libcdio/FreeBSD/freebsd.h
index 50894c912..bdbad406d 100644
--- a/src/input/vcd/libcdio/FreeBSD/freebsd.h
+++ b/src/input/vcd/libcdio/FreeBSD/freebsd.h
@@ -78,7 +78,7 @@ struct ioc_read_audio
#include <sys/ioctl.h>
#include <sys/param.h> /* for __FreeBSD_version */
-#if __FreeBSD_version < 500000
+#if __FreeBSD_kernel_version < 500000
#define DEVICE_POSTFIX "c"
#else
#define DEVICE_POSTFIX ""
diff --git a/src/libw32dll/wine/ldt_keeper.c b/src/libw32dll/wine/ldt_keeper.c
index 0446d8634..39f1e0f49 100644
--- a/src/libw32dll/wine/ldt_keeper.c
+++ b/src/libw32dll/wine/ldt_keeper.c
@@ -78,7 +78,7 @@ int modify_ldt(int func, void *ptr, unsigned long bytecount);
}
#endif
#else
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
#include <machine/segments.h>
#include <machine/sysarch.h>
#endif
@@ -153,7 +153,7 @@ void Setup_FS_Segment(ldt_fs_t *ldt_fs)
void Check_FS_Segment(ldt_fs_t *ldt_fs)
{
-#if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC)
+#if defined(__FreeBSD_kernel__) && defined(LDT_AUTO_ALLOC)
int fs;
__asm__ __volatile__(
"movw %%fs,%%ax; mov %%eax,%0" : "=r" (fs) :: "%eax"
@@ -171,7 +171,7 @@ void Check_FS_Segment(ldt_fs_t *ldt_fs)
#endif
}
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
{
*buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
@@ -202,12 +202,12 @@ static int _modify_ldt(ldt_fs_t *ldt_fs, struct modify_ldt_ldt_s array)
}
#endif /*linux*/
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
{
unsigned long d[2];
LDT_EntryToBytes( d, &array );
-#if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC)
+#if defined(__FreeBSD_kernel__) && defined(LDT_AUTO_ALLOC)
ret = i386_set_ldt(LDT_AUTO_ALLOC, (union descriptor *)d, 1);
array.entry_number = ret;
ldt_fs->teb_sel = LDT_SEL(ret);
diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c
index 397779f72..3b0941391 100644
--- a/src/libw32dll/wine/win32.c
+++ b/src/libw32dll/wine/win32.c
@@ -894,7 +894,7 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
/* FIXME: better values for the two entries below... */
static int cache = 0;
static SYSTEM_INFO cachedsi;
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__)
+#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__svr4__)
unsigned int regs[4];
#endif
dbgprintf("GetSystemInfo(%p) =>\n", si);
@@ -958,7 +958,7 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
/* disable cpuid based detection (mplayer's cpudetect.c does this - see above) */
#ifndef MPLAYER
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__)
+#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__svr4__)
do_cpuid(1, regs);
switch ((regs[0] >> 8) & 0xf) { // cpu family
case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
diff --git a/src/video_out/libdha/ports.c b/src/video_out/libdha/ports.c
index b531082d3..0424446c9 100644
--- a/src/video_out/libdha/ports.c
+++ b/src/video_out/libdha/ports.c
@@ -69,7 +69,7 @@
/* OS depended stuff */
#if defined (linux)
#include "sysdep/pci_linux.c"
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD_kernel__)
#include "sysdep/pci_freebsd.c"
#elif defined (__386BSD__)
#include "sysdep/pci_386bsd.c"
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 301521e9b..41eeff02c 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -35,7 +35,7 @@
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
-#if defined (__linux__)
+#if defined (__linux__) || defined (__GLIBC__)
#include <endian.h>
#elif defined (__FreeBSD__)
#include <machine/endian.h>
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 48f3a6df0..50d8796e8 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.c
@@ -32,7 +32,7 @@
#include <stdlib.h>
#include <pthread.h>
#include <stdarg.h>
-#if defined (__linux__)
+#if defined (__linux__) || defined (__GLIBC__)
#include <endian.h>
#elif defined (__FreeBSD__)
#include <machine/endian.h>