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