]> sigrok.org Git - libsigrok.git/log
libsigrok.git
8 years agosigrok.m4: Add SR_PROG_MAKE_NO_PRINT_DIRECTORY macro
Daniel Elstner [Mon, 7 Sep 2015 21:38:28 +0000 (23:38 +0200)]
sigrok.m4: Add SR_PROG_MAKE_NO_PRINT_DIRECTORY macro

8 years agoBuild: Show compiler and flags in configure summary
Daniel Elstner [Mon, 7 Sep 2015 20:32:13 +0000 (22:32 +0200)]
Build: Show compiler and flags in configure summary

8 years agoBuild: Use SR_PROG_MAKE_ORDER_ONLY
Daniel Elstner [Mon, 7 Sep 2015 20:28:14 +0000 (22:28 +0200)]
Build: Use SR_PROG_MAKE_ORDER_ONLY

As of now, the resulting substitution @ORDER@ is unused.

8 years agosigrok.m4: Add SR_PROG_MAKE_ORDER_ONLY macro
Daniel Elstner [Mon, 7 Sep 2015 20:24:44 +0000 (22:24 +0200)]
sigrok.m4: Add SR_PROG_MAKE_ORDER_ONLY macro

8 years agoBuild: Implement libieee1284 check via SR_ARG_OPT_CHECK
Daniel Elstner [Mon, 7 Sep 2015 19:49:17 +0000 (21:49 +0200)]
Build: Implement libieee1284 check via SR_ARG_OPT_CHECK

8 years agosigrok.m4: Add generic macro for optional dependencies
Daniel Elstner [Mon, 7 Sep 2015 19:18:50 +0000 (21:18 +0200)]
sigrok.m4: Add generic macro for optional dependencies

Provide SR_ARG_OPT_CHECK, a generalized variant of SRG_ARG_OPT_PKG
that can be used with custom check commands. Implement the latter
in terms of SR_ARG_OPT_CHECK.

8 years agoscpi: Fix incorrect serial_read_nonblocking call().
Martin Lederhilger [Mon, 7 Sep 2015 20:43:20 +0000 (22:43 +0200)]
scpi: Fix incorrect serial_read_nonblocking call().

There was a problem in scpi_serial.c in the scpi_serial_read_data()
function. Incoming data was written at the read position in the buffer,
although it should be written at the count position in the buffer.

8 years agodrivers: Match dummy FD passed to source add/remove
Daniel Elstner [Mon, 7 Sep 2015 12:33:30 +0000 (14:33 +0200)]
drivers: Match dummy FD passed to source add/remove

8 years agoUSB: Handle the case of a callback removing its event source
Daniel Elstner [Sat, 5 Sep 2015 01:56:16 +0000 (03:56 +0200)]
USB: Handle the case of a callback removing its event source

8 years agoUSB: On Windows, block to wait for libusb events
Daniel Elstner [Fri, 4 Sep 2015 16:51:55 +0000 (18:51 +0200)]
USB: On Windows, block to wait for libusb events

This is another attempt at getting the mess that is libusb event
handling on Windows under control. Until libusb makes its HANDLEs
available for polling, we have no choice but to block while waiting
for libusb events. Since we do not want to force drivers to deal
with multi-threading issues, that means we have to block in the
session main loop.

Fortunately, it turns out that our drivers aren't using multiple
event sources, so it is actually possible to block the main loop
without disrupting too much. This also gets rid of the USB thread
on Windows. Thankfully, libusb does not seem to care that we are
now calling libusb_handle_events_timeout_completed() twice per
iteration: first a blocking call (with timeout) in the callback
wrapper, followed by the non-blocking call in the driver-supplied
callback.

8 years agosession: Allow multiple poll FDs per event source
Daniel Elstner [Tue, 1 Sep 2015 01:36:03 +0000 (03:36 +0200)]
session: Allow multiple poll FDs per event source

Turns out that having one event source per libusb poll FD is
a bad idea. There is only a single callback for all poll FDs,
and libusb expects to be called only once per poll iteration,
no matter how many FDs triggered.

Also, they should all share the same timeout, which should get
reset on events from any polled FD. The new timeout handling made
this problem apparent, as it caused the callback to be invoked
multiple times on timeouts, once for each separate event source.

