Fix platform detection

Get rid of sys/utsname.h reference, it's not available on mingw32.
This commit is contained in:
Alexander Kojevnikov 2010-06-28 17:13:44 +10:00
parent 9617eab9d4
commit 9b201a9ef1
6 changed files with 16 additions and 24 deletions

View File

@ -4,6 +4,13 @@ AC_INIT([spek], [0.5])
AC_CONFIG_SRCDIR([src/spek.vala])
AC_CONFIG_HEADERS([config.h])
# Determine the system type.
AC_CANONICAL_HOST
AC_SUBST(host_os)
AC_DEFINE_UNQUOTED(HOST_OS, "$host_os",
[Define the canonical host OS type.]
)
AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2])
# Enable silent rules is available

View File

@ -9,7 +9,6 @@ spek_SOURCES = \
INCLUDES = \
-include config.h \
-include sys/utsname.h \
$(SPEK_CFLAGS) \
$(IGE_MAC_CFLAGS) \
-DLOCALEDIR=\""$(localedir)"\" \
@ -17,8 +16,7 @@ INCLUDES = \
-DPKGLIBDIR=\""$(pkglibdir)"\"
VALAFLAGS = \
--vapidir=$(srcdir)/../vapi
--pkg config --pkg sys \
--vapidir=$(srcdir)/../vapi --pkg config \
@SPEK_PACKAGES@
spek_LDADD = \

View File

@ -20,7 +20,6 @@ using Cairo;
using Gdk;
using Gtk;
using Pango;
using Sys;
namespace Spek {
class Spectrogram : DrawingArea {
@ -41,13 +40,13 @@ namespace Spek {
private const int BPAD = 40;
private const int GAP = 10;
private const int RULER = 10;
private double FONT_SCALE;
private double FONT_SCALE = 1.0;
public Spectrogram () {
// Pango/Quartz fonts are smaller than on X.
var name = UtsName ();
uname (ref name);
FONT_SCALE = name.sysname == "Darwin" ? 1.5 : 1.0;
if (Config.HOST_OS.down ().has_prefix ("darwin")) {
FONT_SCALE = 1.4;
}
// Pre-draw the palette.
palette = new ImageSurface (Format.RGB24, RULER, BANDS);

View File

@ -1,6 +1,5 @@
noinst_DATA = \
config.vapi \
sys.vapi
config.vapi
EXTRA_DIST = \
$(noinst_DATA)

View File

@ -13,4 +13,7 @@ namespace Config {
public const string LOCALEDIR; /* /usr/local/share/locale */
public const string PKGDATADIR; /* /usr/local/share/spek */
public const string PKGLIBDIR; /* /usr/local/lib/spek */
/* linux*, mingw*, or darwin* */
public const string HOST_OS;
}

View File

@ -1,14 +0,0 @@
[CCode (cheader_filename = "sys/utsname.h")]
namespace Sys {
[CCode (cname = "struct utsname")]
public struct UtsName {
public weak string sysname;
public weak string nodename;
public weak string release;
public weak string version;
public weak string machine;
public weak string domainname;
}
[CCode (cname = "uname")]
public int uname (ref UtsName name);
}