changeset 11523:4967776657f6 octave-forge

instrument control: add serial, i2c and parallel to autoconf
author dac922
date Fri, 08 Mar 2013 23:55:29 +0000
parents 056b973781b3
children 22a46ae5ed10
files main/instrument-control/src/Makefile.in main/instrument-control/src/config.h.in main/instrument-control/src/configure.ac main/instrument-control/src/i2c/Makefile main/instrument-control/src/i2c/Makefile.in main/instrument-control/src/i2c/i2c.cc main/instrument-control/src/i2c/i2c_addr.cc main/instrument-control/src/i2c/i2c_class.cc main/instrument-control/src/i2c/i2c_close.cc main/instrument-control/src/i2c/i2c_read.cc main/instrument-control/src/i2c/i2c_write.cc main/instrument-control/src/parallel/Makefile main/instrument-control/src/parallel/Makefile.in main/instrument-control/src/parallel/parallel.cc main/instrument-control/src/parallel/parallel_class.cc main/instrument-control/src/parallel/pp_close.cc main/instrument-control/src/parallel/pp_ctrl.cc main/instrument-control/src/parallel/pp_data.cc main/instrument-control/src/parallel/pp_datadir.cc main/instrument-control/src/parallel/pp_stat.cc main/instrument-control/src/serial/Makefile main/instrument-control/src/serial/Makefile.in main/instrument-control/src/serial/serial.cc main/instrument-control/src/serial/serial_class.cc main/instrument-control/src/serial/srl_baudrate.cc main/instrument-control/src/serial/srl_bytesize.cc main/instrument-control/src/serial/srl_close.cc main/instrument-control/src/serial/srl_flush.cc main/instrument-control/src/serial/srl_parity.cc main/instrument-control/src/serial/srl_read.cc main/instrument-control/src/serial/srl_stopbits.cc main/instrument-control/src/serial/srl_timeout.cc main/instrument-control/src/serial/srl_write.cc main/instrument-control/src/usbtmc/usbtmc.cc main/instrument-control/src/usbtmc/usbtmc_class.cc main/instrument-control/src/usbtmc/usbtmc_close.cc main/instrument-control/src/usbtmc/usbtmc_read.cc main/instrument-control/src/usbtmc/usbtmc_write.cc main/instrument-control/src/vxi11/Makefile.in main/instrument-control/src/vxi11/vxi11.cc main/instrument-control/src/vxi11/vxi11_close.cc main/instrument-control/src/vxi11/vxi11_read.cc main/instrument-control/src/vxi11/vxi11_write.cc
diffstat 43 files changed, 413 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/main/instrument-control/src/Makefile.in	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/Makefile.in	Fri Mar 08 23:55:29 2013 +0000
@@ -11,12 +11,12 @@
 	@for dir in $(SUBDIRS); do $(MAKE) -i -C $$dir; done
 	
 clean:
-	 @for dir in $(SUBDIRS); do $(MAKE) -i -C $$dir clean; done
+	@for dir in $(SUBDIRS); do $(MAKE) -i -C $$dir clean; done
 
 realclean:
-	 rm -f *.oct
+	rm -f *.oct
 
 distclean: realclean
-	 @for dir in $(SUBDIRS); do $(MAKE) -i -C $$dir distclean; done
-	 rm -rf autom4te.cache
-	 rm -f Makefile config.status config.log config.h configure
+	@for dir in $(SUBDIRS); do $(MAKE) -i -C $$dir distclean; done
+	rm -rf autom4te.cache
+	rm -f Makefile config.status config.log config.h configure
--- a/main/instrument-control/src/config.h.in	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/config.h.in	Fri Mar 08 23:55:29 2013 +0000
@@ -1,3 +1,12 @@
+/* build SERIAL interface functions */
+#undef BUILD_SERIAL
+
+/* build I2C interface functions */
+#undef BUILD_I2C
+
+/* build PARALLEL interface functions */
+#undef BUILD_PARALLEL
+
 /* build GPIB interface functions */
 #undef BUILD_GPIB
 
