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.
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.
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.
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".
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.
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.
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.
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.
It seems automake automatically adds the directory containing
the generated version.h to the include path. Use nostdinc to
disable default includes altogether.
Append the git revision hash to the libsigrok package version,
unless HEAD exactly matches a release tag. Note that this does
not affect the version known to autoconf -- e.g. source tarballs
created by make dist will not receive a revision suffix.
Changes to git HEAD automatically trigger a reconfiguration.
Uncommitted changes do not, which is why I left out the -dirty
suffix.
Make it so that $(datadir) is resolved at make time, as per
autotools recommendations. Note that $datadir is not fully
resolved at configure time to begin with, i.e. part of it
already was evaluated at make time.
Use the proper tool for the job and make libsigrok/version.h
a secondary configuration header, so that autoconf's AC_DEFINE
machinery can be used to generate it. Note that the header
template is still hand-written, enabling fine control of the
content.
Move the include flags for files in the source tree from
configure.ac to Makefile.am where they belong. Also use
AM_CPPFLAGS instead of CFLAGS/CXXFLAGS to make sure the
files in the build/source tree are always picked up first.
Also, remove the include/libsigrok sub-directory from the
search path, thereby making the <libsigrok/> prefix mandatory
when building libsigrok itself. This matches the convention
already imposed on users of the library.
With gcc 5.1 released and defaulting to std=gnu11, the code will be compiled
according to different standards depending on the compiler version so we
should better specify explicitly what standard we are targetting.
C11 is now quite mature, it is supported in the just release Debian stable
(gcc 4.9) and also in old-stable (gcc 4.7), so there should be no reason to
use anything more ancient.
We also should have no reason to need any non-standard GNU extension.
So using only C11 + POSIX sounds like the best option right now.
The driver for BayLibre ACME depends on Linux-specific sysfs
interfaces to ina226 and tmp435 devices. Exclude it for different
targets.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
In order to determine the target OS when cross-compiling libsigrok
we need autotools to set the 'target_os' variable. This macro
determines the system type and sets output variables to the names
of the canonical system types.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
By avoiding g_slist_copy_deep() for now, we can easily allow libsigrok
to build against glib 2.32 (less hassle for users of stable/older
distros or OSes).
This removes an unnecessary build dependency on JDK and fixes
build troubles on systems where javac is present but JDK is not
installed and Java bindings are disabled by ./configure --disable-java.
Those need a bugfix to make them build again:
bindings/java/org/sigrok/core/classes/Context.java:92: error: method Context_create_analog_packet in class classesJNI cannot be applied to given types;
long cPtr = classesJNI.Context_create_analog_packet(swigCPtr, this, ChannelVector.getCPtr(tempchannels), SWIGTYPE_p_float.getCPtr(data_pointer), num_samples, Quantity.getCPtr(mq), mq, Unit.getCPtr(unit), unit, QuantityFlagVector.getCPtr(mqflags), mqflags);
^
required: long,Context,Vector<Channel>,long,long,long,Quantity,long,Unit,long,QuantityFlagVector
found: long,Context,long,long,long,long,Quantity,long,Unit,long,QuantityFlagVector
reason: actual argument long cannot be converted to Vector<Channel> by method invocation conversion
1 error
Makefile:3352: recipe for target 'bindings/java/sigrok-core.jar' failed
Add a driver for the DER EE DE-5000 LCR meter. This meter is based on
the Cyrustek ES51919/ES51920 chipset and communicates with the host
computer via an optional connectivity kit.
The kit uses an optoisolated unidirectional link to connect to the
meter and an USB cable on the host side. Internally the connection is
using the FTDI FT232R USB UART chip i.e. from the host computer point
of view the meter is connected into an RS-232 serial port.
This driver implements just a thin shim layer for registering the
driver and uses the es51919 module for all the actual work.
The AC_DEFINEs don't need any driver names really, those only end up
as code comments in config.h and are otherwise useless. Thus, don't
duplicate them, we already have the driver names in DRIVER().
Since AX_JNI_INCLUDE_DIR does not work for cross compilation, don't
invoke it when cross compiling. Also, add a configure option to
set the jni.h include path manually if needed.
The BeagleLogic driver needs sys/mman.h and sys/ioctl.h in order to
build, so disable the driver if those headers aren't available.
This is the case (for example) on MinGW.
The AX_CXX_COMPILE_STDCXX_11 macro is found in the autoconf-archive
package. If this is not installed, invoking the macro spits out an
error message that makes it look like a syntax error. This wraps it
in a check.
This is needed so that the C++ bindings, the header for which
references "libsigrok/libsigrok.h", can have a valid include
directory passed to build them before the headers are installed.
The FDTI library changed version, module name and also soname, so add an option to detect it
when the 0.x version is not found. The 1.x API is compatible enough for libsigrok to build.