In order to fix this, change the implementation to allow for an
arbitrary number of poll FDs per event source. This number is
zero for timer FDs, one for normal I/O sources, and one or more
for libusb sources (Unix only).

Also, on Windows, do not get an additional timeout from libusb
in the event loop. This is only appropriate when polling the
libusb FDs directly, which we aren't doing on Windows.

8 years agosession: More poll spewing
Daniel Elstner [Mon, 31 Aug 2015 22:36:30 +0000 (00:36 +0200)]
session: More poll spewing

8 years agolog: Output time stamps at log level spew
Daniel Elstner [Mon, 31 Aug 2015 19:11:08 +0000 (21:11 +0200)]
log: Output time stamps at log level spew

8 years agodrivers: Use timer sources instead of polling stdin
Daniel Elstner [Mon, 31 Aug 2015 17:08:37 +0000 (19:08 +0200)]
drivers: Use timer sources instead of polling stdin

8 years agodemo: Use simple timer source instead of pipe
Daniel Elstner [Mon, 31 Aug 2015 01:55:41 +0000 (03:55 +0200)]
demo: Use simple timer source instead of pipe

Get rid of the Unix pipe and the GIOChannel wrapping it. Instead,
install a simple timer event source with the appropriate timeout.

8 years agosession: Add poll debug spew
Daniel Elstner [Mon, 31 Aug 2015 01:23:13 +0000 (03:23 +0200)]
session: Add poll debug spew

8 years agosession: Unify handling of I/O and timer sources
Daniel Elstner [Mon, 31 Aug 2015 00:35:57 +0000 (02:35 +0200)]
session: Unify handling of I/O and timer sources

Handle I/O sources and timer ("dummy") sources within the same
polling loop, so that both may be used together. Slightly change
the API to improve consistency: a timeout value of -1 now disables
the timeout, and 0 makes the source always time out immediately.
The "dummy" sources already behaved that way, although it wasn't
documented as such.

Make sure that I/O events are processed preferentially: Skip any
timeout callbacks if an I/O event occurred within the same poll
iteration. This applies to both timer/idle sources and timeouts
of I/O sources.

Do not create dummy GPollFDs for timer/idle sources. Instead,
split the sources array into an I/O section and a timer section,
and create corresponding GPollFDs only for the I/O section. Use
GArray to simplify the handling of the dynamic arrays.

8 years agosession: Properly accumulate event source timeouts
Daniel Elstner [Sun, 30 Aug 2015 19:43:30 +0000 (21:43 +0200)]
session: Properly accumulate event source timeouts

Keep track of when source timeouts are due and properly compare
against accumulated elapsed time between invocations. This prevents
sources with short timeouts from blocking other sources with longer
timeouts indefinitely.

8 years agosession: Do not expect meaningful errno on non-UNIX
Daniel Elstner [Sun, 30 Aug 2015 13:25:33 +0000 (15:25 +0200)]
session: Do not expect meaningful errno on non-UNIX

Looking at the g_poll() implementations for various systems, it
appears that on Windows the return value is 0 if the wait was
interrupted, and errno is never set. Also, the MacOS X wrapper
around select() does not clear revents on timeout.

To deal with these issues, check for EINTR only on Unices, and
assume revents to be invalid unless g_poll() returned a positive
value.

8 years agosession: Check for errors from g_poll()
Daniel Elstner [Sun, 30 Aug 2015 12:23:38 +0000 (14:23 +0200)]
session: Check for errors from g_poll()

If the call to g_poll() in sr_session_iteration() fails, report
the error back to the caller. Do not treat EINTR as error though.

Check for session abort only if a source callback was actually
invoked, or at least once if none of the callbacks are invoked.
Stop checking for abort if the session has already been stopped,
just in case a callback sets abort_session again.

Also change the documentation to match the actual behavior.

8 years agosession: Fix USB timeout handling
Daniel Elstner [Sun, 30 Aug 2015 10:20:03 +0000 (12:20 +0200)]
session: Fix USB timeout handling

In sr_session_iteration(), remove the inverted evaluation of the
block parameter if a USB source is present. This stops the deluge
of USB event callbacks due to the timeout always being zero.

Also, just for cleanliness, initialize the revents member of each
GPollFD instance to zero.

8 years agoBuild: Fix installation of Python bindings
Daniel Elstner [Wed, 2 Sep 2015 12:07:06 +0000 (14:07 +0200)]
Build: Fix installation of Python bindings

