blob: 7621f6e586559e8b3a0a6519b4a5ecebc387807c [file] [log] [blame]
Uwe Hermann826938d2011-12-30 10:42:39 +01001##
2## This file is part of the sigrok project.
3##
Bert Vermeulenc73d2ea2012-02-13 14:31:51 +01004## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
Alexandru Gagniucd375b3c2012-10-15 01:17:32 -05005## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
Uwe Hermann826938d2011-12-30 10:42:39 +01006##
7## This program is free software: you can redistribute it and/or modify
8## it under the terms of the GNU General Public License as published by
9## the Free Software Foundation, either version 3 of the License, or
10## (at your option) any later version.
11##
12## This program is distributed in the hope that it will be useful,
13## but WITHOUT ANY WARRANTY; without even the implied warranty of
14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15## GNU General Public License for more details.
16##
17## You should have received a copy of the GNU General Public License
18## along with this program. If not, see <http://www.gnu.org/licenses/>.
19##
20
Uwe Hermannef7228b2012-01-28 21:26:56 +010021# We require at least autoconf 2.63 (AC_INIT format changed there).
22AC_PREREQ([2.63])
Uwe Hermann826938d2011-12-30 10:42:39 +010023
Uwe Hermann3af71f02012-01-04 00:05:43 +010024# libsigrok package version number (NOT the same as shared lib version!).
Uwe Hermann6dddd902012-03-31 11:28:24 +020025m4_define([sr_package_version_major], [0])
Uwe Hermann63298402012-06-01 00:16:42 +020026m4_define([sr_package_version_minor], [2])
27m4_define([sr_package_version_micro], [0])
Uwe Hermann6dddd902012-03-31 11:28:24 +020028m4_define([sr_package_version], [sr_package_version_major.sr_package_version_minor.sr_package_version_micro])
Uwe Hermann826938d2011-12-30 10:42:39 +010029
Uwe Hermann6dddd902012-03-31 11:28:24 +020030AC_INIT([libsigrok], [sr_package_version], [sigrok-devel@lists.sourceforge.net],
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +010031 [libsigrok], [http://www.sigrok.org])
Uwe Hermann826938d2011-12-30 10:42:39 +010032AC_CONFIG_HEADER([config.h])
Uwe Hermannd8521c92012-01-03 21:55:48 +010033AC_CONFIG_MACRO_DIR([autostuff])
34AC_CONFIG_AUX_DIR([autostuff])
Uwe Hermann826938d2011-12-30 10:42:39 +010035
Uwe Hermannef7228b2012-01-28 21:26:56 +010036# We require at least automake 1.11 (needed for 'silent rules').
37AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign std-options])
Uwe Hermann826938d2011-12-30 10:42:39 +010038m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Pekka Nikander432e5e92012-05-11 19:23:21 +030039m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Uwe Hermann826938d2011-12-30 10:42:39 +010040
Uwe Hermann6dddd902012-03-31 11:28:24 +020041AH_TOP([#ifndef SR_CONFIG_H
42#define SR_CONFIG_H /* To stop multiple inclusions. */])
43AH_BOTTOM([#endif /* SR_CONFIG_H */])
Uwe Hermann826938d2011-12-30 10:42:39 +010044
Uwe Hermann1a081ca2012-02-01 23:40:35 +010045# Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden
46# and enforce use of SR_API to explicitly mark all public API functions.
Uwe Hermannbdd76182012-12-28 11:22:16 +010047CFLAGS="$CFLAGS -Wall -Wextra -fvisibility=hidden"
Uwe Hermann826938d2011-12-30 10:42:39 +010048
49# Checks for programs.
Uwe Hermann826938d2011-12-30 10:42:39 +010050AC_PROG_CC
51AC_PROG_CPP
52AC_PROG_INSTALL
53AC_PROG_LN_S
54
55# Initialize libtool.
56LT_INIT
57
58# Initialize pkg-config.
59# We require at least 0.22, as "Requires.private" behaviour changed there.
60PKG_PROG_PKG_CONFIG([0.22])
61
Uwe Hermann3af71f02012-01-04 00:05:43 +010062# Library version for libsigrok (NOT the same as the package version).
Uwe Hermann826938d2011-12-30 10:42:39 +010063# Carefully read the libtool docs before updating these numbers!
64# The algorithm for determining which number to change (and how) is nontrivial!
65# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
Peter Stuge44fc8702012-12-03 02:42:57 +010066SR_LIB_VERSION_CURRENT=2
Uwe Hermann6dddd902012-03-31 11:28:24 +020067SR_LIB_VERSION_REVISION=0
68SR_LIB_VERSION_AGE=0
69SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE"
70SR_LIB_LDFLAGS="-version-info $SR_LIB_VERSION"
71AC_SUBST(SR_LIB_VERSION_CURRENT)
72AC_SUBST(SR_LIB_VERSION_REVISION)
73AC_SUBST(SR_LIB_VERSION_AGE)
74AC_SUBST(SR_LIB_VERSION)
75AC_SUBST(SR_LIB_LDFLAGS)
Uwe Hermann826938d2011-12-30 10:42:39 +010076
Bert Vermeulen7c1cb432012-09-10 22:14:37 +020077# Hardware support '--enable' options.
Uwe Hermann826938d2011-12-30 10:42:39 +010078
Bert Vermeulendbf24822013-01-14 00:52:55 +010079AC_ARG_ENABLE(all-drivers, AC_HELP_STRING([--enable-all-drivers],
80 [enable all drivers by default [default=yes]]),
81 [HW_ENABLED_DEFAULT="$enableval"],
82 [HW_ENABLED_DEFAULT="yes"])
83
Bert Vermeulen6ac0db12012-09-02 11:58:29 +020084AC_ARG_ENABLE(agilent-dmm, AC_HELP_STRING([--enable-agilent-dmm],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +010085 [enable Agilent DMM support [default=yes]]),
86 [HW_AGILENT_DMM="$enableval"],
87 [HW_AGILENT_DMM=$HW_ENABLED_DEFAULT])
Bert Vermeulen6ac0db12012-09-02 11:58:29 +020088AM_CONDITIONAL(HW_AGILENT_DMM, test x$HW_AGILENT_DMM = xyes)
89if test "x$HW_AGILENT_DMM" = "xyes"; then
Uwe Hermann9eb2bb92012-10-27 21:07:39 +020090 AC_DEFINE(HAVE_HW_AGILENT_DMM, 1, [Agilent DMM support])
Bert Vermeulen6ac0db12012-09-02 11:58:29 +020091fi
92
Uwe Hermann826938d2011-12-30 10:42:39 +010093AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +010094 [enable ALSA driver support [default=yes]]),
95 [HW_ALSA="$enableval"],
96 [HW_ALSA=$HW_ENABLED_DEFAULT])
Uwe Hermann02546512012-12-17 19:39:13 +010097AM_CONDITIONAL(HW_ALSA, test x$HW_ALSA = xyes)
98if test "x$HW_ALSA" = "xyes"; then
99 AC_DEFINE(HAVE_HW_ALSA, 1, [ALSA driver support])
Uwe Hermann826938d2011-12-30 10:42:39 +0100100fi
101
102AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100103 [enable ASIX SIGMA/SIGMA2 support [default=yes]]),
104 [LA_ASIX_SIGMA="$enableval"],
105 [LA_ASIX_SIGMA=$HW_ENABLED_DEFAULT])
Uwe Hermann826938d2011-12-30 10:42:39 +0100106AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
107if test "x$LA_ASIX_SIGMA" = "xyes"; then
Uwe Hermann6352d032012-05-02 19:02:03 +0200108 AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX SIGMA/SIGMA2 support])
Uwe Hermann826938d2011-12-30 10:42:39 +0100109fi
110
Alexandru Gagniuc20cbc782012-11-21 21:20:39 -0600111AC_ARG_ENABLE(brymen-dmm, AC_HELP_STRING([--enable-brymen-dmm],
112 [enable Brymen DMM support [default=yes]]),
113 [HW_BRYMEN_DMM="$enableval"],
114 [HW_BRYMEN_DMM=yes])
115AM_CONDITIONAL(HW_BRYMEN_DMM, test x$HW_BRYMEN_DMM = xyes)
116if test "x$HW_BRYMEN_DMM" = "xyes"; then
117 AC_DEFINE(HAVE_HW_BRYMEN_DMM, 1, [brymen-dmm support])
118fi
119
Uwe Hermann826938d2011-12-30 10:42:39 +0100120AC_ARG_ENABLE(chronovu-la8, AC_HELP_STRING([--enable-chronovu-la8],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100121 [enable ChronoVu LA8 support [default=yes]]),
122 [LA_CHRONOVU_LA8="$enableval"],
123 [LA_CHRONOVU_LA8=$HW_ENABLED_DEFAULT])
Uwe Hermann826938d2011-12-30 10:42:39 +0100124AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
125if test "x$LA_CHRONOVU_LA8" = "xyes"; then
126 AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
127fi
128
Bert Vermeulen4d729dd2012-10-29 22:33:47 +0100129AC_ARG_ENABLE(colead-slm, AC_HELP_STRING([--enable-colead-slm],
130 [enable Colead SLM support [default=yes]]),
131 [HW_COLEAD_SLM="$enableval"],
Bert Vermeulendbf24822013-01-14 00:52:55 +0100132 [HW_COLEAD_SLM=$HW_ENABLED_DEFAULT])
Bert Vermeulen4d729dd2012-10-29 22:33:47 +0100133AM_CONDITIONAL(HW_COLEAD_SLM, test x$HW_COLEAD_SLM = xyes)
134if test "x$HW_COLEAD_SLM" = "xyes"; then
135 AC_DEFINE(HAVE_HW_COLEAD_SLM, 1, [Colead SLM support])
136fi
137
Bert Vermeulen589a1012012-10-21 01:34:34 +0200138AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100139 [enable demo driver support [default=yes]]),
140 [LA_DEMO="$enableval"],
141 [LA_DEMO=$HW_ENABLED_DEFAULT])
Bert Vermeulen589a1012012-10-21 01:34:34 +0200142AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
143if test "x$LA_DEMO" = "xyes"; then
144 AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
145fi
146
Bert Vermeulen883a2e92012-09-10 22:31:29 +0200147AC_ARG_ENABLE(fluke-dmm, AC_HELP_STRING([--enable-fluke-dmm],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100148 [enable Fluke DMM support [default=yes]]),
149 [HW_FLUKE_DMM="$enableval"],
150 [HW_FLUKE_DMM=$HW_ENABLED_DEFAULT])
Bert Vermeulen883a2e92012-09-10 22:31:29 +0200151AM_CONDITIONAL(HW_FLUKE_DMM, test x$HW_FLUKE_DMM = xyes)
152if test "x$HW_FLUKE_DMM" = "xyes"; then
153 AC_DEFINE(HAVE_HW_FLUKE_DMM, 1, [Fluke DMM support])
154fi
155
Joel Holdsworthf302a082012-02-11 12:08:49 +0000156AC_ARG_ENABLE(fx2lafw, AC_HELP_STRING([--enable-fx2lafw],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100157 [enable fx2lafw support (for FX2 LAs). [default=yes]]),
158 [LA_FX2LAFW="$enableval"],
159 [LA_FX2LAFW=$HW_ENABLED_DEFAULT])
Joel Holdsworthf302a082012-02-11 12:08:49 +0000160AM_CONDITIONAL(LA_FX2LAFW, test x$LA_FX2LAFW = xyes)
161if test "x$LA_FX2LAFW" = "xyes"; then
162 AC_DEFINE(HAVE_LA_FX2LAFW, 1, [fx2lafw support])
163fi
164
Uwe Hermann9eb2bb92012-10-27 21:07:39 +0200165AC_ARG_ENABLE(hantek-dso, AC_HELP_STRING([--enable-hantek-dso],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100166 [enable Hantek DSO support [default=yes]]),
167 [HW_HANTEK_DSO="$enableval"],
168 [HW_HANTEK_DSO=$HW_ENABLED_DEFAULT])
Bert Vermeulen589a1012012-10-21 01:34:34 +0200169AM_CONDITIONAL(HW_HANTEK_DSO, test x$HW_HANTEK_DSO = xyes)
170if test "x$HW_HANTEK_DSO" = "xyes"; then
171 AC_DEFINE(HAVE_HW_HANTEK_DSO, 1, [Hantek DSO support])
Uwe Hermann826938d2011-12-30 10:42:39 +0100172fi
173
Bert Vermeulen46697e32012-11-27 17:40:14 +0100174AC_ARG_ENABLE(lascar-el-usb, AC_HELP_STRING([--enable-lascar-el-usb],
175 [enable Lascar EL-USB support [default=yes]]),
176 [HW_LASCAR_EL_USB="$enableval"],
Bert Vermeulendbf24822013-01-14 00:52:55 +0100177 [HW_LASCAR_EL_USB=$HW_ENABLED_DEFAULT])
Bert Vermeulen46697e32012-11-27 17:40:14 +0100178AM_CONDITIONAL(HW_LASCAR_EL_USB, test x$HW_LASCAR_EL_USB = xyes)
179if test "x$HW_LASCAR_EL_USB" = "xyes"; then
180 AC_DEFINE(HAVE_HW_LASCAR_EL_USB, 1, [Lascar EL-USB support])
181fi
182
Uwe Hermann826938d2011-12-30 10:42:39 +0100183AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100184 [enable Link Instruments MSO-19 support [default=yes]]),
185 [LA_LINK_MSO19="$enableval"],
186 [LA_LINK_MSO19=$HW_ENABLED_DEFAULT])
Uwe Hermann826938d2011-12-30 10:42:39 +0100187AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
188if test "x$LA_LINK_MSO19" = "xyes"; then
189 AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
190fi
191
Uwe Hermann7ec5b542013-01-30 16:58:01 +0100192AC_ARG_ENABLE(mic-985xx, AC_HELP_STRING([--enable-mic-985xx],
193 [enable MIC 985xx support [default=yes]]),
194 [HW_MIC_985XX="$enableval"],
195 [HW_MIC_985XX=yes])
196AM_CONDITIONAL(HW_MIC_985XX, test x$HW_MIC_985XX = xyes)
197if test "x$HW_MIC_985XX" = "xyes"; then
198 AC_DEFINE(HAVE_HW_MIC_985XX, 1, [MIC 985xx support])
199fi
200
Bert Vermeulen35a078b2012-12-24 20:11:38 +0100201AC_ARG_ENABLE(nexus-osciprime, AC_HELP_STRING([--enable-nexus-osciprime],
202 [enable Nexus Osciprime support [default=yes]]),
203 [HW_NEXUS_OSCIPRIME="$enableval"],
Bert Vermeulendbf24822013-01-14 00:52:55 +0100204 [HW_NEXUS_OSCIPRIME=$HW_ENABLED_DEFAULT])
Bert Vermeulen35a078b2012-12-24 20:11:38 +0100205AM_CONDITIONAL(HW_NEXUS_OSCIPRIME, test x$HW_NEXUS_OSCIPRIME = xyes)
206if test "x$HW_NEXUS_OSCIPRIME" = "xyes"; then
207 AC_DEFINE(HAVE_HW_NEXUS_OSCIPRIME, 1, [Nexus Osciprime support])
208fi
209
Uwe Hermann826938d2011-12-30 10:42:39 +0100210AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100211 [enable OpenBench Logic Sniffer (OLS) support [default=yes]]),
212 [LA_OLS="$enableval"],
213 [LA_OLS=$HW_ENABLED_DEFAULT])
Uwe Hermann826938d2011-12-30 10:42:39 +0100214AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
215if test "x$LA_OLS" = "xyes"; then
216 AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
217fi
218
Martin Lingf4816ac2012-12-29 22:22:10 +0100219AC_ARG_ENABLE(rigol-ds1xx2, AC_HELP_STRING([--enable-rigol-ds1xx2],
220 [enable Rigol DS1xx2 support [default=yes]]),
221 [HW_RIGOL_DS1XX2="$enableval"],
Bert Vermeulendbf24822013-01-14 00:52:55 +0100222 [HW_RIGOL_DS1XX2=$HW_ENABLED_DEFAULT])
Martin Lingf4816ac2012-12-29 22:22:10 +0100223AM_CONDITIONAL(HW_RIGOL_DS1XX2, test x$HW_RIGOL_DS1XX2 = xyes)
224if test "x$HW_RIGOL_DS1XX2" = "xyes"; then
225 AC_DEFINE(HAVE_HW_RIGOL_DS1XX2, 1, [Rigol DS1xx2 support])
226fi
227
Uwe Hermann21a7f262012-12-01 19:35:19 +0100228AC_ARG_ENABLE(serial-dmm, AC_HELP_STRING([--enable-serial-dmm],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100229 [enable serial DMM support [default=yes]]),
230 [HW_SERIAL_DMM="$enableval"],
231 [HW_SERIAL_DMM=$HW_ENABLED_DEFAULT])
Uwe Hermann21a7f262012-12-01 19:35:19 +0100232AM_CONDITIONAL(HW_SERIAL_DMM, test x$HW_SERIAL_DMM = xyes)
233if test "x$HW_SERIAL_DMM" = "xyes"; then
234 AC_DEFINE(HAVE_HW_SERIAL_DMM, 1, [Serial DMM support])
Alexandru Gagniuc7dc55d92012-10-20 20:39:37 -0500235fi
236
Uwe Hermannaa2af322012-11-09 03:33:05 +0100237AC_ARG_ENABLE(tondaj-sl-814, AC_HELP_STRING([--enable-tondaj-sl-814],
238 [enable Tondaj SL-814 support [default=yes]]),
239 [HW_TONDAJ_SL_814="$enableval"],
Bert Vermeulendbf24822013-01-14 00:52:55 +0100240 [HW_TONDAJ_SL_814=$HW_ENABLED_DEFAULT])
Uwe Hermannaa2af322012-11-09 03:33:05 +0100241AM_CONDITIONAL(HW_TONDAJ_SL_814, test x$HW_TONDAJ_SL_814 = xyes)
242if test "x$HW_TONDAJ_SL_814" = "xyes"; then
243 AC_DEFINE(HAVE_HW_TONDAJ_SL_814, 1, [Tondaj SL-814 support])
244fi
245
Uwe Hermann79081ec2012-10-27 22:41:50 +0200246AC_ARG_ENABLE(uni-t-dmm, AC_HELP_STRING([--enable-uni-t-dmm],
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100247 [enable UNI-T DMM support [default=yes]]),
248 [HW_UNI_T_DMM="$enableval"],
249 [HW_UNI_T_DMM=$HW_ENABLED_DEFAULT])
Uwe Hermann79081ec2012-10-27 22:41:50 +0200250AM_CONDITIONAL(HW_UNI_T_DMM, test x$HW_UNI_T_DMM = xyes)
251if test "x$HW_UNI_T_DMM" = "xyes"; then
252 AC_DEFINE(HAVE_HW_UNI_T_DMM, 1, [UNI-T DMM support])
253fi
254
Bert Vermeulenac3898d2012-11-02 20:47:06 +0100255AC_ARG_ENABLE(victor-dmm, AC_HELP_STRING([--enable-victor-dmm],
256 [enable victor-dmm support [default=yes]]),
257 [HW_VICTOR_DMM="$enableval"],
Bert Vermeulendbf24822013-01-14 00:52:55 +0100258 [HW_VICTOR_DMM=$HW_ENABLED_DEFAULT])
Bert Vermeulenac3898d2012-11-02 20:47:06 +0100259AM_CONDITIONAL(HW_VICTOR_DMM, test x$HW_VICTOR_DMM = xyes)
260if test "x$HW_VICTOR_DMM" = "xyes"; then
261 AC_DEFINE(HAVE_HW_VICTOR_DMM, 1, [victor-dmm support])
262fi
263
Uwe Hermann826938d2011-12-30 10:42:39 +0100264AC_ARG_ENABLE(zeroplus-logic-cube,
Bert Vermeulen8a22e8c2013-01-14 00:59:46 +0100265 AC_HELP_STRING([--enable-zeroplus-logic-cube],
266 [enable ZEROPLUS Logic Cube support [default=yes]]),
267 [LA_ZEROPLUS_LOGIC_CUBE="$enableval"],
268 [LA_ZEROPLUS_LOGIC_CUBE=$HW_ENABLED_DEFAULT])
Uwe Hermann826938d2011-12-30 10:42:39 +0100269AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes)
270if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
Uwe Hermann8fdecce2012-05-30 22:55:03 +0200271 AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [ZEROPLUS Logic Cube support])
Uwe Hermann826938d2011-12-30 10:42:39 +0100272fi
273
274# Checks for libraries.
275
276# This variable collects the pkg-config names of all detected libs.
277# It is then used to construct the "Requires.private:" field in the
278# libsigrok.pc file.
Uwe Hermann6dddd902012-03-31 11:28:24 +0200279SR_PKGLIBS=""
Uwe Hermann826938d2011-12-30 10:42:39 +0100280
281# libglib-2.0 is always needed.
282# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
Uwe Hermann7f64e882012-12-02 16:09:31 +0100283AM_PATH_GLIB_2_0([2.28.0],
Uwe Hermann826938d2011-12-30 10:42:39 +0100284 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
285
Uwe Hermann17dfb2c2012-12-22 01:33:03 +0100286# libusb-1.0 is only needed for some hardware drivers.
Joel Holdsworth824b1a82012-04-18 19:17:25 +0100287if test "x$LA_ASIX_SIGMA" != xno \
Uwe Hermann826938d2011-12-30 10:42:39 +0100288 -o "x$LA_CHRONOVU_LA8" != xno \
Bert Vermeulenef2345b2012-07-29 15:21:08 +0200289 -o "x$LA_FX2LAFW" != xno \
290 -o "x$HW_HANTEK_DSO" != xno \
291 -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno; then
Uwe Hermann826938d2011-12-30 10:42:39 +0100292 case "$build" in
293 *freebsd*)
294 # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
295 AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
296 [Specifies whether we have a libusb.h header.])
297 ;;
298 *)
Uwe Hermannd11d6062012-10-21 22:41:39 +0200299 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9],
Uwe Hermann826938d2011-12-30 10:42:39 +0100300 [CFLAGS="$CFLAGS $libusb_CFLAGS";
301 LIBS="$LIBS $libusb_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200302 SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"])
Uwe Hermann17dfb2c2012-12-22 01:33:03 +0100303 # Define HAVE_LIBUSB_1_0 in config.h if we found libusb-1.0.
304 if test "x$libusb_CFLAGS" != "x"; then
305 AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
306 [Specifies whether we have a libusb.h header.])
307 fi
Uwe Hermann826938d2011-12-30 10:42:39 +0100308 ;;
309 esac
310fi
311
312# libzip is always needed.
313PKG_CHECK_MODULES([libzip], [libzip >= 0.8],
314 [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200315 SR_PKGLIBS="$SR_PKGLIBS libzip"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100316
Uwe Hermann826938d2011-12-30 10:42:39 +0100317# libftdi is only needed for some hardware drivers.
318if test "x$LA_ASIX_SIGMA" != xno \
319 -o "x$LA_CHRONOVU_LA8" != xno; then
320 PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
321 [CFLAGS="$CFLAGS $libftdi_CFLAGS";
322 LIBS="$LIBS $libftdi_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200323 SR_PKGLIBS="$SR_PKGLIBS libftdi"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100324fi
325
326# libudev is only needed for some hardware drivers.
327if test "x$LA_LINK_MSO19" != xno; then
328 PKG_CHECK_MODULES([libudev], [libudev >= 151],
329 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200330 SR_PKGLIBS="$SR_PKGLIBS libudev"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100331fi
332
333# ALSA is only needed for some hardware drivers.
Uwe Hermann02546512012-12-17 19:39:13 +0100334if test "x$HW_ALSA" != xno; then
Uwe Hermann826938d2011-12-30 10:42:39 +0100335 PKG_CHECK_MODULES([alsa], [alsa >= 1.0],
336 [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200337 SR_PKGLIBS="$SR_PKGLIBS alsa"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100338fi
339
Uwe Hermann79bb0e92013-03-07 09:37:42 +0100340# The Check unit testing framework is optional.
341PKG_CHECK_MODULES([check], [check >= 0.9.4],
342 [have_check="yes"; CFLAGS="$CFLAGS $check_CFLAGS";
343 LIBS="$LIBS $check_LIBS"], [have_check="no"])
344AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
345
Uwe Hermann79081ec2012-10-27 22:41:50 +0200346# EZUSB FX2 firmware helper code is only needed for some hardware drivers.
Bert Vermeulen28b9dd12012-07-11 12:36:13 +0200347AM_CONDITIONAL(NEED_EZUSB, \
348 test "x$LA_FX2LAFW" != xno \
349 -o "x$HW_HANTEK_DSO" != xno \
350)
351
Uwe Hermann79081ec2012-10-27 22:41:50 +0200352# Serial port helper code is only needed for some hardware drivers.
Bert Vermeulen28b9dd12012-07-11 12:36:13 +0200353AM_CONDITIONAL(NEED_SERIAL, \
Uwe Hermanne42b82a2012-11-14 18:29:27 +0100354 test "x$HW_AGILENT_DMM" != xno \
355 -o "x$HW_COLEAD_SLM" != xno \
356 -o "x$HW_FLUKE_DMM" != xno \
357 -o "x$LA_LINK_MSO19" != xno \
358 -o "x$LA_OLS" != xno \
Uwe Hermann21a7f262012-12-01 19:35:19 +0100359 -o "x$HW_SERIAL_DMM" != xno \
Uwe Hermanne42b82a2012-11-14 18:29:27 +0100360 -o "x$HW_TONDAJ_SL_814" != xno \
Bert Vermeulen28b9dd12012-07-11 12:36:13 +0200361)
362
Uwe Hermann6dddd902012-03-31 11:28:24 +0200363AC_SUBST(SR_PKGLIBS)
Uwe Hermann826938d2011-12-30 10:42:39 +0100364
365# Checks for header files.
366# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
367AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
368
369# Checks for typedefs, structures, and compiler characteristics.
370AC_C_INLINE
371AC_TYPE_INT8_T
372AC_TYPE_INT16_T
373AC_TYPE_INT32_T
374AC_TYPE_INT64_T
375AC_TYPE_UINT8_T
376AC_TYPE_UINT16_T
377AC_TYPE_UINT32_T
378AC_TYPE_UINT64_T
379AC_TYPE_SIZE_T
380
381# Checks for library functions.
382AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
383
Uwe Hermannfb6f1972012-05-30 00:00:33 +0200384AC_SUBST(FIRMWARE_DIR, "$datadir/sigrok-firmware")
Uwe Hermann826938d2011-12-30 10:42:39 +0100385AC_SUBST(MAKEFLAGS, '--no-print-directory')
386AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
387
Uwe Hermann6dddd902012-03-31 11:28:24 +0200388SR_PACKAGE_VERSION_MAJOR=sr_package_version_major
389SR_PACKAGE_VERSION_MINOR=sr_package_version_minor
390SR_PACKAGE_VERSION_MICRO=sr_package_version_micro
391SR_PACKAGE_VERSION=sr_package_version
Uwe Hermann826938d2011-12-30 10:42:39 +0100392
Uwe Hermann6dddd902012-03-31 11:28:24 +0200393AC_SUBST(SR_PACKAGE_VERSION_MAJOR)
394AC_SUBST(SR_PACKAGE_VERSION_MINOR)
395AC_SUBST(SR_PACKAGE_VERSION_MICRO)
396AC_SUBST(SR_PACKAGE_VERSION)
Uwe Hermann826938d2011-12-30 10:42:39 +0100397
Bert Vermeulen589a1012012-10-21 01:34:34 +0200398AC_CONFIG_FILES([Makefile version.h hardware/Makefile
Bert Vermeulen6ac0db12012-09-02 11:58:29 +0200399 hardware/agilent-dmm/Makefile
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100400 hardware/alsa/Makefile
401 hardware/asix-sigma/Makefile
Alexandru Gagniuc20cbc782012-11-21 21:20:39 -0600402 hardware/brymen-dmm/Makefile
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100403 hardware/chronovu-la8/Makefile
Bert Vermeulen4d729dd2012-10-29 22:33:47 +0100404 hardware/colead-slm/Makefile
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100405 hardware/common/Makefile
Bert Vermeulen46697e32012-11-27 17:40:14 +0100406 hardware/lascar-el-usb/Makefile
Uwe Hermann7ec5b542013-01-30 16:58:01 +0100407 hardware/mic-985xx/Makefile
Bert Vermeulen35a078b2012-12-24 20:11:38 +0100408 hardware/nexus-osciprime/Makefile
Martin Lingf4816ac2012-12-29 22:22:10 +0100409 hardware/rigol-ds1xx2/Makefile
Uwe Hermannaa2af322012-11-09 03:33:05 +0100410 hardware/tondaj-sl-814/Makefile
Bert Vermeulenac3898d2012-11-02 20:47:06 +0100411 hardware/victor-dmm/Makefile
Uwe Hermann79081ec2012-10-27 22:41:50 +0200412 hardware/common/dmm/Makefile
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100413 hardware/demo/Makefile
Bert Vermeulen883a2e92012-09-10 22:31:29 +0200414 hardware/fluke-dmm/Makefile
Joel Holdsworthf302a082012-02-11 12:08:49 +0000415 hardware/fx2lafw/Makefile
Bert Vermeulen589a1012012-10-21 01:34:34 +0200416 hardware/hantek-dso/Makefile
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100417 hardware/link-mso19/Makefile
418 hardware/openbench-logic-sniffer/Makefile
Uwe Hermann21a7f262012-12-01 19:35:19 +0100419 hardware/serial-dmm/Makefile
Uwe Hermann79081ec2012-10-27 22:41:50 +0200420 hardware/uni-t-dmm/Makefile
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100421 hardware/zeroplus-logic-cube/Makefile
422 input/Makefile
423 output/Makefile
424 output/text/Makefile
425 libsigrok.pc
Uwe Hermann826938d2011-12-30 10:42:39 +0100426 contrib/Makefile
Uwe Hermann79bb0e92013-03-07 09:37:42 +0100427 tests/Makefile
Uwe Hermann826938d2011-12-30 10:42:39 +0100428 ])
429
430AC_OUTPUT
431
432echo
Uwe Hermann45aed072012-01-04 00:49:21 +0100433echo "libsigrok configuration summary:"
Uwe Hermann826938d2011-12-30 10:42:39 +0100434echo
Uwe Hermann6dddd902012-03-31 11:28:24 +0200435echo " - Package version (major.minor.micro): $SR_PACKAGE_VERSION"
436echo " - Library version (current:revision:age): $SR_LIB_VERSION"
Uwe Hermann45aed072012-01-04 00:49:21 +0100437echo " - Prefix: $prefix"
438echo
439echo "Detected libraries:"
440echo
441
442# Note: This only works for libs with pkg-config integration.
Uwe Hermann79bb0e92013-03-07 09:37:42 +0100443for lib in "glib-2.0" "libusb-1.0" "libzip" "libftdi" "libudev" "alsa" "check"; do
Uwe Hermann45aed072012-01-04 00:49:21 +0100444 if `$PKG_CONFIG --exists $lib`; then
445 ver=`$PKG_CONFIG --modversion $lib`
446 answer="yes ($ver)"
447 else
448 answer="no"
449 fi
450 echo " - $lib: $answer"
451done
452
Bert Vermeulen589a1012012-10-21 01:34:34 +0200453echo -e "\nEnabled hardware drivers:\n"
Bert Vermeulen6ac0db12012-09-02 11:58:29 +0200454echo " - Agilent DMM..................... $HW_AGILENT_DMM"
Uwe Hermann02546512012-12-17 19:39:13 +0100455echo " - ALSA............................ $HW_ALSA"
Uwe Hermann6352d032012-05-02 19:02:03 +0200456echo " - ASIX SIGMA/SIGMA2............... $LA_ASIX_SIGMA"
Alexandru Gagniuc20cbc782012-11-21 21:20:39 -0600457echo " - Brymen DMM...................... $HW_BRYMEN_DMM"
Uwe Hermann45aed072012-01-04 00:49:21 +0100458echo " - ChronoVu LA8.................... $LA_CHRONOVU_LA8"
Bert Vermeulen4d729dd2012-10-29 22:33:47 +0100459echo " - Colead SLM...................... $HW_COLEAD_SLM"
Uwe Hermann45aed072012-01-04 00:49:21 +0100460echo " - Demo driver..................... $LA_DEMO"
Bert Vermeulen883a2e92012-09-10 22:31:29 +0200461echo " - Fluke DMM....................... $HW_FLUKE_DMM"
Uwe Hermannb5750522012-03-21 19:45:46 +0100462echo " - fx2lafw (for FX2 LAs)........... $LA_FX2LAFW"
Bert Vermeulen589a1012012-10-21 01:34:34 +0200463echo " - Hantek DSO...................... $HW_HANTEK_DSO"
Bert Vermeulen46697e32012-11-27 17:40:14 +0100464echo " - Lascar EL-USB................... $HW_LASCAR_EL_USB"
Uwe Hermann45aed072012-01-04 00:49:21 +0100465echo " - Link MSO-19..................... $LA_LINK_MSO19"
Uwe Hermann7ec5b542013-01-30 16:58:01 +0100466echo " - MIC 985xx....................... $HW_MIC_985XX"
Bert Vermeulen35a078b2012-12-24 20:11:38 +0100467echo " - Nexus Osciprime................. $HW_NEXUS_OSCIPRIME"
Uwe Hermann45aed072012-01-04 00:49:21 +0100468echo " - Openbench Logic Sniffer......... $LA_OLS"
Martin Lingf4816ac2012-12-29 22:22:10 +0100469echo " - Rigol DS1xx2.................... $HW_RIGOL_DS1XX2"
Uwe Hermann21a7f262012-12-01 19:35:19 +0100470echo " - Serial DMM...................... $HW_SERIAL_DMM"
Uwe Hermannaa2af322012-11-09 03:33:05 +0100471echo " - Tondaj SL-814................... $HW_TONDAJ_SL_814"
Uwe Hermann79081ec2012-10-27 22:41:50 +0200472echo " - UNI-T DMM....................... $HW_UNI_T_DMM"
Bert Vermeulen521a0cd2012-12-15 11:07:18 +0100473echo " - Victor DMM...................... $HW_VICTOR_DMM"
Uwe Hermann8fdecce2012-05-30 22:55:03 +0200474echo " - ZEROPLUS Logic Cube............. $LA_ZEROPLUS_LOGIC_CUBE"
Uwe Hermann826938d2011-12-30 10:42:39 +0100475echo
476