--- a/main/instrument-control/src/configure.ac	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/configure.ac	Fri Mar 08 23:55:29 2013 +0000
@@ -17,15 +17,26 @@
   AC_MSG_ERROR([mkoctfile required to install $PACKAGE_NAME])
 fi
 
+build_parallel=no
+build_serial=no
+build_i2c=no
 build_usbtmc=no
 build_tcp=no
 build_gpib=no
 build_vxi11=no
 build_visa=no
 
-# Howto check if usbtmc is available?
-build_usbtmc=yes
+# check for i2c
+# if linux/i2c-dev.h exists we are probably under linux, so build usbtmc as well
+AC_CHECK_HEADERS([linux/i2c-dev.h],[build_i2c=yes build_usbtmc=yes])
+AC_CHECK_HEADERS([dev/iicbus/iic.h],[build_i2c=yes])
 
+# check for serial
+AC_CHECK_HEADERS([termios.h],[build_serial=yes])
+
+# check for parallel
+AC_CHECK_HEADERS([linux/parport.h linux/ppdev.h],[build_parallel=yes])
+AC_CHECK_HEADERS([dev/ppbus/ppi.h dev/ppbus/ppbconf.h],[build_parallel=yes])
 
 # build tcp, available for most platforms
 AC_CHECK_HEADERS([sys/socket.h],[build_tcp=yes])
@@ -77,6 +88,18 @@
 
 #
 
+if test $build_parallel = yes; then
+  AC_DEFINE([BUILD_PARALLEL], [], [build PARALLEL interface functions])
+fi
+
+if test $build_serial = yes; then
+  AC_DEFINE([BUILD_SERIAL], [], [build SERIAL interface functions])
+fi
+
+if test $build_i2c = yes; then
+  AC_DEFINE([BUILD_I2C], [], [build I2C interface functions])
+fi
+
 if test $build_usbtmc = yes; then
   AC_DEFINE([BUILD_USBTMC], [], [build USBTMC interface functions])
 fi
@@ -91,6 +114,7 @@
 
 if test $build_vxi11 = yes; then
   AC_DEFINE([BUILD_VXI11], [], [build VXI11 interface functions])
+  AC_SUBST([BUILD_VXI11], [1], [build VXI11 interface functions])
 fi
 
 if test $build_visa = yes; then
@@ -100,13 +124,16 @@
 
 # all done
 
