Mercurial > forge
changeset 11520:f6940608a0fe octave-forge
instrument control: improve autoconf, mainly for non linux targets
line wrap: on
line diff
--- a/main/instrument-control/src/Makefile.in Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/Makefile.in Fri Mar 08 19:53:46 2013 +0000 @@ -1,18 +1,5 @@ -#OCT = instrument-control.oct -TOBUILD = @TOBUILD@ -SUBDIRS = serial parallel i2c usbtmc tcp $(TOBUILD) -GPIBLIBS = @GPIBLIBS@ -RPCLIBS = @RPCLIBS@ -RPCINCLUDE = @RPCINCLUDE@ -VISALIBS = @VISALIBS@ -TCPLIBS = @TCPLIBS@ - -export GPIBLIBS -export RPCLIBS -export RPCINCLUDE -export VISALIBS -export TCPLIBS +SUBDIRS = serial parallel i2c usbtmc tcp gpib vxi11 MKOCTFILE ?= mkoctfile @@ -26,9 +13,10 @@ clean: @for dir in $(SUBDIRS); do $(MAKE) -i -C $$dir clean; done -realclean: clean +realclean: 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/instrument-control/src/config.h.in Fri Mar 08 19:53:46 2013 +0000 @@ -0,0 +1,14 @@ +/* build GPIB interface functions */ +#undef BUILD_GPIB + +/* build TCP interface functions */ +#undef BUILD_TCP + +/* build USBTMC interface functions */ +#undef BUILD_USBTMC + +/* build VISA interface functions */ +#undef BUILD_VISA + +/* build VXI11 interface functions */ +#undef BUILD_VXI11
--- a/main/instrument-control/src/configure.ac Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/configure.ac Fri Mar 08 19:53:46 2013 +0000 @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) -AC_INIT([Octave-Forge instrument-control package], [0.2.0]) -#AC_CONFIG_HEADERS([config.h]) +AC_INIT([octave instrument control package], [0.0.0+]) +AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CXX @@ -17,26 +17,34 @@ AC_MSG_ERROR([mkoctfile required to install $PACKAGE_NAME]) fi -TOBUILD="" +build_usbtmc=no +build_tcp=no +build_gpib=no +build_vxi11=no +build_visa=no # Howto check if usbtmc is available? +build_usbtmc=yes +# build tcp, available for most platforms +AC_CHECK_HEADERS([sys/socket.h],[build_tcp=yes]) + # Check for winsock2 and ws2_32 AC_CHECK_HEADERS([winsock2.h], [AC_SEARCH_LIBS([_head_libws2_32_a], [ws2_32], - [AC_SUBST(TCPLIBS, ["-lws2_32"])] , [] )] , []) + [AC_SUBST(TCPLIBS, ["-lws2_32"]) build_tcp=yes] , [] )] , []) -# Checks for GPIB + +# Checks for GPIB AC_CHECK_HEADERS([gpib/ib.h], - [AC_SEARCH_LIBS([ibrd], [gpib], - [AC_SUBST(BUILD_GPIB, [1]) - TOBUILD="$TOBUILD gpib"] , [])] , [] ) + [AC_SEARCH_LIBS([ibrd], [gpib], [build_gpib=yes], [])] , [] ) if test "x$ac_cv_search_ibrd" != "xnone required"; then AC_SUBST(GPIBLIBS, [$ac_cv_search_ibrd]) fi + # Checks for RPC/VXI11 AC_ARG_WITH([tirpcinclude], [AC_HELP_STRING([--with-tirpcinclude=DIR], @@ -46,13 +54,10 @@ AC_CHECK_PROG([HAVE_RPCGEN], [rpcgen], [yes], [no]) if test "x$HAVE_RPCGEN" = "xyes"; then - AC_SEARCH_LIBS([clnt_create], [tirpc], - [AC_SUBST(BUILD_VXI11, [1]) - TOBUILD="$TOBUILD vxi11"], []) - + AC_SEARCH_LIBS([clnt_create], [tirpc], [build_vxi11=yes]) AC_CHECK_HEADERS([rpc/rpc.h],[], [AC_CHECK_HEADERS([${tirpc_header_dir}/netconfig.h], - [AC_SUBST([RPCINCLUDE], ["-I${tirpc_header_dir}"])],[])]) + [AC_SUBST([RPCINCLUDE], ["-I${tirpc_header_dir}"])],[build_vxi11=no])]) if test "x$ac_cv_search_clnt_create" != "xnone required"; then AC_SUBST(RPCLIBS, [$ac_cv_search_clnt_create]) @@ -63,35 +68,53 @@ # Checks for openvisa AC_CHECK_HEADERS([visa/visa.h], - [AC_SEARCH_LIBS([viOpenDefaultRM], [openvisa], - [AC_SUBST(BUILD_VISA, [1]) - TOBUILD="$TOBUILD visa"] , [])] , [] ) + [AC_SEARCH_LIBS([viOpenDefaultRM], [openvisa], [build_vxi11=yes], [])] , [] ) if test "x$ac_cv_search_viOpenDefaultRM" != "xnone required"; then AC_SUBST(VISALIBS, [$ac_cv_search_viOpenDefaultRM]) fi -AC_SUBST(TOBUILD) +# + +if test $build_usbtmc = yes; then + AC_DEFINE([BUILD_USBTMC], [], [build USBTMC interface functions]) +fi + +if test $build_tcp = yes; then + AC_DEFINE([BUILD_TCP], [], [build TCP interface functions]) +fi + +if test $build_gpib = yes; then + AC_DEFINE([BUILD_GPIB], [], [build GPIB interface functions]) +fi + +if test $build_vxi11 = yes; then + AC_DEFINE([BUILD_VXI11], [], [build VXI11 interface functions]) +fi + +if test $build_visa = yes; then + AC_DEFINE([BUILD_VISA], [], [build VISA interface functions]) +fi + + # all done -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile gpib/Makefile tcp/Makefile vxi11/Makefile usbtmc/Makefile]) AC_OUTPUT AC_MSG_NOTICE([ $PACKAGE_NAME is now configured with - TOBUILD: $TOBUILD + BUILD TCP: $build_tcp + BUILD USBTMC: $build_usbtmc + BUILD GPIB: $build_gpib + BUILD VXI11: $build_vxi11 - BUILD GPIB: $BUILD_GPIB - LIBS: $GPIBLIBS - - BUILD VXI11: $BUILD_VXI11 - LIBS: $RPCLIBS - INCLUDE: $RPCINCLUDE - - BUILD VISA: $BUILD_VISA - LIBS: $VISALIBS + GPIB LIBS: $GPIBLIBS + VXI11 LIBS: $RPCLIBS + VXI11 INCLUDE: $RPCINCLUDE + VISA LIBS: $VISALIBS ])
--- a/main/instrument-control/src/gpib/Makefile Thu Mar 07 13:30:19 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -OCT := gpib.oct gpib_timeout.oct gpib_write.oct gpib_close.oct gpib_read.oct -OBJ := gpib_class.o - -MKOCTFILE ?= mkoctfile - -GPIBLIBS ?= -lgpib - -all: $(OBJ) $(OCT) - -%.o: %.cc - $(MKOCTFILE) -c $^ - -%.oct: %.o - $(MKOCTFILE) $^ $(OBJ) $(GPIBLIBS) -o ../$@ - -clean: - rm -f *.oct *.o - -.PHONY: all clean
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/instrument-control/src/gpib/Makefile.in Fri Mar 08 19:53:46 2013 +0000 @@ -0,0 +1,23 @@ +OCT := gpib.oct gpib_timeout.oct gpib_write.oct gpib_close.oct gpib_read.oct +OBJ := gpib_class.o + +MKOCTFILE ?= mkoctfile + +CFLAGS = @DEFS@ +LFLAGS = @GPIBLIBS@ + +all: $(OBJ) $(OCT) + +%.o: %.cc + $(MKOCTFILE) $(CFLAGS) -c $^ + +%.oct: %.o + $(MKOCTFILE) $^ $(OBJ) $(LFLAGS) -o ../$@ + +clean: + rm -f *.oct *.o + +distclean: clean + rm Makefile + +.PHONY: all clean
--- a/main/instrument-control/src/gpib/gpib.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/gpib/gpib.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,12 +16,18 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_GPIB #include <errno.h> -#include <fcntl.h> +//#include <fcntl.h> #include "gpib_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (gpib, args, nargout, "-*- texinfo -*-\n\ @@ -35,7 +41,10 @@ The gpib() shall return instance of @var{octave_gpib} class as the result @var{gpib}.\n \ @end deftypefn") { - +#ifndef BUILD_GPIB + error("gpib: Your system doesn't support the GPIB interface"); + return octave_value(); +#else if (!type_loaded) { octave_gpib::register_type(); @@ -103,4 +112,5 @@ //retval->set_eos_mode(eot); return octave_value(retval); +#endif }
--- a/main/instrument-control/src/gpib/gpib_class.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/gpib/gpib_class.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,6 +16,11 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_GPIB #include <iostream> #include <string> #include <algorithm> @@ -269,3 +274,4 @@ this->minor = -1; return -1; } +#endif
--- a/main/instrument-control/src/gpib/gpib_close.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/gpib/gpib_close.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,9 +16,15 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_GPIB #include "gpib_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (gpib_close, args, nargout, "-*- texinfo -*-\n\ @@ -29,6 +35,10 @@ @var{gpib} - instance of @var{octave_gpib} class.@*\ @end deftypefn") { +#ifndef BUILD_GPIB + error("gpib: Your system doesn't support the GPIB interface"); + return octave_value(); +#else if (!type_loaded) { octave_gpib::register_type(); @@ -49,4 +59,5 @@ gpib->close(); return octave_value(); +#endif }
--- a/main/instrument-control/src/gpib/gpib_read.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/gpib/gpib_read.cc Fri Mar 08 19:53:46 2013 +0000 @@ -15,12 +15,16 @@ // 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_GPIB #include <octave/uint8NDArray.h> #include <octave/sighandlers.h> -#ifndef __WIN32__ #include <errno.h> -#endif #include "gpib_class.h" @@ -32,6 +36,7 @@ printf("gpib_read: Interrupting...\n\r"); read_interrupt = true; } +#endif DEFUN_DLD (gpib_read, args, nargout, "-*- texinfo -*-\n\ @@ -45,6 +50,10 @@ The gpib_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_GPIB + error("gpib: Your system doesn't support the GPIB interface"); + return octave_value(); +#else if (!type_loaded) { octave_gpib::register_type(); @@ -105,4 +114,5 @@ delete[] buffer; return return_list; +#endif }
--- a/main/instrument-control/src/gpib/gpib_timeout.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/gpib/gpib_timeout.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,9 +16,16 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_GPIB + #include "gpib_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (gpib_timeout, args, nargout, "-*- texinfo -*-\n\ @@ -33,6 +40,10 @@ If @var{timeout} parameter is omitted, the gpib_timeout() shall return current timeout value as the result @var{t}.\n \ @end deftypefn") { +#ifndef BUILD_GPIB + error("gpib: Your system doesn't support the GPIB interface"); + return octave_value(); +#else if (!type_loaded) { octave_gpib::register_type(); @@ -66,4 +77,5 @@ // Returning current timeout return octave_value(gpib->get_timeout()); +#endif }
--- a/main/instrument-control/src/gpib/gpib_write.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/gpib/gpib_write.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,11 +16,19 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_GPIB #include <errno.h> #include "gpib_class.h" + static bool type_loaded = false; +#endif + DEFUN_DLD (gpib_write, args, nargout, "-*- texinfo -*-\n\ @@ -34,6 +42,10 @@ Upon successful completion, gpib_write() shall return the number of bytes written as the result @var{n}.\n \ @end deftypefn") { +#ifndef BUILD_GPIB + error("gpib: Your system doesn't support the GPIB interface"); + return octave_value(); +#else if (!type_loaded) { octave_gpib::register_type(); @@ -82,4 +94,5 @@ } return octave_value(retval); +#endif }
--- a/main/instrument-control/src/i2c/Makefile Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/i2c/Makefile Fri Mar 08 19:53:46 2013 +0000 @@ -14,4 +14,6 @@ clean: rm -f *.oct *.o -.PHONY: all clean \ No newline at end of file +distclean: clean + +.PHONY: all clean
--- a/main/instrument-control/src/parallel/Makefile Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/parallel/Makefile Fri Mar 08 19:53:46 2013 +0000 @@ -14,4 +14,6 @@ clean: rm -f *.oct *.o -.PHONY: all clean \ No newline at end of file +distcealn: clean + +.PHONY: all clean
--- a/main/instrument-control/src/serial/Makefile Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/serial/Makefile Fri Mar 08 19:53:46 2013 +0000 @@ -15,4 +15,6 @@ clean: rm -f *.oct *.o -.PHONY: all clean \ No newline at end of file +distclean: clean + +.PHONY: all clean
--- a/main/instrument-control/src/tcp/Makefile Thu Mar 07 13:30:19 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -OCT := tcp.oct tcp_timeout.oct tcp_write.oct tcp_close.oct tcp_read.oct -OBJ := tcp_class.o - -MKOCTFILE ?= mkoctfile -TCPLIBS ?= - -all: $(OBJ) $(OCT) - -%.o: %.cc - $(MKOCTFILE) -c $^ - -%.oct: %.o - $(MKOCTFILE) $^ $(OBJ) $(TCPLIBS) -o ../$@ - -clean: - rm -f *.oct *.o - -.PHONY: all clean
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/instrument-control/src/tcp/Makefile.in Fri Mar 08 19:53:46 2013 +0000 @@ -0,0 +1,23 @@ +OCT := tcp.oct tcp_timeout.oct tcp_write.oct tcp_close.oct tcp_read.oct +OBJ := tcp_class.o + +MKOCTFILE ?= mkoctfile + +CFLAGS = @DEFS@ +LFLAGS = @TCPLIBS@ + +all: $(OBJ) $(OCT) + +%.o: %.cc + $(MKOCTFILE) $(CFLAGS) -c $^ + +%.oct: %.o + $(MKOCTFILE) $^ $(OBJ) $(LFLAGS) $(TCPLIBS) -o ../$@ + +clean: + rm -f *.oct *.o + +distclean: clean + rm Makefile + +.PHONY: all clean
--- a/main/instrument-control/src/tcp/tcp.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/tcp/tcp.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,9 +16,15 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include "tcp_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (tcp, args, nargout, "-*- texinfo -*-\n\ @@ -33,7 +39,10 @@ The tcp() shall return instance of @var{octave_tcp} class as the result @var{tcp}.\n \ @end deftypefn") { - +#ifndef BUILD_TCP + error("tcp: Your system doesn't support the TCO interface"); + return octave_value(); +#else if (!type_loaded) { octave_tcp::register_type(); @@ -108,4 +117,5 @@ //retval->flush(2); return octave_value(retval); +#endif }
--- a/main/instrument-control/src/tcp/tcp_class.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/tcp/tcp_class.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,6 +16,11 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include <iostream> #include <string> #include <algorithm> @@ -244,3 +249,4 @@ return retval; } +#endif
--- a/main/instrument-control/src/tcp/tcp_close.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/tcp/tcp_close.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,9 +16,15 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include "tcp_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (tcp_close, args, nargout, "-*- texinfo -*-\n\ @@ -29,6 +35,10 @@ @var{tcp} - instance of @var{octave_tcp} class.@*\ @end deftypefn") { +#ifndef BUILD_TCP + error("tcp: Your system doesn't support the TCP interface"); + return octave_value(); +#else if (!type_loaded) { octave_tcp::register_type(); @@ -49,4 +59,5 @@ tcp->close(); return octave_value(); +#endif }
--- a/main/instrument-control/src/tcp/tcp_read.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/tcp/tcp_read.cc Fri Mar 08 19:53:46 2013 +0000 @@ -15,6 +15,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_TCP #include <octave/uint8NDArray.h> #include <octave/sighandlers.h> @@ -30,6 +36,7 @@ printf("tcp_read: Interrupting...\n\r"); read_interrupt = true; } +#endif DEFUN_DLD (tcp_read, args, nargout, "-*- texinfo -*-\n\ @@ -44,6 +51,10 @@ The tcp_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_TCP + error("tcp: Your system doesn't support the TCP interface"); + return octave_value(); +#else if (!type_loaded) { octave_tcp::register_type(); @@ -119,4 +130,5 @@ delete[] buffer; return return_list; +#endif }
--- a/main/instrument-control/src/tcp/tcp_timeout.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/tcp/tcp_timeout.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,9 +16,15 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include "tcp_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (tcp_timeout, args, nargout, "-*- texinfo -*-\n\ @@ -33,6 +39,10 @@ If @var{timeout} parameter is omitted, the tcp_timeout() shall return current timeout value as the result @var{t}.\n \ @end deftypefn") { +#ifndef BUILD_TCP + error("tcp: Your system doesn't support the TCP interface"); + return octave_value(); +#else if (!type_loaded) { octave_tcp::register_type(); @@ -66,4 +76,5 @@ // Returning current timeout return octave_value(tcp->get_timeout()); +#endif }
--- a/main/instrument-control/src/tcp/tcp_write.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/tcp/tcp_write.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,9 +16,15 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include "tcp_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (tcp_write, args, nargout, "-*- texinfo -*-\n\ @@ -32,6 +38,10 @@ Upon successful completion, tcp_write() shall return the number of bytes written as the result @var{n}.\n \ @end deftypefn") { +#ifndef BUILD_TCP + error("tcp: Your system doesn't support the TCP interface"); + return octave_value(); +#else if (!type_loaded) { octave_tcp::register_type(); @@ -81,4 +91,5 @@ } return octave_value(retval); +#endif }
--- a/main/instrument-control/src/usbtmc/Makefile Thu Mar 07 13:30:19 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -OCT := usbtmc.oct usbtmc_close.oct usbtmc_write.oct usbtmc_read.oct -OBJ := usbtmc_class.o - -MKOCTFILE ?= mkoctfile - -all: $(OBJ) $(OCT) - -%.o: %.cc - $(MKOCTFILE) -c $^ - -%.oct: %.o - $(MKOCTFILE) $^ $(OBJ) -o ../$@ - -clean: - rm -f *.oct *.o - -.PHONY: all clean
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/instrument-control/src/usbtmc/Makefile.in Fri Mar 08 19:53:46 2013 +0000 @@ -0,0 +1,22 @@ +OCT := usbtmc.oct usbtmc_close.oct usbtmc_write.oct usbtmc_read.oct +OBJ := usbtmc_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 + rm Makefile + +.PHONY: all clean
--- a/main/instrument-control/src/usbtmc/usbtmc.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/usbtmc/usbtmc.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,15 +16,19 @@ #include <octave/oct.h> -#ifndef __WIN32__ +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include <fcntl.h> -#endif using std::string; #include "usbtmc_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (usbtmc, args, nargout, "-*- texinfo -*-\n\ @@ -37,11 +41,10 @@ The usbtmc() shall return instance of @var{octave_usbtmc} class as the result @var{usbtmc}.\n \ @end deftypefn") { -#ifdef __WIN32__ - error("usbtmc: Windows platform support is not yet implemented, go away..."); +#ifndef BUILD_USBTMC + error("usbtmc: Your system doesn't support the USBTMC interface"); return octave_value(); -#endif - +#else if (!type_loaded) { octave_usbtmc::register_type(); @@ -81,4 +84,5 @@ return octave_value(); return octave_value(retval); +#endif }
--- a/main/instrument-control/src/usbtmc/usbtmc_class.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/usbtmc/usbtmc_class.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,11 +16,14 @@ #include <octave/oct.h> -#ifndef __WIN32__ +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include <errno.h> #include <unistd.h> #include <fcntl.h> -#endif #include <string> @@ -113,4 +116,5 @@ } return retval; +#endif }
--- a/main/instrument-control/src/usbtmc/usbtmc_close.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/usbtmc/usbtmc_close.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,9 +16,15 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include "usbtmc_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (usbtmc_close, args, nargout, "-*- texinfo -*-\n\ @@ -29,6 +35,10 @@ @var{usbtmc} - instance of @var{octave_usbtmc} class.@*\ @end deftypefn") { +#ifndef BUILD_USBTMC + error("usbtmc: Your system doesn't support the USBTMC interface"); + return octave_value(); +#else if (!type_loaded) { octave_usbtmc::register_type(); @@ -50,4 +60,5 @@ usbtmc->close(); return octave_value(); +#endif }
--- a/main/instrument-control/src/usbtmc/usbtmc_read.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/usbtmc/usbtmc_read.cc Fri Mar 08 19:53:46 2013 +0000 @@ -15,6 +15,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_TCP #include <octave/uint8NDArray.h> #include <errno.h> @@ -22,6 +28,7 @@ #include "usbtmc_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (usbtmc_read, args, nargout, "-*- texinfo -*-\n\ @@ -35,6 +42,10 @@ The usbtmc_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_USBTMC + error("usbtmc: Your system doesn't support the USBTMC interface"); + return octave_value(); +#else if (!type_loaded) { octave_usbtmc::register_type(); @@ -91,4 +102,5 @@ delete[] buffer; return return_list; +#endif }
--- a/main/instrument-control/src/usbtmc/usbtmc_write.cc Thu Mar 07 13:30:19 2013 +0000 +++ b/main/instrument-control/src/usbtmc/usbtmc_write.cc Fri Mar 08 19:53:46 2013 +0000 @@ -16,11 +16,17 @@ #include <octave/oct.h> +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef BUILD_TCP #include <errno.h> #include "usbtmc_class.h" static bool type_loaded = false; +#endif DEFUN_DLD (usbtmc_write, args, nargout, "-*- texinfo -*-\n\ @@ -34,6 +40,10 @@ Upon successful completion, usbtmc_write() shall return the number of bytes written as the result @var{n}.\n \ @end deftypefn") { +#ifndef BUILD_USBTMC + error("usbtmc: Your system doesn't support the USBTMC interface"); + return octave_value(); +#else if (!type_loaded) { octave_usbtmc::register_type(); @@ -85,4 +95,5 @@ } return octave_value(retval); +#endif }
--- a/main/instrument-control/src/vxi11/Makefile Thu Mar 07 13:30:19 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -VXI := vxi11_clnt.o vxi11_xdr.o -OCT := vxi11.oct vxi11_write.oct vxi11_close.oct vxi11_read.oct -OBJ := vxi11_class.o - -MKOCTFILE ?= mkoctfile -RPCGEN ?= rpcgen - -all: $(VXI) $(OBJ) $(OCT) - -vxi11.h vxi11_clnt.c vxi11_xdr.c : vxi11.x - $(RPCGEN) -M vxi11.x - -%.o: %.c - $(MKOCTFILE) $(RPCINCLUDE) -c $^ - -%.o: %.cc - $(MKOCTFILE) $(RPCINCLUDE) -c $^ - -%.oct: %.o - $(MKOCTFILE) $^ $(OBJ) $(VXI) $(RPCLIBS) -o ../$@ - -clean: - rm -f *.oct *.o - rm -f vxi11.h vxi11_clnt.c vxi11_xdr.c vxi11_svc.c - -.PHONY: all clean
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/instrument-control/src/vxi11/Makefile.in Fri Mar 08 19:53:46 2013 +0000 @@ -0,0 +1,32 @@ +VXI := vxi11_clnt.o vxi11_xdr.o +OCT := vxi11.oct vxi11_write.oct vxi11_close.oct vxi11_read.oct +OBJ := vxi11_class.o + +MKOCTFILE ?= mkoctfile +RPCGEN ?= rpcgen + +CFLAGS = @RPCINCLUDE@ @DEFS@ +LFLAGS = @RPCLIBS@ + +all: $(VXI) $(OBJ) $(OCT) + +vxi11.h vxi11_clnt.c vxi11_xdr.c : vxi11.x + $(RPCGEN) -M vxi11.x + +%.o: %.c + $(MKOCTFILE) $(CFLAGS) $(RPCINCLUDE) -c $^ + +%.o: %.cc + $(MKOCTFILE) $(CFLAGS) $(RPCINCLUDE) -c $^ + +%.oct: %.o + $(MKOCTFILE) $^ $(OBJ) $(VXI) $(LFLAGS) -o ../$@ + +clean: + rm -f *.oct *.o + rm -f vxi11.h vxi11_clnt.c vxi11_xdr.c vxi11_svc.c + +distclean: clean + rm Makefile + +.PHONY: all clean