2 ## This file is part of the sigrok project.
4 ## Copyright (C) 2010-2012 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([sr_package_version_major], [0])
25 m4_define([sr_package_version_minor], [1])
26 m4_define([sr_package_version_micro], [1])
27 m4_define([sr_package_version], [sr_package_version_major.sr_package_version_minor.sr_package_version_micro])
29 AC_INIT([libsigrok], [sr_package_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])])
38 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
40 AH_TOP([#ifndef SR_CONFIG_H
41 #define SR_CONFIG_H /* To stop multiple inclusions. */])
42 AH_BOTTOM([#endif /* SR_CONFIG_H */])
44 # Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden
45 # and enforce use of SR_API to explicitly mark all public API functions.
46 CFLAGS="-g -Wall -Wextra -fvisibility=hidden"
48 # Checks for programs.
58 # Initialize pkg-config.
59 # We require at least 0.22, as "Requires.private" behaviour changed there.
60 PKG_PROG_PKG_CONFIG([0.22])
62 # Library version for libsigrok (NOT the same as the package version).
63 # Carefully read the libtool docs before updating these numbers!
64 # The algorithm for determining which number to change (and how) is nontrivial!
65 # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
66 SR_LIB_VERSION_CURRENT=0
67 SR_LIB_VERSION_REVISION=0
69 SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE"
70 SR_LIB_LDFLAGS="-version-info $SR_LIB_VERSION"
71 AC_SUBST(SR_LIB_VERSION_CURRENT)
72 AC_SUBST(SR_LIB_VERSION_REVISION)
73 AC_SUBST(SR_LIB_VERSION_AGE)
74 AC_SUBST(SR_LIB_VERSION)
75 AC_SUBST(SR_LIB_LDFLAGS)
77 # Logic analyzer hardware support '--enable' options.
79 # Disabled by default, unfinished.
80 AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
81 [enable ALSA driver support [default=no]]),
82 [LA_ALSA="$enableval"],
84 AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes)
85 if test "x$LA_ALSA" = "xyes"; then
86 AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support])
89 AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
90 [enable ASIX SIGMA/SIGMA2 support [default=yes]]),
91 [LA_ASIX_SIGMA="$enableval"],
93 AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
94 if test "x$LA_ASIX_SIGMA" = "xyes"; then
95 AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX SIGMA/SIGMA2 support])
98 AC_ARG_ENABLE(chronovu-la8, AC_HELP_STRING([--enable-chronovu-la8],
99 [enable ChronoVu LA8 support [default=yes]]),
100 [LA_CHRONOVU_LA8="$enableval"],
101 [LA_CHRONOVU_LA8=yes])
102 AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
103 if test "x$LA_CHRONOVU_LA8" = "xyes"; then
104 AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
107 # Disabled per default for now, will be enabled when it's tested some more.
108 AC_ARG_ENABLE(fx2lafw, AC_HELP_STRING([--enable-fx2lafw],
109 [enable fx2lafw support (for FX2 LAs). [default=no]]),
110 [LA_FX2LAFW="$enableval"],
112 AM_CONDITIONAL(LA_FX2LAFW, test x$LA_FX2LAFW = xyes)
113 if test "x$LA_FX2LAFW" = "xyes"; then
114 AC_DEFINE(HAVE_LA_FX2LAFW, 1, [fx2lafw support])
117 AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
118 [enable demo driver support [default=yes]]),
119 [LA_DEMO="$enableval"],
121 AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
122 if test "x$LA_DEMO" = "xyes"; then
123 AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
126 # Disabled by default, unfinished.
127 AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19],
128 [enable Link Instruments MSO-19 support [default=no]]),
129 [LA_LINK_MSO19="$enableval"],
131 AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
132 if test "x$LA_LINK_MSO19" = "xyes"; then
133 AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
136 AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols],
137 [enable OpenBench Logic Sniffer (OLS) support [default=yes]]),
138 [LA_OLS="$enableval"],
140 AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
141 if test "x$LA_OLS" = "xyes"; then
142 AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
145 AC_ARG_ENABLE(zeroplus-logic-cube,
146 AC_HELP_STRING([--enable-zeroplus-logic-cube],
147 [enable ZEROPLUS Logic Cube support [default=yes]]),
148 [LA_ZEROPLUS_LOGIC_CUBE="$enableval"],
149 [LA_ZEROPLUS_LOGIC_CUBE=yes])
150 AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes)
151 if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
152 AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [ZEROPLUS Logic Cube support])
155 # Checks for libraries.
157 # This variable collects the pkg-config names of all detected libs.
158 # It is then used to construct the "Requires.private:" field in the
162 # libglib-2.0 is always needed.
163 # Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
164 AM_PATH_GLIB_2_0([2.22.0],
165 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
167 # libgthread-2.0 is always needed (e.g. for the demo hardware driver).
168 PKG_CHECK_MODULES([gthread], [gthread-2.0 >= 2.22.0],
169 [CFLAGS="$CFLAGS $gthread_CFLAGS"; LIBS="$LIBS $gthread_LIBS";
170 SR_PKGLIBS="$SR_PKGLIBS gthread-2.0"])
172 # libusb is only needed for some hardware drivers.
173 if test "x$LA_ASIX_SIGMA" != xno \
174 -o "x$LA_CHRONOVU_LA8" != xno \
175 -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno \
176 -o "x$LA_FX2LAFW" != xno; then
179 # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
180 AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
181 [Specifies whether we have a libusb.h header.])
184 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.5],
185 [CFLAGS="$CFLAGS $libusb_CFLAGS";
186 LIBS="$LIBS $libusb_LIBS";
187 SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"])
188 AC_CHECK_LIB(usb-1.0, libusb_init)
193 # libzip is always needed.
194 PKG_CHECK_MODULES([libzip], [libzip >= 0.8],
195 [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
196 SR_PKGLIBS="$SR_PKGLIBS libzip"])
198 # libftdi is only needed for some hardware drivers.
199 if test "x$LA_ASIX_SIGMA" != xno \
200 -o "x$LA_CHRONOVU_LA8" != xno; then
201 PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
202 [CFLAGS="$CFLAGS $libftdi_CFLAGS";
203 LIBS="$LIBS $libftdi_LIBS";
204 SR_PKGLIBS="$SR_PKGLIBS libftdi"])
207 # libudev is only needed for some hardware drivers.
208 if test "x$LA_LINK_MSO19" != xno; then
209 PKG_CHECK_MODULES([libudev], [libudev >= 151],
210 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
211 SR_PKGLIBS="$SR_PKGLIBS libudev"])
214 # ALSA is only needed for some hardware drivers.
215 if test "x$LA_ALSA" != xno; then
216 PKG_CHECK_MODULES([alsa], [alsa >= 1.0],
217 [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS";
218 SR_PKGLIBS="$SR_PKGLIBS alsa"])
223 # Checks for header files.
224 # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
225 AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
227 # Checks for typedefs, structures, and compiler characteristics.
239 # Checks for library functions.
240 AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
242 AC_SUBST(FIRMWARE_DIR, "$datadir/sigrok-firmware")
243 AC_SUBST(MAKEFLAGS, '--no-print-directory')
244 AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
246 SR_PACKAGE_VERSION_MAJOR=sr_package_version_major
247 SR_PACKAGE_VERSION_MINOR=sr_package_version_minor
248 SR_PACKAGE_VERSION_MICRO=sr_package_version_micro
249 SR_PACKAGE_VERSION=sr_package_version
251 AC_SUBST(SR_PACKAGE_VERSION_MAJOR)
252 AC_SUBST(SR_PACKAGE_VERSION_MINOR)
253 AC_SUBST(SR_PACKAGE_VERSION_MICRO)
254 AC_SUBST(SR_PACKAGE_VERSION)
256 AC_CONFIG_FILES([Makefile
259 hardware/alsa/Makefile
260 hardware/asix-sigma/Makefile
261 hardware/chronovu-la8/Makefile
262 hardware/common/Makefile
263 hardware/demo/Makefile
264 hardware/fx2lafw/Makefile
265 hardware/link-mso19/Makefile
266 hardware/openbench-logic-sniffer/Makefile
267 hardware/zeroplus-logic-cube/Makefile
278 echo "libsigrok configuration summary:"
280 echo " - Package version (major.minor.micro): $SR_PACKAGE_VERSION"
281 echo " - Library version (current:revision:age): $SR_LIB_VERSION"
282 echo " - Prefix: $prefix"
284 echo "Detected libraries:"
287 # Note: This only works for libs with pkg-config integration.
288 for lib in "glib-2.0" "gthread-2.0" "libusb-1.0" "libzip" "libftdi" "libudev" "alsa"; do
289 if `$PKG_CONFIG --exists $lib`; then
290 ver=`$PKG_CONFIG --modversion $lib`
295 echo " - $lib: $answer"
299 echo "Enabled hardware drivers:"
301 echo " - ASIX SIGMA/SIGMA2............... $LA_ASIX_SIGMA"
302 echo " - ChronoVu LA8.................... $LA_CHRONOVU_LA8"
303 echo " - Demo driver..................... $LA_DEMO"
304 echo " - fx2lafw (for FX2 LAs)........... $LA_FX2LAFW"
305 echo " - Link MSO-19..................... $LA_LINK_MSO19"
306 echo " - Openbench Logic Sniffer......... $LA_OLS"
307 echo " - ZEROPLUS Logic Cube............. $LA_ZEROPLUS_LOGIC_CUBE"