+LIBXML2 = $(shell $(XML2CONFIG) --libs)
+LIBXSLT = $(shell $(XSLCONFIG) --libs)
+XML2CFLAGS = $(shell $(XML2CONFIG) --cflags)
+GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
+GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-2.0)
+CFLAGS += $(shell $(XSLCONFIG) --cflags)
+
+LIBZIP = $(shell $(PKGCONFIG) --libs libzip 2> /dev/null)
+ifneq ($(strip $(LIBZIP)),)
+ ZIP = -DLIBZIP $(shell $(PKGCONFIG) --cflags libzip)
+endif
+
+ifeq ($(UNAME), linux)
+ LIBGCONF2 = $(shell $(PKGCONFIG) --libs gconf-2.0)
+ GCONF2CFLAGS = $(shell $(PKGCONFIG) --cflags gconf-2.0)
+ OSSUPPORT = linux
+ OSSUPPORT_CFLAGS = $(GTK2CFLAGS) $(GCONF2CFLAGS)
+else ifeq ($(UNAME), darwin)
+ OSSUPPORT = macos
+ OSSUPPORT_CFLAGS = $(GTK2CFLAGS)
+ MACOSXINSTALL = /Applications/Subsurface.app
+ MACOSXFILES = packaging/macosx
+ EXTRALIBS = $(shell $(PKGCONFIG) --libs gtk-mac-integration) -framework CoreFoundation
+ CFLAGS += $(shell $(PKGCONFIG) --cflags gtk-mac-integration)
+else
+ OSSUPPORT = windows
+ OSSUPPORT_CFLAGS = $(GTK2CFLAGS)
+endif
+
+ifneq ($(strip $(LIBXSLT)),)
+ # We still need proper paths and install options for OSX and Windows
+ ifeq ($(shell sh -c 'uname -s 2>/dev/null || echo not'),Linux)
+ XSLT=-DXSLT='"$(XSLTDIR)"'
+ endif
+endif
+
+LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) $(EXTRALIBS) $(LIBZIP) -lpthread -lm