]> sigrok.org Git - libsigrok.git/blame - configure.ac
sr: Fix/document probe names.
[libsigrok.git] / configure.ac
CommitLineData
826938d8
UH
1##
2## This file is part of the sigrok project.
3##
c73d2ea4 4## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
826938d8
UH
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 42
1a081ca6
UH
43# Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden
44# and enforce use of SR_API to explicitly mark all public API functions.
45CFLAGS="-g -Wall -Wextra -fvisibility=hidden"
826938d8
UH
46
47# Checks for programs.
48AC_PROG_CXX
49AC_PROG_CC
50AC_PROG_CPP
51AC_PROG_INSTALL
52AC_PROG_LN_S
53
54# Initialize libtool.
55LT_INIT
56
57# Initialize pkg-config.
58# We require at least 0.22, as "Requires.private" behaviour changed there.
59PKG_PROG_PKG_CONFIG([0.22])
60
3af71f0d 61# Library version for libsigrok (NOT the same as the package version).
826938d8
UH
62# Carefully read the libtool docs before updating these numbers!
63# The algorithm for determining which number to change (and how) is nontrivial!
64# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
3af71f0d
UH
65LIBSIGROK_LT_CURRENT=0
66LIBSIGROK_LT_REVISION=0
67LIBSIGROK_LT_AGE=0
68LIBSIGROK_LT_VERSION="$LIBSIGROK_LT_CURRENT:$LIBSIGROK_LT_REVISION:$LIBSIGROK_LT_AGE"
69LIBSIGROK_LT_LDFLAGS="-version-info $LIBSIGROK_LT_VERSION"
70AC_SUBST(LIBSIGROK_LT_LDFLAGS)
826938d8 71
826938d8
UH
72# Logic analyzer hardware support '--enable' options.
73
74# Disabled by default, unfinished.
75AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
76 [enable ALSA driver support [default=no]]),
77 [LA_ALSA="$enableval"],
78 [LA_ALSA=no])
79AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes)
80if test "x$LA_ALSA" = "xyes"; then
81 AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support])
82fi
83
84AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
85 [enable ASIX Sigma support [default=yes]]),
86 [LA_ASIX_SIGMA="$enableval"],
87 [LA_ASIX_SIGMA=yes])
88AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
89if test "x$LA_ASIX_SIGMA" = "xyes"; then
90 AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX Sigma support])
91fi
92
93AC_ARG_ENABLE(chronovu-la8, AC_HELP_STRING([--enable-chronovu-la8],
94 [enable ChronoVu LA8 support [default=yes]]),
95 [LA_CHRONOVU_LA8="$enableval"],
96 [LA_CHRONOVU_LA8=yes])
97AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
98if test "x$LA_CHRONOVU_LA8" = "xyes"; then
99 AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
100fi
101
f302a082
JH
102# Disabled by default, unfinished.
103AC_ARG_ENABLE(fx2lafw, AC_HELP_STRING([--enable-fx2lafw],
104 [enable open source fx2lafw driver support for fx2 devices. [default=no]]),
105 [LA_FX2LAFW="$enableval"],
106 [LA_FX2LAFW=no])
107AM_CONDITIONAL(LA_FX2LAFW, test x$LA_FX2LAFW = xyes)
108if test "x$LA_FX2LAFW" = "xyes"; then
109 AC_DEFINE(HAVE_LA_FX2LAFW, 1, [fx2lafw support])
110fi
111
826938d8
UH
112AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
113 [enable demo driver support [default=yes]]),
114 [LA_DEMO="$enableval"],
115 [LA_DEMO=yes])
116AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
117if test "x$LA_DEMO" = "xyes"; then
118 AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
119fi
120
121# Disabled by default, unfinished.
122AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19],
123 [enable Link Instruments MSO-19 support [default=no]]),
124 [LA_LINK_MSO19="$enableval"],
125 [LA_LINK_MSO19=no])
126AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
127if test "x$LA_LINK_MSO19" = "xyes"; then
128 AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
129fi
130
131AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols],
132 [enable OpenBench Logic Sniffer (OLS) support [default=yes]]),
133 [LA_OLS="$enableval"],
134 [LA_OLS=yes])
135AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
136if test "x$LA_OLS" = "xyes"; then
137 AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
138fi
139
140AC_ARG_ENABLE(saleae-logic, AC_HELP_STRING([--enable-saleae-logic],
141 [enable Saleae Logic support [default=yes]]),
142 [LA_SALEAE_LOGIC="$enableval"],
143 [LA_SALEAE_LOGIC=yes])
144AM_CONDITIONAL(LA_SALEAE_LOGIC, test x$LA_SALEAE_LOGIC = xyes)
145if test "x$LA_SALEAE_LOGIC" = "xyes"; then
146 AC_DEFINE(HAVE_LA_SALEAE_LOGIC, 1, [Saleae Logic support])
147fi
148
149AC_ARG_ENABLE(zeroplus-logic-cube,
150 AC_HELP_STRING([--enable-zeroplus-logic-cube],
151 [enable Zeroplus Logic Cube support [default=yes]]),
152 [LA_ZEROPLUS_LOGIC_CUBE="$enableval"],
153 [LA_ZEROPLUS_LOGIC_CUBE=yes])
154AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes)
155if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
156 AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [Zeroplus Logic Cube support])
157fi
158
159# Checks for libraries.
160
161# This variable collects the pkg-config names of all detected libs.
162# It is then used to construct the "Requires.private:" field in the
163# libsigrok.pc file.
164LIBSIGROK_PKGLIBS=""
165
166# libglib-2.0 is always needed.
167# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
168AM_PATH_GLIB_2_0([2.22.0],
169 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
170
171# libgthread-2.0 is always needed (e.g. for the demo hardware driver).
172PKG_CHECK_MODULES([gthread], [gthread-2.0 >= 2.22.0],
173 [CFLAGS="$CFLAGS $gthread_CFLAGS"; LIBS="$LIBS $gthread_LIBS";
174 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS gthread-2.0"])
175
176# libusb is only needed for some hardware drivers.
177if test "x$LA_SALEAE_LOGIC" != xno \
178 -o "x$LA_ASIX_SIGMA" != xno \
179 -o "x$LA_CHRONOVU_LA8" != xno \
f302a082
JH
180 -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno \
181 -o "x$LA_FX2LAFW" != xno; then
826938d8
UH
182 case "$build" in
183 *freebsd*)
184 # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
185 AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
186 [Specifies whether we have a libusb.h header.])
187 ;;
188 *)
189 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.5],
190 [CFLAGS="$CFLAGS $libusb_CFLAGS";
191 LIBS="$LIBS $libusb_LIBS";
192 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libusb-1.0"])
193 AC_CHECK_LIB(usb-1.0, libusb_init)
194 ;;
195 esac
196fi
197
198# libzip is always needed.
199PKG_CHECK_MODULES([libzip], [libzip >= 0.8],
200 [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
201 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libzip"])
202
203# zlib is only needed for some hardware drivers.
204if test "x$LA_ASIX_SIGMA" != xno; then
44b6aafd
UH
205 case "$build" in
206 *freebsd*)
207 # FreeBSD has zlib, but no pkg-config file for it.
208 # Check manually, and do NOT add it to LIBSIGROK_PKGLIBS.
209 AC_CHECK_LIB(z, uncompress)
210 ;;
211 *)
212 PKG_CHECK_MODULES([zlib], [zlib >= 1.2.3.1],
213 [CFLAGS="$CFLAGS $zlib_CFLAGS"; LIBS="$LIBS $zlib_LIBS";
214 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS zlib"])
215 ;;
216 esac
826938d8
UH
217fi
218
219# libftdi is only needed for some hardware drivers.
220if test "x$LA_ASIX_SIGMA" != xno \
221 -o "x$LA_CHRONOVU_LA8" != xno; then
222 PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
223 [CFLAGS="$CFLAGS $libftdi_CFLAGS";
224 LIBS="$LIBS $libftdi_LIBS";
225 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libftdi"])
226fi
227
228# libudev is only needed for some hardware drivers.
229if test "x$LA_LINK_MSO19" != xno; then
230 PKG_CHECK_MODULES([libudev], [libudev >= 151],
231 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
232 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libudev"])
233fi
234
235# ALSA is only needed for some hardware drivers.
236if test "x$LA_ALSA" != xno; then
237 PKG_CHECK_MODULES([alsa], [alsa >= 1.0],
238 [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS";
239 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS alsa"])
240fi
241
826938d8
UH
242AC_SUBST(LIBSIGROK_PKGLIBS)
243
244# Checks for header files.
245# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
246AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
247
248# Checks for typedefs, structures, and compiler characteristics.
249AC_C_INLINE
250AC_TYPE_INT8_T
251AC_TYPE_INT16_T
252AC_TYPE_INT32_T
253AC_TYPE_INT64_T
254AC_TYPE_UINT8_T
255AC_TYPE_UINT16_T
256AC_TYPE_UINT32_T
257AC_TYPE_UINT64_T
258AC_TYPE_SIZE_T
259
260# Checks for library functions.
261AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
262
8e190238 263AC_SUBST(FIRMWARE_DIR, "$datadir/libsigrok/firmware")
826938d8
UH
264AC_SUBST(MAKEFLAGS, '--no-print-directory')
265AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
266
3af71f0d
UH
267LIBSIGROK_MAJOR_VERSION=libsigrok_major_version
268LIBSIGROK_MINOR_VERSION=libsigrok_minor_version
269LIBSIGROK_MICRO_VERSION=libsigrok_micro_version
270LIBSIGROK_VERSION=libsigrok_version
271
272AC_SUBST(LIBSIGROK_MAJOR_VERSION)
273AC_SUBST(LIBSIGROK_MINOR_VERSION)
274AC_SUBST(LIBSIGROK_MICRO_VERSION)
275AC_SUBST(LIBSIGROK_VERSION)
276
277AC_DEFINE(LIBSIGROK_MAJOR_VERSION, [libsigrok_major_version],
278 [Define to the libsigrok major package version])
279AC_DEFINE(LIBSIGROK_MINOR_VERSION, [libsigrok_minor_version],
280 [Define to the libsigrok minor package version])
281AC_DEFINE(LIBSIGROK_MICRO_VERSION, [libsigrok_micro_version],
282 [Define to the libsigrok micro package version])
283AC_DEFINE(LIBSIGROK_VERSION, [libsigrok_version],
284 [Define to the libsigrok package version])
826938d8
UH
285
286AC_CONFIG_FILES([Makefile
db8ae7b9
UH
287 firmware/Makefile
288 hardware/Makefile
289 hardware/alsa/Makefile
290 hardware/asix-sigma/Makefile
291 hardware/chronovu-la8/Makefile
292 hardware/common/Makefile
293 hardware/demo/Makefile
f302a082 294 hardware/fx2lafw/Makefile
db8ae7b9
UH
295 hardware/link-mso19/Makefile
296 hardware/openbench-logic-sniffer/Makefile
297 hardware/saleae-logic/Makefile
298 hardware/zeroplus-logic-cube/Makefile
299 input/Makefile
300 output/Makefile
301 output/text/Makefile
302 libsigrok.pc
826938d8 303 contrib/Makefile
826938d8
UH
304 ])
305
306AC_OUTPUT
307
308echo
45aed072 309echo "libsigrok configuration summary:"
826938d8 310echo
45aed072
UH
311echo " - Package version (major.minor.micro): $LIBSIGROK_VERSION"
312echo " - Library version (current:revision:age): $LIBSIGROK_LT_VERSION"
313echo " - Prefix: $prefix"
314echo
315echo "Detected libraries:"
316echo
317
318# Note: This only works for libs with pkg-config integration.
319for lib in "glib-2.0" "gthread-2.0" "libusb-1.0" "libzip" "zlib" "libftdi" "libudev" "alsa"; do
320 if `$PKG_CONFIG --exists $lib`; then
321 ver=`$PKG_CONFIG --modversion $lib`
322 answer="yes ($ver)"
323 else
324 answer="no"
325 fi
326 echo " - $lib: $answer"
327done
328
329echo
330echo "Enabled hardware drivers:"
331echo
332echo " - ASIX SIGMA...................... $LA_ASIX_SIGMA"
333echo " - ChronoVu LA8.................... $LA_CHRONOVU_LA8"
334echo " - Demo driver..................... $LA_DEMO"
f302a082 335echo " - fx2lafw......................... $LA_FX2LAFW"
45aed072
UH
336echo " - Link MSO-19..................... $LA_LINK_MSO19"
337echo " - Openbench Logic Sniffer......... $LA_OLS"
338echo " - Saleae Logic.................... $LA_SALEAE_LOGIC"
339echo " - Zeroplus Logic Cube............. $LA_ZEROPLUS_LOGIC_CUBE"
826938d8
UH
340echo
341