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/>.
22 m4_define([sigrok_major_version], [0])
23 m4_define([sigrok_minor_version], [2])
24 m4_define([sigrok_micro_version], [0])
25 m4_define([sigrok_version],
26 [sigrok_major_version.sigrok_minor_version.sigrok_micro_version])
28 AC_INIT([sigrok], [sigrok_version], [sigrok-devel@lists.sourceforge.net],
29 [sigrok], [http://www.sigrok.org])
30 AC_CONFIG_HEADER([config.h])
31 AC_CONFIG_MACRO_DIR([m4])
33 AM_INIT_AUTOMAKE([-Wall -Werror foreign std-options])
34 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
36 AH_TOP([#ifndef SGIROK_CONFIG_H
37 #define SIGROK_CONFIG_H /* To stop multiple inclusions. */])
38 AH_BOTTOM([#endif /* SIGROK_CONFIG_H */])
40 CFLAGS="-g -Wall -Wextra"
42 # Checks for programs.
52 # Initialize pkg-config.
53 # We require at least 0.22, as "Requires.private" behaviour changed there.
54 PKG_PROG_PKG_CONFIG([0.22])
56 # Library version for libsigrok.
57 # Carefully read the libtool docs before updating these numbers!
58 # The algorithm for determining which number to change (and how) is nontrivial!
59 # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
63 SIGROK_LT_VERSION="$SIGROK_LT_CURRENT:$SIGROK_LT_REVISION:$SIGROK_LT_AGE"
64 SIGROK_LT_LDFLAGS="-version-info $SIGROK_LT_VERSION"
65 AC_SUBST(SIGROK_LT_LDFLAGS)
67 # Library version for libsigrokdecode.
68 # Carefully read the libtool docs before updating these numbers!
69 # The algorithm for determining which number to change (and how) is nontrivial!
70 # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
71 SIGROKDECODE_LT_CURRENT=0
72 SIGROKDECODE_LT_REVISION=0
74 SIGROKDECODE_LT_VERSION="$SIGROKDECODE_LT_CURRENT:$SIGROKDECODE_LT_REVISION:$SIGROKDECODE_LT_AGE"
75 SIGROKDECODE_LT_LDFLAGS="-version-info $SIGROKDECODE_LT_VERSION"
76 AC_SUBST(SIGROKDECODE_LT_LDFLAGS)
78 # Logic analyzer hardware support '--enable' options.
80 # Disabled by default, unfinished.
81 AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
82 [enable ALSA driver support [default=no]]),
83 [LA_ALSA="$enableval"],
85 AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes)
86 if test "x$LA_ALSA" = "xyes"; then
87 AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support])
90 AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
91 [enable ASIX Sigma support [default=yes]]),
92 [LA_ASIX_SIGMA="$enableval"],
94 AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
95 if test "x$LA_ASIX_SIGMA" = "xyes"; then
96 AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX Sigma support])
99 AC_ARG_ENABLE(chronovu-la8, AC_HELP_STRING([--enable-chronovu-la8],
100 [enable ChronoVu LA8 support [default=yes]]),
101 [LA_CHRONOVU_LA8="$enableval"],
102 [LA_CHRONOVU_LA8=yes])
103 AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
104 if test "x$LA_CHRONOVU_LA8" = "xyes"; then
105 AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
108 AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
109 [enable demo driver support [default=yes]]),
110 [LA_DEMO="$enableval"],
112 AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
113 if test "x$LA_DEMO" = "xyes"; then
114 AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
117 # Disabled by default, unfinished.
118 AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19],
119 [enable Link Instruments MSO-19 support [default=no]]),
120 [LA_LINK_MSO19="$enableval"],
122 AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
123 if test "x$LA_LINK_MSO19" = "xyes"; then
124 AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
127 AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols],
128 [enable OpenBench Logic Sniffer (OLS) support [default=yes]]),
129 [LA_OLS="$enableval"],
131 AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
132 if test "x$LA_OLS" = "xyes"; then
133 AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
136 AC_ARG_ENABLE(saleae-logic, AC_HELP_STRING([--enable-saleae-logic],
137 [enable Saleae Logic support [default=yes]]),
138 [LA_SALEAE_LOGIC="$enableval"],
139 [LA_SALEAE_LOGIC=yes])
140 AM_CONDITIONAL(LA_SALEAE_LOGIC, test x$LA_SALEAE_LOGIC = xyes)
141 if test "x$LA_SALEAE_LOGIC" = "xyes"; then
142 AC_DEFINE(HAVE_LA_SALEAE_LOGIC, 1, [Saleae Logic 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 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS gthread-2.0"])
172 # libusb is only needed for some hardware drivers.
173 if test "x$LA_SALEAE_LOGIC" != xno \
174 -o "x$LA_ASIX_SIGMA" != xno \
175 -o "x$LA_CHRONOVU_LA8" != xno \
176 -o "x$LA_ZEROPLUS_LOGIC_CUBE" != 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 LIBSIGROK_PKGLIBS="$LIBSIGROK_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 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libzip"])
198 # zlib is only needed for some hardware drivers.
199 if test "x$LA_ASIX_SIGMA" != xno; then
200 PKG_CHECK_MODULES([zlib], [zlib >= 1.2.3.1],
201 [CFLAGS="$CFLAGS $zlib_CFLAGS"; LIBS="$LIBS $zlib_LIBS";
202 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS zlib"])
205 # libftdi is only needed for some hardware drivers.
206 if test "x$LA_ASIX_SIGMA" != xno \
207 -o "x$LA_CHRONOVU_LA8" != xno; then
208 PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
209 [CFLAGS="$CFLAGS $libftdi_CFLAGS";
210 LIBS="$LIBS $libftdi_LIBS";
211 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libftdi"])
214 # libudev is only needed for some hardware drivers.
215 if test "x$LA_LINK_MSO19" != xno; then
216 PKG_CHECK_MODULES([libudev], [libudev >= 151],
217 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
218 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS libudev"])
221 # ALSA is only needed for some hardware drivers.
222 if test "x$LA_ALSA" != xno; then
223 PKG_CHECK_MODULES([alsa], [alsa >= 1.0],
224 [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS";
225 LIBSIGROK_PKGLIBS="$LIBSIGROK_PKGLIBS alsa"])
233 # We know that Linux has 'python3-config'.
234 CPPFLAGS_PYTHON="$(python3-config --includes)"
235 LDFLAGS_PYTHON="$(python3-config --ldflags)"
238 # On Darwin, Macports has python3.x-config, fink has python3-config.
239 # Mac OS X (Snow Leopard) ships with 'python-config' per default, but
240 # that's Python 2.x, so not useful for us.
241 if test -x python3-config; then
242 # python3-config exists, use it.
243 CPPFLAGS_PYTHON="$(python3-config --includes)"
244 LDFLAGS_PYTHON="$(python3-config --ldflags)"
246 # No python3-config found, so try hardcoded python3.2-config.
247 CPPFLAGS_PYTHON="$(python3.2-config --includes)"
248 LDFLAGS_PYTHON="$(python3.2-config --ldflags)"
252 # We currently hardcode the paths to the Python 3.2 default install
253 # location as there's no 'python-config' script on Windows, it seems.
254 CPPFLAGS_PYTHON="-I/c/Python32/include"
255 LDFLAGS_PYTHON="-L/c/Python32/libs -lpython32"
258 # Everything else is untested, we just hope 'python3-config' works.
259 CPPFLAGS_PYTHON="$(python3-config --includes)"
260 LDFLAGS_PYTHON="$(python3-config --ldflags)"
263 AC_SUBST(CPPFLAGS_PYTHON)
264 AC_SUBST(LDFLAGS_PYTHON)
266 AC_SUBST(LIBSIGROK_PKGLIBS)
268 # Checks for header files.
269 # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
270 AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
272 # Checks for typedefs, structures, and compiler characteristics.
284 # Checks for library functions.
285 AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
287 AC_SUBST(FIRMWARE_DIR, "$datadir/sigrok/firmware")
288 AC_SUBST(DECODERS_DIR, "$datadir/sigrok/decoders")
289 AC_SUBST(MAKEFLAGS, '--no-print-directory')
290 AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
292 SIGROK_MAJOR_VERSION=sigrok_major_version
293 SIGROK_MINOR_VERSION=sigrok_minor_version
294 SIGROK_MICRO_VERSION=sigrok_micro_version
295 SIGROK_VERSION=sigrok_version
297 AC_SUBST(SIGROK_MAJOR_VERSION)
298 AC_SUBST(SIGROK_MINOR_VERSION)
299 AC_SUBST(SIGROK_MICRO_VERSION)
300 AC_SUBST(SIGROK_VERSION)
302 AC_DEFINE(SIGROK_MAJOR_VERSION, [sigrok_major_version],
303 [Define to the sigrok major version])
304 AC_DEFINE(SIGROK_MINOR_VERSION, [sigrok_minor_version],
305 [Define to the sigrok minor version])
306 AC_DEFINE(SIGROK_MICRO_VERSION, [sigrok_micro_version],
307 [Define to the sigrok micro version])
308 AC_DEFINE(SIGROK_VERSION, [sigrok_version],
309 [Define to the sigrok version])
311 AC_CONFIG_FILES([Makefile
313 contrib/nsis/Makefile
314 contrib/nsis/sigrok.nsi
317 libsigrok/firmware/Makefile
318 libsigrok/hardware/Makefile
319 libsigrok/hardware/alsa/Makefile
320 libsigrok/hardware/asix-sigma/Makefile
321 libsigrok/hardware/chronovu-la8/Makefile
322 libsigrok/hardware/common/Makefile
323 libsigrok/hardware/demo/Makefile
324 libsigrok/hardware/link-mso19/Makefile
325 libsigrok/hardware/openbench-logic-sniffer/Makefile
326 libsigrok/hardware/saleae-logic/Makefile
327 libsigrok/hardware/zeroplus-logic-cube/Makefile
328 libsigrok/input/Makefile
329 libsigrok/output/Makefile
330 libsigrok/output/text/Makefile
331 libsigrok/libsigrok.pc
332 libsigrok/contrib/Makefile
333 libsigrokdecode/Makefile
334 libsigrokdecode/libsigrokdecode.pc
335 libsigrokdecode/decoders/Makefile
341 echo "Building drivers:"
343 echo "ASIX SIGMA...................... " $LA_ASIX_SIGMA
344 echo "ChronoVu LA8.................... " $LA_CHRONOVU_LA8
345 echo "Link MSO-19..................... " $LA_LINK_MSO19
346 echo "Openbench Logic Sniffer......... " $LA_OLS
347 echo "Saleae Logic.................... " $LA_SALEAE_LOGIC
348 echo "Zeroplus Logic Cube............. " $LA_ZEROPLUS_LOGIC_CUBE