Apparently setup.py install behaves differently when given
the --root option, so omit that if DESTDIR is empty.

Fixes #644.

8 years agopython: Fix the build for Python >= 3.
Uwe Hermann [Mon, 31 Aug 2015 19:08:08 +0000 (21:08 +0200)]
python: Fix the build for Python >= 3.

SWIG_init() returns void for Python 2.x and 'PyObject *' for Python 3.

Use an #if to handle both cases properly, otherwise the Python bindings
for either Python 2 or 3 will fail to build.

Python 3.x failure:

sigrok/core/classes_wrap.cpp: In function ‘PyObject* PyInit__classes()’:
sigrok/core/classes_wrap.cpp:59002:5: error: return-statement with no
value, in function returning ‘PyObject* {aka _object*}’ [-fpermissive]
     return;
     ^

Python 2.x failure:

In file included from /usr/include/dirent.h:244:0,
                 from /usr/include/glib-2.0/glib/gdir.h:32,
                 from /usr/include/glib-2.0/glib.h:45,
                 from /usr/include/pygobject-3.0/pygobject.h:7,
                 from sigrok/core/classes_wrap.cpp:3179:
sigrok/core/classes_wrap.cpp: In function ‘void init_classes()’:
sigrok/core/classes_wrap.cpp:59002:12: error: return-statement with a
value, in function returning 'void' [-fpermissive]
     return NULL;
            ^

8 years agoRemove SR_OK_CONTINUE.
Bert Vermeulen [Sun, 30 Aug 2015 19:15:02 +0000 (21:15 +0200)]
Remove SR_OK_CONTINUE.

This brings error reporting back to the usual: either return codes
are SR_OK (0) or they are < 1 indicating an error.

This fixes bug #633.

8 years agooutput/csv: Avoid using SR_OK_CONTINUE.
Bert Vermeulen [Sun, 30 Aug 2015 19:13:51 +0000 (21:13 +0200)]
output/csv: Avoid using SR_OK_CONTINUE.

8 years agoscpi: Avoid using SR_OK_CONTINUE.
Bert Vermeulen [Sun, 30 Aug 2015 18:30:32 +0000 (20:30 +0200)]
scpi: Avoid using SR_OK_CONTINUE.

8 years agoserial: Check event ptr before using.
Bert Vermeulen [Sun, 16 Aug 2015 18:03:10 +0000 (20:03 +0200)]
serial: Check event ptr before using.

This avoids a NULL dereference when called twice.

8 years agoConvert SR_CONF_MEASURED_QUANTITY to SR_T_MQ.
Bert Vermeulen [Sun, 16 Aug 2015 23:58:45 +0000 (01:58 +0200)]
Convert SR_CONF_MEASURED_QUANTITY to SR_T_MQ.

8 years agoderee-de5000: Drop SR_CONF_MEASURED_QUANTITY functionality.
Bert Vermeulen [Sat, 29 Aug 2015 21:01:02 +0000 (23:01 +0200)]
deree-de5000: Drop SR_CONF_MEASURED_QUANTITY functionality.

This was superfluous -- there is no need to be able to query the
last MQ(s) sent by the device, since they're already being sent
along with the measurements in analog packets.

Since there is also no way to change the MQ (that is done with the
buttons on the device), there is no need to even list the possible
MQs.

8 years agoChange SR_T_MQLIST to SR_T_MQ.
Bert Vermeulen [Sat, 29 Aug 2015 20:20:29 +0000 (22:20 +0200)]
Change SR_T_MQLIST to SR_T_MQ.

The need to make this a list no longer applies.

SR_T_MQ is thus a type consisting of a tuple with two elements: the first
item is the MQ (type G_VARIANT_TYPE_UINT32), and the second is the MQ
flags value (G_VARIANT_TYPE_UINT64).

8 years agoCheck for libieee1284
Daniel Glöckner [Thu, 27 Aug 2015 09:21:48 +0000 (11:21 +0200)]
Check for libieee1284

Will be needed by the Hung-Chang DSO-2100 driver.

8 years agosr_session_send: pass transformed packet to datafeed callbacks
Daniel Glöckner [Sat, 22 Aug 2015 15:39:39 +0000 (17:39 +0200)]
sr_session_send: pass transformed packet to datafeed callbacks