-AC_CONFIG_FILES([Makefile gpib/Makefile tcp/Makefile vxi11/Makefile usbtmc/Makefile])
+AC_CONFIG_FILES([Makefile gpib/Makefile tcp/Makefile vxi11/Makefile usbtmc/Makefile serial/Makefile parallel/Makefile i2c/Makefile])
 AC_OUTPUT
 
 AC_MSG_NOTICE([
 
 $PACKAGE_NAME is now configured with
 
+   BUILD SERIAL:      $build_serial
+   BUILD PARALLEL:    $build_parallel
+   BUILD I2C:         $build_i2c
    BUILD TCP:         $build_tcp
    BUILD USBTMC:      $build_usbtmc
    BUILD GPIB:        $build_gpib
--- a/main/instrument-control/src/i2c/Makefile	Fri Mar 08 21:29:55 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-OCT := i2c.oct i2c_close.oct i2c_addr.oct i2c_write.oct i2c_read.oct
-OBJ := i2c_class.o
-
-MKOCTFILE ?= mkoctfile
-
-all: $(OBJ) $(OCT)
-
-%.o: %.cc
-	$(MKOCTFILE) -c $^
-
-%.oct: %.o
-	$(MKOCTFILE) $^ $(OBJ) -o ../$@
-
-clean:
-	rm -f *.oct *.o
-
-distclean: clean
-
-.PHONY: all clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/instrument-control/src/i2c/Makefile.in	Fri Mar 08 23:55:29 2013 +0000
@@ -0,0 +1,21 @@
+OCT := i2c.oct i2c_close.oct i2c_addr.oct i2c_write.oct i2c_read.oct
+OBJ := i2c_class.o
+
+MKOCTFILE ?= mkoctfile
+
+CFLAGS     = @DEFS@
+
+all: $(OBJ) $(OCT)
+
+%.o: %.cc
+	$(MKOCTFILE) $(CFLAGS) -c $^
+
+%.oct: %.o
+	$(MKOCTFILE) $^ $(OBJ) -o ../$@
+
+clean:
+	rm -f *.oct *.o
+
+distclean: clean
+
+.PHONY: all clean
--- a/main/instrument-control/src/i2c/i2c.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/i2c/i2c.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,16 +15,19 @@
 
 #include <octave/oct.h>
 
-#ifndef __WIN32__
-#include <errno.h>
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_I2C
 #include <fcntl.h>
-#endif
 
 using std::string;
 
 #include "i2c_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (i2c, args, nargout, 
         "-*- texinfo -*-\n\
@@ -38,11 +41,10 @@
 The i2c() shall return instance of @var{octave_i2c} class as the result @var{i2c}.\n \
 @end deftypefn")
 {
-#ifdef __WIN32__
-    error("i2c: Windows platform support is not yet implemented, go away...");
+#ifndef BUILD_I2C
+    error("i2c: Your system doesn't support the I2C interface");
     return octave_value();
-#endif
-
+#else
     if (!type_loaded)
     {
         octave_i2c::register_type();
@@ -101,4 +103,5 @@
         retval->set_addr(addr);
 
     return octave_value(retval);
+#endif
 }
--- a/main/instrument-control/src/i2c/i2c_addr.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/i2c/i2c_addr.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,13 +15,15 @@
 
 #include <octave/oct.h>
 
-#ifndef __WIN32__
-#include <errno.h>
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
 #endif
 
+#ifdef BUILD_I2C
 #include "i2c_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (i2c_addr, args, nargout, 
 "-*- texinfo -*-\n\
@@ -38,6 +40,10 @@
 current i2c slave device address as the result @var{addr}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_I2C
+    error("i2c: Your system doesn't support the I2C interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_i2c::register_type();
@@ -72,4 +78,5 @@
 
     // Returning current slave address
     return octave_value(i2c->get_addr());
+#endif
 }
--- a/main/instrument-control/src/i2c/i2c_class.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/i2c/i2c_class.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,6 +15,11 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_I2C
 #include <stdio.h>
 #include <stdlib.h>
 #include <string>
@@ -192,3 +197,4 @@
 
     return retval;
 }
+#endif
--- a/main/instrument-control/src/i2c/i2c_close.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/i2c/i2c_close.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_I2C
 #include "i2c_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (i2c_close, args, nargout, 
 "-*- texinfo -*-\n\
@@ -28,6 +34,10 @@
 @var{i2c} - instance of @var{octave_i2c} class.@*\
 @end deftypefn")
 {
+#ifndef BUILD_I2C
+    error("i2c: Your system doesn't support the I2C interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_i2c::register_type();
@@ -49,4 +59,5 @@
     i2c->close();
 
     return octave_value();
+#endif
 }
--- a/main/instrument-control/src/i2c/i2c_read.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/i2c/i2c_read.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -16,11 +16,17 @@
 #include <octave/oct.h>
 #include <octave/uint8NDArray.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_I2C
 #include <errno.h>
 
 #include "i2c_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (i2c_read, args, nargout, 
 "-*- texinfo -*-\n\
@@ -34,6 +40,10 @@
 The i2c_read() shall return number of bytes successfully read in @var{count} as Integer and the bytes themselves in @var{data} as uint8 array.\n \
 @end deftypefn")
 {
+#ifndef BUILD_I2C
+    error("i2c: Your system doesn't support the I2C interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_i2c::register_type();
@@ -90,4 +100,5 @@
     delete[] buffer;
 
     return return_list;
+#endif
 }
--- a/main/instrument-control/src/i2c/i2c_write.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/i2c/i2c_write.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,11 +15,17 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_I2C
 #include <errno.h>
 
 #include "i2c_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (i2c_write, args, nargout, 
         "-*- texinfo -*-\n\
@@ -33,6 +39,10 @@
 Upon successful completion, i2c_write() shall return the number of bytes written as the result @var{n}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_I2C
+    error("i2c: Your system doesn't support the I2C interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_i2c::register_type();
@@ -77,4 +87,5 @@
     }
 
     return octave_value(retval);
+#endif
 }
--- a/main/instrument-control/src/parallel/Makefile	Fri Mar 08 21:29:55 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-OCT := parallel.oct pp_close.oct pp_datadir.oct pp_data.oct pp_stat.oct pp_ctrl.oct
-OBJ := parallel_class.o
-
-MKOCTFILE ?= mkoctfile
-
-all: $(OBJ) $(OCT)
-
-%.o: %.cc
-	$(MKOCTFILE) -c $^
-
-%.oct: %.o
-	$(MKOCTFILE) $^ $(OBJ) -o ../$@
-
-clean:
-	rm -f *.oct *.o
-
-distcealn: clean
-
-.PHONY: all clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/instrument-control/src/parallel/Makefile.in	Fri Mar 08 23:55:29 2013 +0000
@@ -0,0 +1,21 @@
+OCT := parallel.oct pp_close.oct pp_datadir.oct pp_data.oct pp_stat.oct pp_ctrl.oct
+OBJ := parallel_class.o
+
+MKOCTFILE ?= mkoctfile
+
+CFLAGS     = @DEFS@
+
+all: $(OBJ) $(OCT)
+
+%.o: %.cc
+	$(MKOCTFILE) $(CFLAGS) -c $^
+
+%.oct: %.o
+	$(MKOCTFILE) $^ $(OBJ) -o ../$@
+
+clean:
+	rm -f *.oct *.o
+
+distcealn: clean
+
+.PHONY: all clean
--- a/main/instrument-control/src/parallel/parallel.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/parallel/parallel.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -14,6 +14,12 @@
 // along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 #include <octave/oct.h>
+
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_PARALLEL
 #include <octave/ov-int32.h>
 
 #include <iostream>
@@ -38,6 +44,7 @@
 #include "parallel_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (parallel, args, nargout, 
 "-*- texinfo -*-\n\
@@ -52,11 +59,10 @@
 The parallel() shall return instance of @var{octave_parallel} class as the result @var{parallel}.\n \
 @end deftypefn")
 {
-#ifdef __WIN32__
-    error("parallel: Windows platform support is not yet implemented, go away...");
+#ifndef BUILD_PARALLEL
+    error("parallel: Your system doesn't support the GPIB interface");
     return octave_value();
-#endif   
-
+#else
     if (!type_loaded)
     {
         octave_parallel::register_type();
@@ -114,4 +120,5 @@
     retval->set_datadir(dir);
 
     return octave_value(retval);
+#endif
 }
--- a/main/instrument-control/src/parallel/parallel_class.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/parallel/parallel_class.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -13,6 +13,11 @@
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, see <http://www.gnu.org/licenses/>.
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_PARALLEL
 #include <octave/oct.h>
 #include <octave/ov-int32.h>
 
@@ -277,3 +282,4 @@
 
     return -1;
 }
+#endif
--- a/main/instrument-control/src/parallel/pp_close.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/parallel/pp_close.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_PARALLEL
 #include "parallel_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (pp_close, args, nargout, 
 "-*- texinfo -*-\n\
@@ -28,6 +34,10 @@
 @var{parallel} - instance of @var{octave_serial} class.@*\
 @end deftypefn")
 {
+#ifndef BUILD_PARALLEL
+    error("parallel: Your system doesn't support the GPIB interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_parallel::register_type();
@@ -48,4 +58,5 @@
     parallel->close();
 
     return octave_value();
+#endif
 }
--- a/main/instrument-control/src/parallel/pp_ctrl.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/parallel/pp_ctrl.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,10 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_PARALLEL
 #include "parallel_class.h"
 
 static bool type_loaded = false;
-
+#endif
 
 DEFUN_DLD (pp_ctrl, args, nargout, 
 "-*- texinfo -*-\n\
@@ -33,6 +38,10 @@
 If @var{ctrl} parameter is omitted, the pp_ctrl() shall return current Control lines state as the result @var{c}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_PARALLEL
+    error("parallel: Your system doesn't support the GPIB interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_parallel::register_type();
@@ -66,4 +75,5 @@
 
     // Return current Control register value on port
     return octave_value(parallel->get_ctrl());
+#endif
 }
--- a/main/instrument-control/src/parallel/pp_data.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/parallel/pp_data.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_PARALLEL
 #include "parallel_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (pp_data, args, nargout, 
 "-*- texinfo -*-\n\
@@ -32,6 +38,10 @@
 If @var{data} parameter is omitted, the pp_data() shall return current Data lines state as the result @var{d}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_PARALLEL
+    error("parallel: Your system doesn't support the GPIB interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_parallel::register_type();
@@ -66,4 +76,5 @@
 
     // Return current Data register value on port
     return octave_value(parallel->get_data());
+#endif
 }
--- a/main/instrument-control/src/parallel/pp_datadir.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/parallel/pp_datadir.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_PARALLEL
 #include "parallel_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (pp_datadir, args, nargout, 
 "-*- texinfo -*-\n\
@@ -36,6 +42,10 @@
 If @var{direction} parameter is omitted, the pp_datadir() shall return current Data direction as the result @var{dir}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_PARALLEL
+    error("parallel: Your system doesn't support the GPIB interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_parallel::register_type();
@@ -70,4 +80,5 @@
 
     // Return current direction
     return octave_value(parallel->get_datadir());
+#endif
 }
--- a/main/instrument-control/src/parallel/pp_stat.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/parallel/pp_stat.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_PARALLEL
 #include "parallel_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (pp_stat, args, nargout, 
 "-*- texinfo -*-\n\
@@ -30,6 +36,10 @@
 The pp_stat() shall return current Status lines state as the result @var{stat}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_PARALLEL
+    error("parallel: Your system doesn't support the GPIB interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_parallel::register_type();
@@ -50,4 +60,5 @@
 
     // Return current Status register value on port
     return octave_value(parallel->get_stat());
+#endif
 }
--- a/main/instrument-control/src/serial/Makefile	Fri Mar 08 21:29:55 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-OCT := serial.oct srl_baudrate.oct srl_timeout.oct srl_bytesize.oct srl_flush.oct \
-	srl_parity.oct srl_stopbits.oct srl_write.oct srl_close.oct srl_read.oct
-OBJ := serial_class.o
-
-MKOCTFILE ?= mkoctfile
-
-all: $(OBJ) $(OCT)
-
-%.o: %.cc
-	$(MKOCTFILE) -c $^
-
-%.oct: %.o
-	$(MKOCTFILE) $^ $(OBJ) -o ../$@
-
-clean:
-	rm -f *.oct *.o
-
-distclean: clean
-
-.PHONY: all clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/instrument-control/src/serial/Makefile.in	Fri Mar 08 23:55:29 2013 +0000
@@ -0,0 +1,22 @@
+OCT := serial.oct srl_baudrate.oct srl_timeout.oct srl_bytesize.oct srl_flush.oct \
+	srl_parity.oct srl_stopbits.oct srl_write.oct srl_close.oct srl_read.oct
+OBJ := serial_class.o
+
+MKOCTFILE ?= mkoctfile
+
+CFLAGS     = @DEFS@
+
+all: $(OBJ) $(OCT)
+
+%.o: %.cc
+	$(MKOCTFILE) $(CFLAGS) -c $^
+
+%.oct: %.o
+	$(MKOCTFILE) $^ $(OBJ) -o ../$@
+
+clean:
+	rm -f *.oct *.o
+
+distclean: clean
+
+.PHONY: all clean
--- a/main/instrument-control/src/serial/serial.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/serial.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -18,14 +18,18 @@
 
 #include <octave/oct.h>
 
-#ifndef __WIN32__
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include <errno.h>
 #include <fcntl.h>
-#endif
 
 #include "serial_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (serial, args, nargout, 
         "-*- texinfo -*-\n\
@@ -40,11 +44,10 @@
 The serial() shall return instance of @var{octave_serial} class as the result @var{serial}.\n \
 @end deftypefn")
 {
-#ifdef __WIN32__
-    error("serial: Windows platform support is not yet implemented, go away...");
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
     return octave_value();
-#endif
-
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -130,4 +133,5 @@
     //retval->flush(2);
 
     return octave_value(retval);
+#endif
 }
--- a/main/instrument-control/src/serial/serial_class.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/serial_class.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,6 +15,11 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include <iostream>
 #include <string>
 #include <algorithm>
@@ -557,3 +562,4 @@
 
     return retval;
 }
+#endif
--- a/main/instrument-control/src/serial/srl_baudrate.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_baudrate.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include "serial_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (srl_baudrate, args, nargout, 
 "-*- texinfo -*-\n\
@@ -34,6 +40,10 @@
 If @var{baudrate} parameter is omitted, the srl_baudrate() shall return current baudrate value as the result @var{br}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -68,4 +78,5 @@
 
     // Returning current baud rate
     return octave_value(serial->get_baudrate());
+#endif
 }
--- a/main/instrument-control/src/serial/srl_bytesize.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_bytesize.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include "serial_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (srl_bytesize, args, nargout, 
 "-*- texinfo -*-\n\
@@ -32,6 +38,10 @@
 If @var{bsize} parameter is omitted, the srl_bytesize() shall return current byte size value or in case of unsupported setting -1, as the result @var{bs}.\n \
 @end deftypefn")
 {
+    #ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -65,4 +75,5 @@
 
     // Returning current byte size 
     return octave_value(serial->get_bytesize());
+#endif
 }
--- a/main/instrument-control/src/serial/srl_close.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_close.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include "serial_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (srl_close, args, nargout, 
 "-*- texinfo -*-\n\
@@ -28,6 +34,10 @@
 @var{serial} - instance of @var{octave_serial} class.@*\
 @end deftypefn")
 {
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -48,4 +58,5 @@
     serial->close();
 
     return octave_value();
+#endif
 }
--- a/main/instrument-control/src/serial/srl_flush.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_flush.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include "serial_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (srl_flush, args, nargout,
 "-*- texinfo -*-\n\
@@ -32,6 +38,10 @@
 If @var{q} parameter is omitted, the srl_flush() shall flush both, input and output buffers.\n \
 @end deftypefn")
 {
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -66,4 +76,5 @@
     serial->flush(queue_selector);
 
     return octave_value();
+#endif
 }
--- a/main/instrument-control/src/serial/srl_parity.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_parity.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include "serial_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (srl_parity, args, nargout,
 "-*- texinfo -*-\n\
@@ -32,6 +38,10 @@
 If @var{parity} parameter is omitted, the srl_parity() shall return current parity value as the result @var{p}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -65,4 +75,5 @@
 
     // Returning current parity
     return octave_value(serial->get_parity());
+#endif
 }
--- a/main/instrument-control/src/serial/srl_read.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_read.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -14,6 +14,12 @@
 // along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 #include <octave/oct.h>
+
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include <octave/uint8NDArray.h>
 #include <octave/sighandlers.h>
 
@@ -29,6 +35,7 @@
     printf("srl_read: Interrupting...\n\r");
     read_interrupt = true;
 }
+#endif
 
 DEFUN_DLD (srl_read, args, nargout, 
         "-*- texinfo -*-\n\
@@ -42,6 +49,10 @@
 The srl_read() shall return number of bytes successfully read in @var{count} as Integer and the bytes themselves in @var{data} as uint8 array.\n \
 @end deftypefn")
 {
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -102,4 +113,5 @@
     delete[] buffer;
 
     return return_list;
+#endif
 }
--- a/main/instrument-control/src/serial/srl_stopbits.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_stopbits.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,10 +15,16 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include "serial_class.h"
 
 static bool type_loaded = false;
-   
+#endif
+
 DEFUN_DLD (srl_stopbits, args, nargout, 
 "-*- texinfo -*-\n\
 @deftypefn {Loadable Function} {} srl_stopbits (@var{serial}, @var{stopb})\n \
@@ -32,6 +38,10 @@
 If @var{stopb} parameter is omitted, the srl_stopbits() shall return current stop bits value as the result @var{sb}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -65,4 +75,5 @@
 
     // Returning current stop bits
     return octave_value(serial->get_stopbits());
+#endif
 }
--- a/main/instrument-control/src/serial/srl_timeout.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_timeout.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include "serial_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (srl_timeout, args, nargout, 
         "-*- texinfo -*-\n\
@@ -32,6 +38,10 @@
 If @var{timeout} parameter is omitted, the srl_timeout() shall return current timeout value as the result @var{t}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -65,4 +75,5 @@
 
     // Returning current timeout
     return octave_value(serial->get_timeout());
+#endif
 }
--- a/main/instrument-control/src/serial/srl_write.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/serial/srl_write.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,9 +15,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_SERIAL
 #include "serial_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (srl_write, args, nargout, 
         "-*- texinfo -*-\n\
@@ -31,6 +37,10 @@
 Upon successful completion, srl_write() shall return the number of bytes written as the result @var{n}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_SERIAL
+    error("serial: Your system doesn't support the SERIAL interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_serial::register_type();
@@ -79,4 +89,5 @@
     }
 
     return octave_value(retval);
+#endif
 }
