2 ## This file is part of the sigrok project.
4 ## Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
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.
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.
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/>.
20 # We require at least autoconf 2.63 (AC_INIT format changed there).
23 # libsigrok package version number (NOT the same as shared lib version!).
24 m4_define([libsigrok_major_version], [0])
25 m4_define([libsigrok_minor_version], [2])
26 m4_define([libsigrok_micro_version], [0])
27 m4_define([libsigrok_version], [libsigrok_major_version.libsigrok_minor_version.libsigrok_micro_version])
29 AC_INIT([libsigrok], [libsigrok_version], [sigrok-devel@lists.sourceforge.net],
30 [libsigrok], [http://www.sigrok.org])
31 AC_CONFIG_HEADER([config.h])
32 AC_CONFIG_MACRO_DIR([autostuff])
33 AC_CONFIG_AUX_DIR([autostuff])
35 # We require at least automake 1.11 (needed for 'silent rules').
36 AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign std-options])
37 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
39 AH_TOP([#ifndef LIBSIGROK_CONFIG_H
40 #define LIBSIGROK_CONFIG_H /* To stop multiple inclusions. */])
41 AH_BOTTOM([#endif /* LIBSIGROK_CONFIG_H */])
43 CFLAGS="-g -Wall -Wextra"
45 # Checks for programs.
55 # Initialize pkg-config.
56 # We require at least 0.22, as "Requires.private" behaviour changed there.
57 PKG_PROG_PKG_CONFIG([0.22])
59 # Library version for libsigrok (NOT the same as the package version).
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
63 LIBSIGROK_LT_CURRENT=0
64 LIBSIGROK_LT_REVISION=0
66 LIBSIGROK_LT_VERSION="$LIBSIGROK_LT_CURRENT:$LIBSIGROK_LT_REVISION:$LIBSIGROK_LT_AGE"
67 LIBSIGROK_LT_LDFLAGS="-version-info $LIBSIGROK_LT_VERSION"
68 AC_SUBST(LIBSIGROK_LT_LDFLAGS)
70 # Logic analyzer hardware support '--enable' options.
72 # Disabled by default, unfinished.
73 AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
74 [enable ALSA driver support [default=no]]),
75 [LA_ALSA="$enableval"],
77 AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes)
78 if test "x$LA_ALSA" = "xyes"; then
79 AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support])
82 AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
83 [enable ASIX Sigma support [default=yes]]),
84 [LA_ASIX_SIGMA="$enableval"],
86 AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
87 if test "x$LA_ASIX_SIGMA" = "xyes"; then
88 AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX Sigma support])
91 AC_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])
95 AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
96 if test "x$LA_CHRONOVU_LA8" = "xyes"; then
97 AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
100 AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
101 [enable demo driver support [default=yes]]),
102 [LA_DEMO="$enableval"],
104 AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
105 if test "x$LA_DEMO" = "xyes"; then
106 AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
109 # Disabled by default, unfinished.
110 AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19],
111 [enable Link Instruments MSO-19 support [default=no]]),
112 [LA_LINK_MSO19="$enableval"],
114 AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
115 if test "x$LA_LINK_MSO19" = "xyes"; then
116 AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
119 AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols],
120 [enable OpenBench Logic Sniffer (OLS) support [default=yes]]),
121 [LA_OLS="$enableval"],
123 AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
124 if test "x$LA_OLS" = "xyes"; then
125 AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
128 AC_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])
132 AM_CONDITIONAL(LA_SALEAE_LOGIC, test x$LA_SALEAE_LOGIC = xyes)
133 if test "x$LA_SALEAE_LOGIC" = "xyes"; then
134 AC_DEFINE(HAVE_LA_SALEAE_LOGIC, 1, [Saleae Logic support])
137 AC_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])
142 AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes)
143 if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
144 AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [Zeroplus Logic Cube support])
147 # Checks for libraries.
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
154 # libglib-2.0 is always needed.
155 # Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
156 AM_PATH_GLIB_2_0([2.22.0],
157 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
159 # libgthread-2.0 is always needed (e.g. for the demo hardware driver).
160 PKG_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"])
164 # libusb is only needed for some hardware drivers.
165 if 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
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.])
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)
185 # libzip is always needed.
186 PKG_CHECK_MODULES([libzip], [libzip >= 0.8],
187 [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
188 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libzip"])
190 # zlib is only needed for some hardware drivers.
191 if 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"])
197 # libftdi is only needed for some hardware drivers.
198 if 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"])
206 # libudev is only needed for some hardware drivers.
207 if 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"])
213 # ALSA is only needed for some hardware drivers.
214 if 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"])
220 AC_SUBST(LIBSIGROK_PKGLIBS)
222 # Checks for header files.
223 # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
224 AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
226 # Checks for typedefs, structures, and compiler characteristics.
238 # Checks for library functions.
239 AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
241 AC_SUBST(FIRMWARE_DIR, "$datadir/libsigrok/firmware")
242 AC_SUBST(MAKEFLAGS, '--no-print-directory')
243 AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
245 LIBSIGROK_MAJOR_VERSION=libsigrok_major_version
246 LIBSIGROK_MINOR_VERSION=libsigrok_minor_version
247 LIBSIGROK_MICRO_VERSION=libsigrok_micro_version
248 LIBSIGROK_VERSION=libsigrok_version
250 AC_SUBST(LIBSIGROK_MAJOR_VERSION)
251 AC_SUBST(LIBSIGROK_MINOR_VERSION)
252 AC_SUBST(LIBSIGROK_MICRO_VERSION)
253 AC_SUBST(LIBSIGROK_VERSION)
255 AC_DEFINE(LIBSIGROK_MAJOR_VERSION, [libsigrok_major_version],
256 [Define to the libsigrok major package version])
257 AC_DEFINE(LIBSIGROK_MINOR_VERSION, [libsigrok_minor_version],
258 [Define to the libsigrok minor package version])
259 AC_DEFINE(LIBSIGROK_MICRO_VERSION, [libsigrok_micro_version],
260 [Define to the libsigrok micro package version])
261 AC_DEFINE(LIBSIGROK_VERSION, [libsigrok_version],
262 [Define to the libsigrok package version])
264 AC_CONFIG_FILES([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
287 echo "libsigrok configuration summary:"
289 echo " - Package version (major.minor.micro): $LIBSIGROK_VERSION"
290 echo " - Library version (current:revision:age): $LIBSIGROK_LT_VERSION"
291 echo " - Prefix: $prefix"
293 echo "Detected libraries:"
296 # Note: This only works for libs with pkg-config integration.
297 for 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`
304 echo " - $lib: $answer"
308 echo "Enabled hardware drivers:"
310 echo " - ASIX SIGMA...................... $LA_ASIX_SIGMA"
311 echo " - ChronoVu LA8.................... $LA_CHRONOVU_LA8"
312 echo " - Demo driver..................... $LA_DEMO"
313 echo " - Link MSO-19..................... $LA_LINK_MSO19"
314 echo " - Openbench Logic Sniffer......... $LA_OLS"
315 echo " - Saleae Logic.................... $LA_SALEAE_LOGIC"
316 echo " - Zeroplus Logic Cube............. $LA_ZEROPLUS_LOGIC_CUBE"