]> sigrok.org Git - libsigrok.git/blame - configure.ac
Put most autotools files into autostuff/.
[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
20AC_PREREQ(2.61)
21
db8ae7b9 22# TODO: Should be libsigrok, no sigrok.
826938d8
UH
23m4_define([sigrok_major_version], [0])
24m4_define([sigrok_minor_version], [2])
25m4_define([sigrok_micro_version], [0])
26m4_define([sigrok_version],
27 [sigrok_major_version.sigrok_minor_version.sigrok_micro_version])
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
UH
34
35AM_INIT_AUTOMAKE([-Wall -Werror foreign std-options])
36m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
37
db8ae7b9
UH
38AH_TOP([#ifndef LIBSIGROK_CONFIG_H
39#define LIBSIGROK_CONFIG_H /* To stop multiple inclusions. */])
40AH_BOTTOM([#endif /* LIBSIGROK_CONFIG_H */])
826938d8
UH
41
42CFLAGS="-g -Wall -Wextra"
43
44# Checks for programs.
45AC_PROG_CXX
46AC_PROG_CC
47AC_PROG_CPP
48AC_PROG_INSTALL
49AC_PROG_LN_S
50
51# Initialize libtool.
52LT_INIT
53
54# Initialize pkg-config.
55# We require at least 0.22, as "Requires.private" behaviour changed there.
56PKG_PROG_PKG_CONFIG([0.22])
57
58# Library version for libsigrok.
59# Carefully read the libtool docs before updating these numbers!
60# The algorithm for determining which number to change (and how) is nontrivial!
61# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
62SIGROK_LT_CURRENT=0
63SIGROK_LT_REVISION=0
64SIGROK_LT_AGE=0
65SIGROK_LT_VERSION="$SIGROK_LT_CURRENT:$SIGROK_LT_REVISION:$SIGROK_LT_AGE"
66SIGROK_LT_LDFLAGS="-version-info $SIGROK_LT_VERSION"
67AC_SUBST(SIGROK_LT_LDFLAGS)
68
826938d8
UH
69# Logic analyzer hardware support '--enable' options.
70
71# Disabled by default, unfinished.
72AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
73 [enable ALSA driver support [default=no]]),
74 [LA_ALSA="$enableval"],
75 [LA_ALSA=no])
76AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes)
77if test "x$LA_ALSA" = "xyes"; then
78 AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support])
79fi
80
81AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
82 [enable ASIX Sigma support [default=yes]]),
83 [LA_ASIX_SIGMA="$enableval"],
84 [LA_ASIX_SIGMA=yes])
85AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
86if test "x$LA_ASIX_SIGMA" = "xyes"; then
87 AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX Sigma support])
88fi
89
90AC_ARG_ENABLE(chronovu-la8, AC_HELP_STRING([--enable-chronovu-la8],
91 [enable ChronoVu LA8 support [default=yes]]),
92 [LA_CHRONOVU_LA8="$enableval"],
93 [LA_CHRONOVU_LA8=yes])
94AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
95if test "x$LA_CHRONOVU_LA8" = "xyes"; then
96 AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
97fi
98
99AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
100 [enable demo driver support [default=yes]]),
101 [LA_DEMO="$enableval"],
102 [LA_DEMO=yes])
103AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
104if test "x$LA_DEMO" = "xyes"; then
105 AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
106fi
107
108# Disabled by default, unfinished.
109AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19],
110 [enable Link Instruments MSO-19 support [default=no]]),
111 [LA_LINK_MSO19="$enableval"],
112 [LA_LINK_MSO19=no])
113AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
114if test "x$LA_LINK_MSO19" = "xyes"; then
115 AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
116fi
117
118AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols],
119 [enable OpenBench Logic Sniffer (OLS) support [default=yes]]),
120 [LA_OLS="$enableval"],
121 [LA_OLS=yes])
122AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
123if test "x$LA_OLS" = "xyes"; then
124 AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
125fi
126
127AC_ARG_ENABLE(saleae-logic, AC_HELP_STRING([--enable-saleae-logic],
128 [enable Saleae Logic support [default=yes]]),
129 [LA_SALEAE_LOGIC="$enableval"],
130 [LA_SALEAE_LOGIC=yes])
131AM_CONDITIONAL(LA_SALEAE_LOGIC, test x$LA_SALEAE_LOGIC = xyes)
132if test "x$LA_SALEAE_LOGIC" = "xyes"; then
133 AC_DEFINE(HAVE_LA_SALEAE_LOGIC, 1, [Saleae Logic support])
134fi
135
136AC_ARG_ENABLE(zeroplus-logic-cube,
137 AC_HELP_STRING([--enable-zeroplus-logic-cube],
138 [enable Zeroplus Logic Cube support [default=yes]]),
139 [LA_ZEROPLUS_LOGIC_CUBE="$enableval"],
140 [LA_ZEROPLUS_LOGIC_CUBE=yes])
141AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes)
142if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
143 AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [Zeroplus Logic Cube support])
144fi
145
146# Checks for libraries.
147
148# This variable collects the pkg-config names of all detected libs.
149# It is then used to construct the "Requires.private:" field in the
150# libsigrok.pc file.
151LIBSIGROK_PKGLIBS=""
152
153# libglib-2.0 is always needed.
154# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
155AM_PATH_GLIB_2_0([2.22.0],
156 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
157
158# libgthread-2.0 is always needed (e.g. for the demo hardware driver).
159PKG_CHECK_MODULES([gthread], [gthread-2.0 >= 2.22.0],
160 [CFLAGS="$CFLAGS $gthread_CFLAGS"; LIBS="$LIBS $gthread_LIBS";
161 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS gthread-2.0"])
162
163# libusb is only needed for some hardware drivers.
164if test "x$LA_SALEAE_LOGIC" != xno \
165 -o "x$LA_ASIX_SIGMA" != xno \
166 -o "x$LA_CHRONOVU_LA8" != xno \
167 -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno; then
168 case "$build" in
169 *freebsd*)
170 # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
171 AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
172 [Specifies whether we have a libusb.h header.])
173 ;;
174 *)
175 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.5],
176 [CFLAGS="$CFLAGS $libusb_CFLAGS";
177 LIBS="$LIBS $libusb_LIBS";
178 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libusb-1.0"])
179 AC_CHECK_LIB(usb-1.0, libusb_init)
180 ;;
181 esac
182fi
183
184# libzip is always needed.
185PKG_CHECK_MODULES([libzip], [libzip >= 0.8],
186 [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
187 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libzip"])
188
189# zlib is only needed for some hardware drivers.
190if test "x$LA_ASIX_SIGMA" != xno; then
191 PKG_CHECK_MODULES([zlib], [zlib >= 1.2.3.1],
192 [CFLAGS="$CFLAGS $zlib_CFLAGS"; LIBS="$LIBS $zlib_LIBS";
193 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS zlib"])
194fi
195
196# libftdi is only needed for some hardware drivers.
197if test "x$LA_ASIX_SIGMA" != xno \
198 -o "x$LA_CHRONOVU_LA8" != xno; then
199 PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
200 [CFLAGS="$CFLAGS $libftdi_CFLAGS";
201 LIBS="$LIBS $libftdi_LIBS";
202 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libftdi"])
203fi
204
205# libudev is only needed for some hardware drivers.
206if test "x$LA_LINK_MSO19" != xno; then
207 PKG_CHECK_MODULES([libudev], [libudev >= 151],
208 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
209 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libudev"])
210fi
211
212# ALSA is only needed for some hardware drivers.
213if test "x$LA_ALSA" != xno; then
214 PKG_CHECK_MODULES([alsa], [alsa >= 1.0],
215 [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS";
216 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS alsa"])
217fi
218
826938d8
UH
219AC_SUBST(LIBSIGROK_PKGLIBS)
220
221# Checks for header files.
222# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
223AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
224
225# Checks for typedefs, structures, and compiler characteristics.
226AC_C_INLINE
227AC_TYPE_INT8_T
228AC_TYPE_INT16_T
229AC_TYPE_INT32_T
230AC_TYPE_INT64_T
231AC_TYPE_UINT8_T
232AC_TYPE_UINT16_T
233AC_TYPE_UINT32_T
234AC_TYPE_UINT64_T
235AC_TYPE_SIZE_T
236
237# Checks for library functions.
238AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
239
8e190238 240AC_SUBST(FIRMWARE_DIR, "$datadir/libsigrok/firmware")
826938d8
UH
241AC_SUBST(MAKEFLAGS, '--no-print-directory')
242AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
243
244SIGROK_MAJOR_VERSION=sigrok_major_version
245SIGROK_MINOR_VERSION=sigrok_minor_version
246SIGROK_MICRO_VERSION=sigrok_micro_version
247SIGROK_VERSION=sigrok_version
248
249AC_SUBST(SIGROK_MAJOR_VERSION)
250AC_SUBST(SIGROK_MINOR_VERSION)
251AC_SUBST(SIGROK_MICRO_VERSION)
252AC_SUBST(SIGROK_VERSION)
253
254AC_DEFINE(SIGROK_MAJOR_VERSION, [sigrok_major_version],
255 [Define to the sigrok major version])
256AC_DEFINE(SIGROK_MINOR_VERSION, [sigrok_minor_version],
257 [Define to the sigrok minor version])
258AC_DEFINE(SIGROK_MICRO_VERSION, [sigrok_micro_version],
259 [Define to the sigrok micro version])
260AC_DEFINE(SIGROK_VERSION, [sigrok_version],
261 [Define to the sigrok version])
262
263AC_CONFIG_FILES([Makefile
db8ae7b9
UH
264 sigrok.h
265 firmware/Makefile
266 hardware/Makefile
267 hardware/alsa/Makefile
268 hardware/asix-sigma/Makefile
269 hardware/chronovu-la8/Makefile
270 hardware/common/Makefile
271 hardware/demo/Makefile
272 hardware/link-mso19/Makefile
273 hardware/openbench-logic-sniffer/Makefile
274 hardware/saleae-logic/Makefile
275 hardware/zeroplus-logic-cube/Makefile
276 input/Makefile
277 output/Makefile
278 output/text/Makefile
279 libsigrok.pc
826938d8 280 contrib/Makefile
826938d8
UH
281 ])
282
283AC_OUTPUT
284
285echo
286echo "Building drivers:"
287echo
288echo "ASIX SIGMA...................... " $LA_ASIX_SIGMA
289echo "ChronoVu LA8.................... " $LA_CHRONOVU_LA8
290echo "Link MSO-19..................... " $LA_LINK_MSO19
291echo "Openbench Logic Sniffer......... " $LA_OLS
292echo "Saleae Logic.................... " $LA_SALEAE_LOGIC
293echo "Zeroplus Logic Cube............. " $LA_ZEROPLUS_LOGIC_CUBE
294echo
295