After the packet has been passed through the transformation modules,
the transformed data is in packet_in but the following code uses
the packet variable which still points to the original input.

This fixes bug #631.

8 years agohantek-dso: fix memory leak
Daniel Glöckner [Sat, 22 Aug 2015 16:00:30 +0000 (18:00 +0200)]
hantek-dso: fix memory leak

This fixes bug #632.

8 years agolascar-el-usb: fix memory leak
Daniel Glöckner [Sat, 22 Aug 2015 15:31:43 +0000 (17:31 +0200)]
lascar-el-usb: fix memory leak

This fixes bug #630.

8 years agoes51919: fix memory leak
Daniel Glöckner [Sat, 22 Aug 2015 15:19:33 +0000 (17:19 +0200)]
es51919: fix memory leak

This fixes bug #629.

8 years agoDon't set _POSIX_C_SOURCE for VXI/RPC related files.
Uwe Hermann [Sat, 29 Aug 2015 12:50:44 +0000 (14:50 +0200)]
Don't set _POSIX_C_SOURCE for VXI/RPC related files.

Make vxi.h the first #include in all affected files and #undef the
_POSIX_C_SOURCE macro in vxi.h.

This avoids various build issues on e.g. FreeBSD or Mac OS X where
setting _POSIX_C_SOURCE leads to the unavailability of certain types
such as u_long (as used in the VXI/RPC code).

8 years agoBuild: Pass compiler flags from make to setup.py
Daniel Elstner [Fri, 28 Aug 2015 23:54:17 +0000 (01:54 +0200)]
Build: Pass compiler flags from make to setup.py

Extend setup.py to allow environment variables to be set on the
command line. Use that functionality to replace the pkg-config
invocations with flags passed on from make. Suppress the annoying
-Wstrict-prototypes warning by overriding the OPT variable.

Also move the "cd bindings/python" from Makefile.am to setup.py
to side-step problems with "cd" in make rules.

This also fixes bug #628.

8 years agoBuild: Go back to _POSIX_C_SOURCE=200112L
Daniel Elstner [Thu, 27 Aug 2015 10:30:13 +0000 (12:30 +0200)]
Build: Go back to _POSIX_C_SOURCE=200112L

8 years agoconfigure: Enable largefile support on 32-bit systems
Daniel Elstner [Wed, 26 Aug 2015 21:09:03 +0000 (23:09 +0200)]
configure: Enable largefile support on 32-bit systems

8 years agoconfigure.ac: Add libserialport dependency to kern-scale.
Uwe Hermann [Fri, 28 Aug 2015 14:26:36 +0000 (16:26 +0200)]
configure.ac: Add libserialport dependency to kern-scale.

8 years agoVarious key lists: Add reminders of what needs updates upon changes.
Uwe Hermann [Fri, 28 Aug 2015 14:26:07 +0000 (16:26 +0200)]
Various key lists: Add reminders of what needs updates upon changes.

8 years agosession.c: Fix key order.
Uwe Hermann [Fri, 28 Aug 2015 14:10:15 +0000 (16:10 +0200)]
session.c: Fix key order.

8 years agoanalog.c: Fix key order, add missing items.
Uwe Hermann [Fri, 28 Aug 2015 12:25:24 +0000 (14:25 +0200)]
analog.c: Fix key order, add missing items.

8 years agooutput/analog: Fix key order, add missing items.
Uwe Hermann [Fri, 28 Aug 2015 12:14:10 +0000 (14:14 +0200)]
output/analog: Fix key order, add missing items.

8 years agohwdriver.c: Fix key order, add missing items.
Uwe Hermann [Fri, 28 Aug 2015 12:01:09 +0000 (14:01 +0200)]
hwdriver.c: Fix key order, add missing items.

8 years agokern-scale: Add initial driver contents.
Uwe Hermann [Thu, 27 Aug 2015 20:06:26 +0000 (22:06 +0200)]
kern-scale: Add initial driver contents.

This currently supports (and is tested on) the KERN EW 6200-2NM,
other models will be added later.

8 years agokern-scale: Initial driver skeleton.
Uwe Hermann [Thu, 27 Aug 2015 19:42:46 +0000 (21:42 +0200)]
kern-scale: Initial driver skeleton.

8 years agoAdd a protocol parser for KERN scales.
Uwe Hermann [Thu, 27 Aug 2015 19:21:03 +0000 (21:21 +0200)]
Add a protocol parser for KERN scales.

