-#!/bin/bash
+#!/bin/sh
export version=0.3.1
export soversion=1
echo "LIBDL=-ldl"
echo "RDYNAMIC=-rdynamic"
;;
+ FreeBSD)
+ echo "OPTIMISATIONS+=-ffast-math"
+ echo "CFLAGS+=-pthread"
+ echo "SHFLAGS=-shared"
+ echo "RDYNAMIC=-rdynamic"
+ ;;
*)
;;
esac
LIBSUF=".dylib"
mmx=false
;;
- Linux)
+ Linux|FreeBSD)
LIBSUF=".so"
;;
*)
# Determine the libdir if it's not specified in the args
[ "$libdir" = "" ] && libdir=$prefix/lib
-# Double check mmx (may end up disabling mmx on non-linux platforms incorrectly)
+# Double check mmx (Linux and FreeBSD supported, may end up disabling mmx on other platforms incorrectly)
if [ "$mmx" = "true" ]
then
- grep mmx /proc/cpuinfo > /dev/null 2>&1 || mmx=false
+ case $targetos in
+ Linux)
+ grep mmx /proc/cpuinfo > /dev/null 2>&1 || mmx=false
+ ;;
+ FreeBSD)
+ [ "$(make -V MACHINE_CPU:Mmmx)" ] || mmx=false
+ ;;
+ *)
+ grep mmx /proc/cpuinfo > /dev/null 2>&1 || mmx=false
+ ;;
+ esac
fi
# Show help if requested
/* Needed for BYTE_ORDER and BIG/LITTLE_ENDIAN macros. */
#ifndef _BSD_SOURCE
# define _BSD_SOURCE
+#ifndef __FreeBSD__
# include <endian.h>
+#else
+# include <sys/endian.h>
+#endif /* __FreeBSD__ */
# undef _BSD_SOURCE
#else
+#ifndef __FreeBSD__
# include <endian.h>
+#else
+# include <sys/endian.h>
+#endif /* __FreeBSD__ */
#endif
#include <sys/types.h>
+#ifndef __FreeBSD__
#include <byteswap.h>
+#else
+#define bswap_16(x) bswap16(x)
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
+#endif /* __FreeBSD__ */
static inline int8_t bswap(const int8_t& x)
{
//#include <stdio.h>
#include <iostream>
#include <iomanip>
+#ifndef __FreeBSD__
#include <byteswap.h>
+#endif /* __FreeBSD__ */
using std::cout;
using std::hex;
Darwin)
LDD="otool -L"
;;
- Linux)
+ Linux|FreeBSD)
LDD="ldd"
;;
*)
disable_sox=0
echo "CFLAGS += $(pkg-config --cflags sox) -I$(pkg-config --variable=prefix sox)" > config.mak
echo "LDFLAGS += $(pkg-config --libs sox)" >> config.mak
- [ "$(pkg-config --modversion sox)" > "13" ] && echo "CFLAGS += -DSOX14" >> config.mak
+ [ $(pkg-config --modversion sox | cut -d. -f1) -gt 13 ] && echo "CFLAGS += -DSOX14" >> config.mak
else
sox --version 2> /dev/null | grep 'v14.' > /dev/null
disable_sox=$?