]> sigrok.org Git - libsigrok.git/blame - configure.ac
sr: remove unused time/duration fields from datafeed packets
[libsigrok.git] / configure.ac
CommitLineData
826938d8
UH
1##
2## This file is part of the sigrok project.
3##
4## Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
5##
6## This program is free software: you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation, either version 3 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program. If not, see <http://www.gnu.org/licenses/>.
18##
19
ef7228ba
UH
20# We require at least autoconf 2.63 (AC_INIT format changed there).
21AC_PREREQ([2.63])
826938d8 22
3af71f0d
UH
23# libsigrok package version number (NOT the same as shared lib version!).
24m4_define([libsigrok_major_version], [0])
25m4_define([libsigrok_minor_version], [2])
26m4_define([libsigrok_micro_version], [0])
27m4_define([libsigrok_version], [libsigrok_major_version.libsigrok_minor_version.libsigrok_micro_version])
826938d8 28
db8ae7b9
UH
29AC_INIT([libsigrok], [libsigrok_version], [sigrok-devel@lists.sourceforge.net],
30 [libsigrok], [http://www.sigrok.org])
826938d8 31AC_CONFIG_HEADER([config.h])
d8521c93
UH
32AC_CONFIG_MACRO_DIR([autostuff])
33AC_CONFIG_AUX_DIR([autostuff])
826938d8 34
ef7228ba
UH
35# We require at least automake 1.11 (needed for 'silent rules').
36AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign std-options])
826938d8
UH
37m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
38
db8ae7b9
UH
39AH_TOP([#ifndef LIBSIGROK_CONFIG_H
40#define LIBSIGROK_CONFIG_H /* To stop multiple inclusions. */])
41AH_BOTTOM([#endif /* LIBSIGROK_CONFIG_H */])
826938d8
UH
42
43CFLAGS="-g -Wall -Wextra"
44
45# Checks for programs.
46AC_PROG_CXX
47AC_PROG_CC
48AC_PROG_CPP
49AC_PROG_INSTALL
50AC_PROG_LN_S
51
52# Initialize libtool.
53LT_INIT
54
55# Initialize pkg-config.
56# We require at least 0.22, as "Requires.private" behaviour changed there.
57PKG_PROG_PKG_CONFIG([0.22])
58
3af71f0d 59# Library version for libsigrok (NOT the same as the package version).
826938d8
UH
60# Carefully read the libtool docs before updating these numbers!
61# The algorithm for determining which number to change (and how) is nontrivial!
62# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
3af71f0d
UH
63LIBSIGROK_LT_CURRENT=0
64LIBSIGROK_LT_REVISION=0
65LIBSIGROK_LT_AGE=0
66LIBSIGROK_LT_VERSION="$LIBSIGROK_LT_CURRENT:$LIBSIGROK_LT_REVISION:$LIBSIGROK_LT_AGE"
67LIBSIGROK_LT_LDFLAGS="-version-info $LIBSIGROK_LT_VERSION"
68AC_SUBST(LIBSIGROK_LT_LDFLAGS)
826938d8 69
826938d8
UH
70# Logic analyzer hardware support '--enable' options.
71
72# Disabled by default, unfinished.
73AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
74 [enable ALSA driver support [default=no]]),
75 [LA_ALSA="$enableval"],
76 [LA_ALSA=no])
77AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes)
78if test "x$LA_ALSA" = "xyes"; then
79 AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support])
80fi
81
82AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
83 [enable ASIX Sigma support [default=yes]]),
84 [LA_ASIX_SIGMA="$enableval"],
85 [LA_ASIX_SIGMA=yes])
86AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
87if test "x$LA_ASIX_SIGMA" = "xyes"; then
88 AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX Sigma support])
89fi
90
91AC_ARG_ENABLE(chronovu-la8, AC_HELP_STRING([--enable-chronovu-la8],
92 [enable ChronoVu LA8 support [default=yes]]),
93 [LA_CHRONOVU_LA8="$enableval"],
94 [LA_CHRONOVU_LA8=yes])
95AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
96if test "x$LA_CHRONOVU_LA8" = "xyes"; then
97 AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
98fi
99
100AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
101 [enable demo driver support [default=yes]]),
102 [LA_DEMO="$enableval"],
103 [LA_DEMO=yes])
104AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
105if test "x$LA_DEMO" = "xyes"; then
106 AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
107fi
108
109# Disabled by default, unfinished.
110AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19],
111 [enable Link Instruments MSO-19 support [default=no]]),
112 [LA_LINK_MSO19="$enableval"],
113 [LA_LINK_MSO19=no])
114AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
115if test "x$LA_LINK_MSO19" = "xyes"; then
116 AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
117fi
118
119AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols],
120 [enable OpenBench Logic Sniffer (OLS) support [default=yes]]),
121 [LA_OLS="$enableval"],
122 [LA_OLS=yes])
123AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
124if test "x$LA_OLS" = "xyes"; then
125 AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
126fi
127
128AC_ARG_ENABLE(saleae-logic, AC_HELP_STRING([--enable-saleae-logic],
129 [enable Saleae Logic support [default=yes]]),
130 [LA_SALEAE_LOGIC="$enableval"],
131 [LA_SALEAE_LOGIC=yes])
132AM_CONDITIONAL(LA_SALEAE_LOGIC, test x$LA_SALEAE_LOGIC = xyes)
133if test "x$LA_SALEAE_LOGIC" = "xyes"; then
134 AC_DEFINE(HAVE_LA_SALEAE_LOGIC, 1, [Saleae Logic support])
135fi
136
137AC_ARG_ENABLE(zeroplus-logic-cube,
138 AC_HELP_STRING([--enable-zeroplus-logic-cube],
139 [enable Zeroplus Logic Cube support [default=yes]]),
140 [LA_ZEROPLUS_LOGIC_CUBE="$enableval"],
141 [LA_ZEROPLUS_LOGIC_CUBE=yes])
142AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes)
143if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
144 AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [Zeroplus Logic Cube support])
145fi
146
147# Checks for libraries.
148
149# This variable collects the pkg-config names of all detected libs.
150# It is then used to construct the "Requires.private:" field in the
151# libsigrok.pc file.
152LIBSIGROK_PKGLIBS=""
153
154# libglib-2.0 is always needed.
155# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
156AM_PATH_GLIB_2_0([2.22.0],
157 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
158
159# libgthread-2.0 is always needed (e.g. for the demo hardware driver).
160PKG_CHECK_MODULES([gthread], [gthread-2.0 >= 2.22.0],
161 [CFLAGS="$CFLAGS $gthread_CFLAGS"; LIBS="$LIBS $gthread_LIBS";
162 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS gthread-2.0"])
163
164# libusb is only needed for some hardware drivers.
165if test "x$LA_SALEAE_LOGIC" != xno \
166 -o "x$LA_ASIX_SIGMA" != xno \
167 -o "x$LA_CHRONOVU_LA8" != xno \
168 -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno; then
169 case "$build" in
170 *freebsd*)
171 # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
172 AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
173 [Specifies whether we have a libusb.h header.])
174 ;;
175 *)
176 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.5],
177 [CFLAGS="$CFLAGS $libusb_CFLAGS";
178 LIBS="$LIBS $libusb_LIBS";
179 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libusb-1.0"])
180 AC_CHECK_LIB(usb-1.0, libusb_init)
181 ;;
182 esac
183fi
184
185# libzip is always needed.
186PKG_CHECK_MODULES([libzip], [libzip >= 0.8],
187 [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
188 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libzip"])
189
190# zlib is only needed for some hardware drivers.
191if test "x$LA_ASIX_SIGMA" != xno; then
192 PKG_CHECK_MODULES([zlib], [zlib >= 1.2.3.1],
193 [CFLAGS="$CFLAGS $zlib_CFLAGS"; LIBS="$LIBS $zlib_LIBS";
194 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS zlib"])
195fi
196
197# libftdi is only needed for some hardware drivers.
198if test "x$LA_ASIX_SIGMA" != xno \
199 -o "x$LA_CHRONOVU_LA8" != xno; then
200 PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
201 [CFLAGS="$CFLAGS $libftdi_CFLAGS";
202 LIBS="$LIBS $libftdi_LIBS";
203 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libftdi"])
204fi
205
206# libudev is only needed for some hardware drivers.
207if test "x$LA_LINK_MSO19" != xno; then
208 PKG_CHECK_MODULES([libudev], [libudev >= 151],
209 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
210 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libudev"])
211fi
212
213# ALSA is only needed for some hardware drivers.
214if test "x$LA_ALSA" != xno; then
215 PKG_CHECK_MODULES([alsa], [alsa >= 1.0],
216 [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS";
217 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS alsa"])
218fi
219
826938d8
UH
220AC_SUBST(LIBSIGROK_PKGLIBS)
221
222# Checks for header files.
223# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
224AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
225
226# Checks for typedefs, structures, and compiler characteristics.
227AC_C_INLINE
228AC_TYPE_INT8_T
229AC_TYPE_INT16_T
230AC_TYPE_INT32_T
231AC_TYPE_INT64_T
232AC_TYPE_UINT8_T
233AC_TYPE_UINT16_T
234AC_TYPE_UINT32_T
235AC_TYPE_UINT64_T
236AC_TYPE_SIZE_T
237
238# Checks for library functions.
239AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
240
8e190238 241AC_SUBST(FIRMWARE_DIR, "$datadir/libsigrok/firmware")
826938d8
UH
242AC_SUBST(MAKEFLAGS, '--no-print-directory')
243AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
244
3af71f0d
UH
245LIBSIGROK_MAJOR_VERSION=libsigrok_major_version
246LIBSIGROK_MINOR_VERSION=libsigrok_minor_version
247LIBSIGROK_MICRO_VERSION=libsigrok_micro_version
248LIBSIGROK_VERSION=libsigrok_version
249
250AC_SUBST(LIBSIGROK_MAJOR_VERSION)
251AC_SUBST(LIBSIGROK_MINOR_VERSION)
252AC_SUBST(LIBSIGROK_MICRO_VERSION)
253AC_SUBST(LIBSIGROK_VERSION)
254
255AC_DEFINE(LIBSIGROK_MAJOR_VERSION, [libsigrok_major_version],
256 [Define to the libsigrok major package version])
257AC_DEFINE(LIBSIGROK_MINOR_VERSION, [libsigrok_minor_version],
258 [Define to the libsigrok minor package version])
259AC_DEFINE(LIBSIGROK_MICRO_VERSION, [libsigrok_micro_version],
260 [Define to the libsigrok micro package version])
261AC_DEFINE(LIBSIGROK_VERSION, [libsigrok_version],
262 [Define to the libsigrok package version])
826938d8
UH
263
264AC_CONFIG_FILES([Makefile
db8ae7b9
UH
265 sigrok.h
266 firmware/Makefile
267 hardware/Makefile
268 hardware/alsa/Makefile
269 hardware/asix-sigma/Makefile
270 hardware/chronovu-la8/Makefile
271 hardware/common/Makefile
272 hardware/demo/Makefile
273 hardware/link-mso19/Makefile
274 hardware/openbench-logic-sniffer/Makefile
275 hardware/saleae-logic/Makefile
276 hardware/zeroplus-logic-cube/Makefile
277 input/Makefile
278 output/Makefile
279 output/text/Makefile
280 libsigrok.pc
826938d8 281 contrib/Makefile
826938d8
UH
282 ])
283
284AC_OUTPUT
285
286echo
45aed072 287echo "libsigrok configuration summary:"
826938d8 288echo
45aed072
UH
289echo " - Package version (major.minor.micro): $LIBSIGROK_VERSION"
290echo " - Library version (current:revision:age): $LIBSIGROK_LT_VERSION"
291echo " - Prefix: $prefix"
292echo
293echo "Detected libraries:"
294echo
295
296# Note: This only works for libs with pkg-config integration.
297for lib in "glib-2.0" "gthread-2.0" "libusb-1.0" "libzip" "zlib" "libftdi" "libudev" "alsa"; do
298 if `$PKG_CONFIG --exists $lib`; then
299 ver=`$PKG_CONFIG --modversion $lib`
300 answer="yes ($ver)"
301 else
302 answer="no"
303 fi
304 echo " - $lib: $answer"
305done
306
307echo
308echo "Enabled hardware drivers:"
309echo
310echo " - ASIX SIGMA...................... $LA_ASIX_SIGMA"
311echo " - ChronoVu LA8.................... $LA_CHRONOVU_LA8"
312echo " - Demo driver..................... $LA_DEMO"
313echo " - Link MSO-19..................... $LA_LINK_MSO19"
314echo " - Openbench Logic Sniffer......... $LA_OLS"
315echo " - Saleae Logic.................... $LA_SALEAE_LOGIC"
316echo " - Zeroplus Logic Cube............. $LA_ZEROPLUS_LOGIC_CUBE"
826938d8
UH
317echo
318