1#
2# AX_ZTEX
3#
4# This software is Copyright (c) 2016 Denis Burykin
5# [denis_burykin yahoo com], [denis-burykin2014 yandex ru]
6# and it is hereby released to the general public under the following terms:
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted.
9#
10# If configured to support ZTEX USB-FPGA module with --enable-ztex=yes:
11# - check for headers and libraries
12# - add Makefiles
13# - set ZTEX_SUBDIRS, ZTEX_LIBS
14#
15AC_DEFUN_ONCE([AX_ZTEX], [
16
17AC_ARG_ENABLE([ztex],
18  [AC_HELP_STRING([--enable-ztex],[Support ZTEX USB-FPGA module 1.15y])],
19  [ztex=$enableval], [ztex=no])
20
21ZTEX_SUBDIRS=""
22ZTEX_LIBS=""
23
24if test "x$ztex" = xyes; then
25
26AC_CHECK_HEADER([libusb-1.0/libusb.h],
27  [AC_CHECK_LIB([usb-1.0], [libusb_init],
28    [],
29    [AC_MSG_FAILURE(ZTEX USB-FPGA module requires libusb-1.0.)]
30  )],
31  [AC_MSG_FAILURE(ZTEX USB-FPGA module requires libusb-1.0.)]
32)
33
34AC_CONFIG_FILES([ztex/Makefile ztex/pkt_comm/Makefile])
35
36ZTEX_SUBDIRS="ztex"
37ZTEX_LIBS="ztex/*.o ztex/pkt_comm/*.o -lusb-1.0"
38
39fi
40
41AC_SUBST([ZTEX_SUBDIRS])
42AC_SUBST([ZTEX_LIBS])
43])dnl
44