--- a/main/instrument-control/src/usbtmc/usbtmc.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/usbtmc/usbtmc.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -20,7 +20,7 @@
 #include "../config.h"
 #endif
 
-#ifdef BUILD_TCP
+#ifdef BUILD_USBTMC
 #include <fcntl.h>
 
 using std::string;
--- a/main/instrument-control/src/usbtmc/usbtmc_class.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/usbtmc/usbtmc_class.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -20,7 +20,7 @@
 #include "../config.h"
 #endif
 
-#ifdef BUILD_TCP
+#ifdef BUILD_USBTMC
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
--- a/main/instrument-control/src/usbtmc/usbtmc_close.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/usbtmc/usbtmc_close.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -20,7 +20,7 @@
 #include "../config.h"
 #endif
 
-#ifdef BUILD_TCP
+#ifdef BUILD_USBTMC
 #include "usbtmc_class.h"
 
 static bool type_loaded = false;
--- a/main/instrument-control/src/usbtmc/usbtmc_read.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/usbtmc/usbtmc_read.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -20,7 +20,7 @@
 #include "../config.h"
 #endif
 
-#ifdef BUILD_TCP
+#ifdef BUILD_USBTMC
 #include <octave/uint8NDArray.h>
 
 #include <errno.h>
--- a/main/instrument-control/src/usbtmc/usbtmc_write.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/usbtmc/usbtmc_write.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -20,7 +20,7 @@
 #include "../config.h"
 #endif
 
