Index: configure.ac
===================================================================
--- configure.ac	(revision 4)
+++ configure.ac	(revision 38)
@@ -21,4 +21,28 @@
 fi
 
+AC_MSG_CHECKING([where to find the X-Plane Plugin SDK])
+AC_ARG_WITH(xpsdk,
+            AC_HELP_STRING([--with-xpsdk=DIR],
+                           [use the X-Plane Plugin SDK in DIR]),
+            [
+                if test -r $withval/CHeaders/XPLM/XPLMPlugin.h; then
+                    AC_MSG_RESULT([$withval])
+                    XPSDK_INCLUDES="-I$withval/CHeaders/XPLM -I$withval/CHeaders/Wrappers -I$withval/CHeaders/Widgets"
+                    if test $_target_win32 -eq 0; then
+                        XPSDK_LDFLAGS="-L$withval/Libraries/Win"
+                    else
+                        XPSDK_LDFLAGS=""
+                    fi
+                else
+                    AC_MSG_FAILURE([not found in $withval])
+                fi
+            ],
+            [
+                 AC_MSG_FAILURE([please, specify])
+            ])
+
+AC_SUBST(XPSDK_INCLUDES)
+AC_SUBST(XPSDK_LDFLAGS)
+
 AC_CONFIG_FILES([
         Makefile
Index: src/xplcommon/Makefile.am
===================================================================
--- src/xplcommon/Makefile.am	(revision 36)
+++ src/xplcommon/Makefile.am	(revision 38)
@@ -1,9 +1,15 @@
+INCLUDES=@XPSDK_INCLUDES@
+
 SUBDIRS=
 if TARGET_API_POSIX
 SUBDIRS+=posix
+AM_CPPFLAGS=-DLIN
+AM_CXXFLAGS=-fPIC -fno-stack-protector
 endif
+
 if TARGET_API_WIN32
 SUBDIRS+=win32
-AM_LDFLAGS=-no-undefined
+AM_CPPFLAGS=-DIBM
+AM_LDFLAGS=@XPSDK_LDFLAGS@ -lXPLM -no-undefined
 endif
 
@@ -13,5 +19,6 @@
 	PseudoRandom.cc		\
 	BlockingStream.cc	\
-	DataStream.cc
+	DataStream.cc		\
+	Util.cc
 
 if TARGET_API_POSIX
@@ -44,3 +51,4 @@
 	LocalClientSocket.h	\
 	BlockingStream.h	\
-	DataStream.h
+	DataStream.h		\
+	Util.h
Index: src/xplcommon/Util.cc
===================================================================
--- src/xplcommon/Util.cc	(revision 38)
+++ src/xplcommon/Util.cc	(revision 38)
@@ -0,0 +1,64 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "Util.h"
+
+#include <cstdarg>
+#include <cstdio>
+
+#include <XPLMUtilities.h>
+
+//------------------------------------------------------------------------------
+
+using xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+void Util::debug(const char* format, ...)
+{
+    va_list ap;
+    va_start(ap, format);
+
+    char buf[256];
+    vsnprintf(buf, sizeof(buf), format, ap);
+
+    va_end(ap);
+
+    XPLMDebugString(buf);
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplcommon/Util.h
===================================================================
--- src/xplcommon/Util.h	(revision 38)
+++ src/xplcommon/Util.h	(revision 38)
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLCOMMON_UTIL_H
+#define XPLCOMMON_UTIL_H
+//------------------------------------------------------------------------------
+
+namespace xplcommon {
+
+//------------------------------------------------------------------------------
+
+/**
+ * General utilities.
+ */
+class Util
+{
+public:
+    /**
+     * Output debug information into X-Plane's log.
+     */
+    static void debug(const char* format, ...);
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplcommon */
+
+//------------------------------------------------------------------------------
+#endif // XPLCOMMON_UTIL_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
