# Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden
# and enforce use of SR_API to explicitly mark all public API functions.
-CFLAGS="$CFLAGS -Wall -Wextra -fvisibility=hidden"
+CFLAGS="$CFLAGS -Wall -Wextra -Wmissing-prototypes -fvisibility=hidden"
# Checks for programs.
AC_PROG_CC
# libm (the standard math library) is always needed.
AC_SEARCH_LIBS([pow], [m])
-# RPC is only needed for VXI support
+# RPC is only needed for VXI support.
AC_MSG_CHECKING([for RPC support])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <rpc/rpc.h>],
[CLIENT *rpc_test(void)],
[AC_MSG_RESULT([yes]); have_rpc=1],
[AC_MSG_RESULT([no]); have_rpc=0])
# Define HAVE_RPC in config.h if we found RPC support.
-AC_DEFINE_UNQUOTED(HAVE_RPC, [$have_rpc],[Specifies whether we have RPC support.])
+AC_DEFINE_UNQUOTED(HAVE_RPC, [$have_rpc], [Specifies whether we have RPC support.])
# VXI support is only compiled if RPC support was found.
-AM_CONDITIONAL(NEED_RPC, test "x$have_rpc" != x0)
+AM_CONDITIONAL(NEED_RPC, test "x$have_rpc" != "x0")
# libglib-2.0 is always needed. Abort if it's not found.
# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
# Serial port helper code is only compiled in if libserialport was found.
AM_CONDITIONAL(NEED_SERIAL, test "x$have_libserialport" != xno)
+PKG_CHECK_MODULES([librevisa], [librevisa >= 0.0.20130812],
+ [have_librevisa="yes"; CFLAGS="$CFLAGS $librevisa_CFLAGS";
+ LIBS="$LIBS $librevisa_LIBS";
+ SR_PKGLIBS="$SR_PKGLIBS librevisa"],
+ [have_librevisa="no"])
+
+# VISA SCPI backend is only compiled in if librevisa was found.
+AM_CONDITIONAL(NEED_VISA, test "x$have_librevisa" != xno)
+
+# Define HAVE_LIBREVISA in config.h if we found librevisa.
+if test "x$have_librevisa" != "xno"; then
+ AC_DEFINE_UNQUOTED(HAVE_LIBREVISA, [1],
+ [Specifies whether we have librevisa.])
+fi
+
# libusb-1.0 is only needed for some hardware drivers. Disable the respective
# drivers if it is not found.
case "$host" in
# Checks for header files.
# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
-AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
-AC_C_INLINE
-AC_TYPE_INT8_T
-AC_TYPE_INT16_T
-AC_TYPE_INT32_T
-AC_TYPE_INT64_T
-AC_TYPE_UINT8_T
-AC_TYPE_UINT16_T
-AC_TYPE_UINT32_T
-AC_TYPE_UINT64_T
-AC_TYPE_SIZE_T
-
-# Checks for library functions.
-AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
AC_SUBST(FIRMWARE_DIR, "$datadir/sigrok-firmware")
AC_SUBST(MAKEFLAGS, '--no-print-directory')
echo
# Note: This only works for libs with pkg-config integration.
-for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1.0" "libusb-1.0 >= 1.0.16" "libftdi >= 0.16" "libudev >= 151" "alsa >= 1.0" "check >= 0.9.4"; do
+for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1.0" "librevisa >= 0.0.20130812" "libusb-1.0 >= 1.0.16" "libftdi >= 0.16" "libudev >= 151" "alsa >= 1.0" "check >= 0.9.4"; do
if `$PKG_CONFIG --exists $lib`; then
ver=`$PKG_CONFIG --modversion $lib`
answer="yes ($ver)"