(KERN & SOHN GmbH, http://www.kern-sohn.com/)

8 years agooutput/analog: Support mass related units / MQ flags.
Uwe Hermann [Thu, 27 Aug 2015 19:21:34 +0000 (21:21 +0200)]
output/analog: Support mass related units / MQ flags.

8 years agoAdd a few scale related flags.
Uwe Hermann [Thu, 27 Aug 2015 18:44:23 +0000 (20:44 +0200)]
Add a few scale related flags.

 - SR_MQ_MASS: Mass, as measured by scales / balances.

 - SR_UNIT_*: Various units of mass.

 - SR_MQFLAG_UNSTABLE: A flag denoting that a value has not
   yet stabilized (settled). E.g. when placing an object on a scale
   it'll take a few moments until a stable reading is available.
   Measurement values marked with SR_MQFLAG_UNSTABLE denote that they
   are "unsettled", unstable values (not yet stabilized).
   The absence of SR_MQFLAG_UNSTABLE denotes that the value is stable.

 - SR_CONF_SCALE: A device class for weighing scales / balances.

8 years agoBuild: Define feature test macro _DEFAULT_SOURCE
Daniel Elstner [Wed, 26 Aug 2015 11:55:53 +0000 (13:55 +0200)]
Build: Define feature test macro _DEFAULT_SOURCE

This basically makes glibc expose the same set of features as
if gcc was invoked without any restricting -std=c* option. Unlike
_GNU_SOURCE however, it does not enable GNU-specific extensions.

So, with this macro defined the behavior of Linux with glibc
should match that of other platforms.

8 years agoBuild: Use TESTS prefix instead of CHECK for flag variables
Daniel Elstner [Wed, 26 Aug 2015 11:13:39 +0000 (13:13 +0200)]
Build: Use TESTS prefix instead of CHECK for flag variables

In order to avoid confusion of the flags-gathering pkg-config
result with the actual test for the availability of "check",
change the pkg-config output variable prefix from CHECK to TESTS.

8 years agoAdd SR_T_MQLIST.
Bert Vermeulen [Sun, 16 Aug 2015 23:43:22 +0000 (01:43 +0200)]
Add SR_T_MQLIST.

This type consists of an array, with each item a two-member tuple,
representing an MQ/MQflags pair: the first item is the MQ (type
G_VARIANT_TYPE_UINT32), and the second is the MQ flags value
(G_VARIANT_TYPE_UINT64).

A GVariant of type SR_T_MQLIST can thus always represent more than
one MQ/MQflag pair.

8 years agoAdd key info tables for MQ and MQflags.
Bert Vermeulen [Sun, 16 Aug 2015 23:38:10 +0000 (01:38 +0200)]
Add key info tables for MQ and MQflags.

8 years agoReplace sr_config_info with sr_key_info.
Bert Vermeulen [Sun, 16 Aug 2015 23:30:14 +0000 (01:30 +0200)]
Replace sr_config_info with sr_key_info.

The tables defined with this struct can now be used for information
on items other than config keys.

Functions to access these tables have been renamed sr_key_info_[name_]get.
These take an extra argument, keytype, which should be set to SR_KEY_CONFIG
to get the config key tables. Other key types will be added.

8 years agoscpi/usbtmc: Use sr_usb_close().
Bert Vermeulen [Sun, 16 Aug 2015 18:02:21 +0000 (20:02 +0200)]
scpi/usbtmc: Use sr_usb_close().

8 years agoAdd sr_usb_close().
Bert Vermeulen [Sun, 16 Aug 2015 18:00:26 +0000 (20:00 +0200)]
Add sr_usb_close().

8 years agoscpi: Strip leading/trailing spaces from *IDN? response.
Bert Vermeulen [Mon, 17 Aug 2015 00:02:03 +0000 (02:02 +0200)]
scpi: Strip leading/trailing spaces from *IDN? response.

8 years agoscpi: Propagate error codes in API functions.
Bert Vermeulen [Sun, 16 Aug 2015 18:44:37 +0000 (20:44 +0200)]
scpi: Propagate error codes in API functions.

This allows client drivers to detect e.g. timeout conditions.

8 years agoMake sr_next_enabled_channel() from scpi-pps available library-wide.
Bert Vermeulen [Sun, 16 Aug 2015 13:54:02 +0000 (15:54 +0200)]
Make sr_next_enabled_channel() from scpi-pps available library-wide.

8 years agoscpi: Make helper functions from scpi-pps available library-wide.
Bert Vermeulen [Sun, 16 Aug 2015 13:12:34 +0000 (15:12 +0200)]
scpi: Make helper functions from scpi-pps available library-wide.

8 years agoscpi: Move SCPI-related definitions to separate header file.
Bert Vermeulen [Sat, 15 Aug 2015 23:04:04 +0000 (01:04 +0200)]
scpi: Move SCPI-related definitions to separate header file.

8 years agosigrok.m4: License header consistency fixes.
Uwe Hermann [Tue, 25 Aug 2015 15:01:22 +0000 (17:01 +0200)]
sigrok.m4: License header consistency fixes.

Use the same wording and formatting as in the rest of the codebase.

8 years agoBuild: Limit system features to C99 and POSIX
Daniel Elstner [Tue, 25 Aug 2015 10:50:35 +0000 (12:50 +0200)]
Build: Limit system features to C99 and POSIX

Use -std=c99 to try and enforce standard compliance.

8 years agoBuild: Fix SR_CHECK_COMPILE_FLAGS
Daniel Elstner [Mon, 24 Aug 2015 22:17:09 +0000 (00:17 +0200)]
Build: Fix SR_CHECK_COMPILE_FLAGS

Do not put "no" into the flags if the check fails.

8 years agoBuild: Reduce unnecessary config substitutions
Daniel Elstner [Mon, 24 Aug 2015 20:20:30 +0000 (22:20 +0200)]
Build: Reduce unnecessary config substitutions

Variable substitutions with a constant value may as well be
set directly in Makefile.am.

8 years agoBuild: Leave LIBS alone during configure
Daniel Elstner [Mon, 24 Aug 2015 20:06:27 +0000 (22:06 +0200)]
Build: Leave LIBS alone during configure

Put the extra libraries into SR_EXTRA_LIBS instead of LIBS.
Create an SR_CHECK_LIBS macro to make that easy. Substitute
SR_EXTRA_LIBS into libsigrok.pc, too.

8 years agoBuild: Simplify driver dependency check
Daniel Elstner [Mon, 24 Aug 2015 09:18:09 +0000 (11:18 +0200)]
Build: Simplify driver dependency check

8 years agoBuild: Add private copy of C++11 check macro
Daniel Elstner [Mon, 24 Aug 2015 07:25:37 +0000 (09:25 +0200)]
Build: Add private copy of C++11 check macro

Place a copy of ax_cxx_compile_stdcxx_11.m4 from the Autoconf
macro archive into our private m4/ directory. This is cleaner
than trying to parse M4 file versions etc. Plus, the macro is
now always available.

8 years agoBuild: Prefer newer versions of libftdi and SWIG
Daniel Elstner [Sun, 23 Aug 2015 22:08:01 +0000 (00:08 +0200)]
Build: Prefer newer versions of libftdi and SWIG

8 years agoBuild: Use commas to separate missing dependencies
Daniel Elstner [Sun, 23 Aug 2015 21:53:01 +0000 (23:53 +0200)]
Build: Use commas to separate missing dependencies

Beautify the output. Also fix the PyGObject test.

8 years agoBuild: Reduce autogen.sh to a trivial stub
Daniel Elstner [Sun, 23 Aug 2015 19:17:36 +0000 (21:17 +0200)]
Build: Reduce autogen.sh to a trivial stub

Use autoreconf instead of invoking the various Auto tools
separately. Get rid of the Darwin-specific guesswork -- it
does not make sense to handle this at the level of libsigrok.

People should set up their ACLOCAL_PATH themselves as appropriate
for their own system; just as they already need to set up various
other paths.

8 years agoBuild: Check for accepted compiler flags
Daniel Elstner [Sun, 23 Aug 2015 19:08:54 +0000 (21:08 +0200)]
Build: Check for accepted compiler flags

Introduce the SR_CHECK_COMPILE_FLAGS macro and use it to check
for additional compiler flags. Put the accepted flags into the
separate substitution variable SR_EXTRA_CFLAGS.

With this and the preceding changes, bug #578 should now be fixed.

8 years agoBuild: Move package check macros to m4/sigrok.m4
Daniel Elstner [Sun, 23 Aug 2015 18:07:38 +0000 (20:07 +0200)]
Build: Move package check macros to m4/sigrok.m4

Define generic macros for pkg-config dependency checks etc. in
m4/sigrok.m4, so they can be easily reused by downstream modules.

8 years agoBuild: Make compiler warnings configurable
Daniel Elstner [Sun, 23 Aug 2015 13:02:30 +0000 (15:02 +0200)]
Build: Make compiler warnings configurable

Use the SR_ARG_ENABLE_WARNINGS macro to configure and check for
the availability of compiler warning flags. Maintain separate
sets of warning flags for C and C++.

The configure option --enable-warnings=[min|max|fatal|no] can
be used to set the compiler warning level for all languages.
The default level is "max".

8 years agoBuild: Move custom Autoconf macros to separate file
Daniel Elstner [Sun, 23 Aug 2015 12:52:00 +0000 (14:52 +0200)]
Build: Move custom Autoconf macros to separate file

Place custom Autoconf macros which other sigrok modules may
re-use into a separate file m4/sigrok.m4. Also, introduce new
macros for defining the package and library versions, and for
gathering compiler warning flags.

8 years agoClean up .gitignore
Daniel Elstner [Sat, 22 Aug 2015 18:27:53 +0000 (20:27 +0200)]
Clean up .gitignore

8 years agoBuild: Place Autoconf macros into m4/ directory
Daniel Elstner [Sat, 22 Aug 2015 18:58:11 +0000 (20:58 +0200)]
Build: Place Autoconf macros into m4/ directory

This separates the M4 macros from the other cruft in autostuff/
to prepare for the introduction of custom macro files.

8 years agoBuild: Do not omit first argument to m4_warn()
Daniel Elstner [Fri, 21 Aug 2015 22:07:48 +0000 (00:07 +0200)]
Build: Do not omit first argument to m4_warn()

It seems that contrary to what the documentation says, leaving
the category argument to m4_warn() empty is not allowed. Use
the "unsupported" category for lack of a better choice.

8 years agoFreeBSD: Also check for swig3.0.
Uwe Hermann [Wed, 19 Aug 2015 13:44:43 +0000 (15:44 +0200)]
FreeBSD: Also check for swig3.0.

On FreeBSD (for example) the SWIG binary can also be called "swig3.0".

This fixes (together with the recent "swig2.0" addition) bug #557.

8 years agoBuild: Get rid of recursive make invocations
Daniel Elstner [Tue, 18 Aug 2015 19:24:39 +0000 (21:24 +0200)]
Build: Get rid of recursive make invocations

Do not invoke $(MAKE) just to execute some clean rule.
This gets rid of the "jobserver unavailable" warnings.

8 years agoBuild: Tell setup.py where to find SWIG
Daniel Elstner [Tue, 18 Aug 2015 18:09:53 +0000 (20:09 +0200)]
Build: Tell setup.py where to find SWIG

8 years agoFreeBSD: Also check for swig2.0 in addition to swig.
Uwe Hermann [Tue, 18 Aug 2015 16:01:54 +0000 (18:01 +0200)]
FreeBSD: Also check for swig2.0 in addition to swig.

On FreeBSD (for example) the SWIG binary is called "swig2.0".

This fixes bug #557.

8 years agoFreeBSD: Fix compile/link error due to missing libusb_get_version().
Uwe Hermann [Tue, 18 Aug 2015 15:58:28 +0000 (17:58 +0200)]
FreeBSD: Fix compile/link error due to missing libusb_get_version().

The FreeBSD libusb-1.0 API implementation doesn't have libusb_get_version().
Use our CONF_LIBUSB_1_0_VERSION macro instead.

8 years agoBuild: Avoid $< in explicit rules
Daniel Elstner [Tue, 18 Aug 2015 16:06:08 +0000 (18:06 +0200)]
Build: Avoid $< in explicit rules

Although useful, makes other than GNU make do not like this.
Name the prerequisite explicitly instead, and circumvent any
VPATH substitution other makes may do.

8 years agoBuild: Skip C++ CFLAGS and LIBS check when disabled
Daniel Elstner [Tue, 18 Aug 2015 15:46:29 +0000 (17:46 +0200)]
Build: Skip C++ CFLAGS and LIBS check when disabled

It is not a good idea to invoke PKG_CHECK_MODULES with an empty
list of modules to check, so skip the invocation in that case.

8 years agoBuild: Fix typo that broke the driver enable options
Daniel Elstner [Tue, 18 Aug 2015 13:02:01 +0000 (15:02 +0200)]
Build: Fix typo that broke the driver enable options

8 years agoBuild: Make SR_DRIVER() handle dependencies
Daniel Elstner [Mon, 17 Aug 2015 03:08:48 +0000 (05:08 +0200)]
Build: Make SR_DRIVER() handle dependencies

Turn the hardware driver dependency handling on its head, by
making SR_DRIVER() take a list of dependencies to check for.

8 years agoBuild: Make dependency on git change more robust
Daniel Elstner [Mon, 17 Aug 2015 00:08:39 +0000 (02:08 +0200)]
Build: Make dependency on git change more robust

It can sometimes happen that .git/HEAD or .git/refs/head/*, which
are added as config.status dependencies during configure, do not
exist anymore at build time.  For instance, when the current branch
is deleted after switching to a different one.

Wrap the dependencies inside $(wildcard ...) to avoid this problem.
Note that this is a GNU make feature.  However, it should be fine
as it is only used for git builds.  Even if a non-GNU make is used,
the construct will hopefully just expand to nothing.

8 years agoBuild: Show glib/libzip version requirements in configure summary.
Uwe Hermann [Sun, 16 Aug 2015 21:56:43 +0000 (23:56 +0200)]
Build: Show glib/libzip version requirements in configure summary.

8 years agoBuild: Fix a typo causing libftdi1 detection issues.
Uwe Hermann [Sun, 16 Aug 2015 21:53:23 +0000 (23:53 +0200)]
Build: Fix a typo causing libftdi1 detection issues.

8 years agoBuild: Properly namespace the version defines
Daniel Elstner [Sun, 16 Aug 2015 16:53:32 +0000 (18:53 +0200)]
Build: Properly namespace the version defines

Use the CONF_ prefix for the configured host define as well as
the various build-time version macros.

8 years agoBuild: Cleanup up and modernize autotools setup
Daniel Elstner [Sat, 15 Aug 2015 13:59:52 +0000 (15:59 +0200)]
Build: Cleanup up and modernize autotools setup

Note that some --enable options of configure have become
--with or --without options.

8 years agoBuild: Simplify the hardware driver selection
Daniel Elstner [Sat, 15 Aug 2015 00:28:54 +0000 (02:28 +0200)]
Build: Simplify the hardware driver selection

Replace DRIVER() and DRIVER2() by a single SR_DRIVER() macro.
Derive the names of shell variables and preprocessor defines
programatically to cut down on repetition.

8 years agoAdd dist tarball to gitignore
Daniel Elstner [Sat, 15 Aug 2015 17:55:02 +0000 (19:55 +0200)]
Add dist tarball to gitignore

8 years agosetup.py: Do VPATH search for swig/enums.i
Daniel Elstner [Sat, 15 Aug 2015 17:43:29 +0000 (19:43 +0200)]
setup.py: Do VPATH search for swig/enums.i

Also, in swig/classes.i include swig/enums.i rather than plain
enums.i, to guard against future name clashes.

8 years agoBuild: Depend on swig/enums.i where appropriate
Daniel Elstner [Sat, 15 Aug 2015 17:18:36 +0000 (19:18 +0200)]
Build: Depend on swig/enums.i where appropriate

8 years agoenums.py: Place swig/enums.i into build directory
Daniel Elstner [Sat, 15 Aug 2015 17:02:15 +0000 (19:02 +0200)]
enums.py: Place swig/enums.i into build directory

8 years agoBuild: Do not distribute generated headers
Daniel Elstner [Sat, 15 Aug 2015 16:33:05 +0000 (18:33 +0200)]
Build: Do not distribute generated headers

version.h and enums.hpp are generated at build time and should
not be included in the distribution tarball.  This seems to have
triggered a weird error when doing a VPATH build of the dist
tarball.

8 years agoBuild: Pass nostdinc option to automake
Daniel Elstner [Sat, 15 Aug 2015 16:10:50 +0000 (18:10 +0200)]
Build: Pass nostdinc option to automake

It seems automake automatically adds the directory containing
the generated version.h to the include path.  Use nostdinc to
disable default includes altogether.