-#ifdef BUILD_TCP
+#ifdef BUILD_USBTMC
 #include <errno.h>
 
 #include "usbtmc_class.h"
--- a/main/instrument-control/src/vxi11/Makefile.in	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/vxi11/Makefile.in	Fri Mar 08 23:55:29 2013 +0000
@@ -8,10 +8,19 @@
 CFLAGS      = @RPCINCLUDE@ @DEFS@
 LFLAGS      = @RPCLIBS@
 
+BUILD_VXI11 = @BUILD_VXI11@
+
+ifneq ($(BUILD_VXI11),1)
+VXI =
+OBJ =
+endif
+
 all: $(VXI) $(OBJ) $(OCT) 
 
+ifeq ($(BUILD_VXI11),1)
 vxi11.h vxi11_clnt.c vxi11_xdr.c : vxi11.x
 	$(RPCGEN) -M vxi11.x
+endif
 
 %.o: %.c
 	$(MKOCTFILE) $(CFLAGS) $(RPCINCLUDE) -c $^
--- a/main/instrument-control/src/vxi11/vxi11.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/vxi11/vxi11.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -16,16 +16,19 @@
 
 #include <octave/oct.h>
 
-#ifndef __WIN32__
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_VXI11
 #include <errno.h>
-#endif
 
 using std::string;
 
 #include "vxi11_class.h"
 
-
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (vxi11, args, nargout,
         "-*- texinfo -*-\n\
@@ -38,11 +41,10 @@
 The vxi11() shall return instance of @var{octave_vxi11} class as the result @var{vxi11}.\n \
 @end deftypefn")
 {
-#ifdef __WIN32__
-    error("vxi11: Windows platform support is not yet implemented, go away...");
+#ifndef BUILD_VXI11
+    error("usbtmc: Your system doesn't support the USBTMC interface");
     return octave_value();
-#endif
-
+#else
     if (!type_loaded)
     {
         octave_vxi11::register_type();
@@ -84,4 +86,5 @@
     }
 
     return octave_value(retval);
+#endif
 }
--- a/main/instrument-control/src/vxi11/vxi11_close.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/vxi11/vxi11_close.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -16,9 +16,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_VXI11
 #include "vxi11_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (vxi11_close, args, nargout,
 "-*- texinfo -*-\n\
@@ -29,6 +35,10 @@
 @var{vxi11} - instance of @var{octave_vxi11} class.@*\
 @end deftypefn")
 {
+#ifndef BUILD_VXI11
+    error("usbtmc: Your system doesn't support the USBTMC interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_vxi11::register_type();
@@ -50,4 +60,5 @@
     vxi11->close();
 
     return octave_value();
+#endif
 }
--- a/main/instrument-control/src/vxi11/vxi11_read.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/vxi11/vxi11_read.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -15,11 +15,18 @@
 // along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 #include <octave/oct.h>
+
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_VXI11
 #include <octave/uint8NDArray.h>
 
 #include "vxi11_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (vxi11_read, args, nargout,
 "-*- texinfo -*-\n\
@@ -33,6 +40,10 @@
 The vxi11_read() shall return number of bytes successfully read in @var{count} as Integer and the bytes themselves in @var{data} as uint8 array.\n \
 @end deftypefn")
 {
+#ifndef BUILD_VXI11
+    error("usbtmc: Your system doesn't support the USBTMC interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_vxi11::register_type();
@@ -91,4 +102,5 @@
     delete[] buffer;
 
     return return_list;
+#endif
 }
--- a/main/instrument-control/src/vxi11/vxi11_write.cc	Fri Mar 08 21:29:55 2013 +0000
+++ b/main/instrument-control/src/vxi11/vxi11_write.cc	Fri Mar 08 23:55:29 2013 +0000
@@ -16,9 +16,15 @@
 
 #include <octave/oct.h>
 
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#ifdef BUILD_VXI11
 #include "vxi11_class.h"
 
 static bool type_loaded = false;
+#endif
 
 DEFUN_DLD (vxi11_write, args, nargout,
 "-*- texinfo -*-\n\
@@ -32,6 +38,10 @@
 Upon successful completion, vxi11_write() shall return the number of bytes written as the result @var{n}.\n \
 @end deftypefn")
 {
+#ifndef BUILD_VXI11
+    error("usbtmc: Your system doesn't support the USBTMC interface");
+    return octave_value();
+#else
     if (!type_loaded)
     {
         octave_vxi11::register_type();
@@ -77,4 +87,5 @@
     }
 
     return octave_value(retval);
+#endif
 }