]>
Commit | Line | Data |
---|---|---|
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). |
21 | AC_PREREQ([2.63]) | |
826938d8 | 22 | |
3af71f0d | 23 | # libsigrok package version number (NOT the same as shared lib version!). |
6dddd902 UH |
24 | m4_define([sr_package_version_major], [0]) |
25 | m4_define([sr_package_version_minor], [1]) | |
26 | m4_define([sr_package_version_micro], [0]) | |
27 | m4_define([sr_package_version], [sr_package_version_major.sr_package_version_minor.sr_package_version_micro]) | |
826938d8 | 28 | |
6dddd902 | 29 | AC_INIT([libsigrok], [sr_package_version], [sigrok-devel@lists.sourceforge.net], |
db8ae7b9 | 30 | [libsigrok], [http://www.sigrok.org]) |
826938d8 | 31 | AC_CONFIG_HEADER([config.h]) |
d8521c93 UH |
32 | AC_CONFIG_MACRO_DIR([autostuff]) |
33 | AC_CONFIG_AUX_DIR([autostuff]) | |
826938d8 | 34 | |
ef7228ba UH |
35 | # We require at least automake 1.11 (needed for 'silent rules'). |
36 | AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign std-options]) | |
826938d8 UH |
37 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
38 | ||
6dddd902 UH |
39 | AH_TOP([#ifndef SR_CONFIG_H |
40 | #define SR_CONFIG_H /* To stop multiple inclusions. */]) | |
41 | AH_BOTTOM([#endif /* SR_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. | |
45 | CFLAGS="-g -Wall -Wextra -fvisibility=hidden" | |
826938d8 UH |
46 | |
47 | # Checks for programs. | |
48 | AC_PROG_CXX | |
49 | AC_PROG_CC | |
50 | AC_PROG_CPP | |
51 | AC_PROG_INSTALL | |
52 | AC_PROG_LN_S | |
53 | ||
54 | # Initialize libtool. | |
55 | LT_INIT | |
56 | ||
57 | # Initialize pkg-config. | |
58 | # We require at least 0.22, as "Requires.private" behaviour changed there. | |
59 | PKG_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 | |
6dddd902 UH |
65 | SR_LIB_VERSION_CURRENT=0 |
66 | SR_LIB_VERSION_REVISION=0 | |
67 | SR_LIB_VERSION_AGE=0 | |
68 | SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE" | |
69 | SR_LIB_LDFLAGS="-version-info $SR_LIB_VERSION" | |
70 | AC_SUBST(SR_LIB_VERSION_CURRENT) | |
71 | AC_SUBST(SR_LIB_VERSION_REVISION) | |
72 | AC_SUBST(SR_LIB_VERSION_AGE) | |
73 | AC_SUBST(SR_LIB_VERSION) | |
74 | AC_SUBST(SR_LIB_LDFLAGS) | |
826938d8 | 75 | |
826938d8 UH |
76 | # Logic analyzer hardware support '--enable' options. |
77 | ||
78 | # Disabled by default, unfinished. | |
79 | AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa], | |
80 | [enable ALSA driver support [default=no]]), | |
81 | [LA_ALSA="$enableval"], | |
82 | [LA_ALSA=no]) | |
83 | AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes) | |
84 | if test "x$LA_ALSA" = "xyes"; then | |
85 | AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support]) | |
86 | fi | |
87 | ||
88 | AC_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]) | |
92 | AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes) | |
93 | if test "x$LA_ASIX_SIGMA" = "xyes"; then | |
94 | AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX Sigma support]) | |
95 | fi | |
96 | ||
97 | AC_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]) | |
101 | AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes) | |
102 | if test "x$LA_CHRONOVU_LA8" = "xyes"; then | |
103 | AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support]) | |
104 | fi | |
105 | ||
2e26e0aa | 106 | # Disabled per default for now, will be enabled when it's tested some more. |
f302a082 | 107 | AC_ARG_ENABLE(fx2lafw, AC_HELP_STRING([--enable-fx2lafw], |
2e26e0aa | 108 | [enable fx2lafw support (for FX2 LAs). [default=no]]), |
f302a082 | 109 | [LA_FX2LAFW="$enableval"], |
d56ee265 | 110 | [LA_FX2LAFW=yes]) |
f302a082 JH |
111 | AM_CONDITIONAL(LA_FX2LAFW, test x$LA_FX2LAFW = xyes) |
112 | if test "x$LA_FX2LAFW" = "xyes"; then | |
113 | AC_DEFINE(HAVE_LA_FX2LAFW, 1, [fx2lafw support]) | |
114 | fi | |
115 | ||
826938d8 UH |
116 | AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo], |
117 | [enable demo driver support [default=yes]]), | |
118 | [LA_DEMO="$enableval"], | |
119 | [LA_DEMO=yes]) | |
120 | AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes) | |
121 | if test "x$LA_DEMO" = "xyes"; then | |
122 | AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support]) | |
123 | fi | |
124 | ||
125 | # Disabled by default, unfinished. | |
126 | AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19], | |
127 | [enable Link Instruments MSO-19 support [default=no]]), | |
128 | [LA_LINK_MSO19="$enableval"], | |
129 | [LA_LINK_MSO19=no]) | |
130 | AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes) | |
131 | if test "x$LA_LINK_MSO19" = "xyes"; then | |
132 | AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support]) | |
133 | fi | |
134 | ||
135 | AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols], | |
136 | [enable OpenBench Logic Sniffer (OLS) support [default=yes]]), | |
137 | [LA_OLS="$enableval"], | |
138 | [LA_OLS=yes]) | |
139 | AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes) | |
140 | if test "x$LA_OLS" = "xyes"; then | |
141 | AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support]) | |
142 | fi | |
143 | ||
144 | AC_ARG_ENABLE(saleae-logic, AC_HELP_STRING([--enable-saleae-logic], | |
145 | [enable Saleae Logic support [default=yes]]), | |
146 | [LA_SALEAE_LOGIC="$enableval"], | |
d56ee265 | 147 | [LA_SALEAE_LOGIC=no]) |
826938d8 UH |
148 | AM_CONDITIONAL(LA_SALEAE_LOGIC, test x$LA_SALEAE_LOGIC = xyes) |
149 | if test "x$LA_SALEAE_LOGIC" = "xyes"; then | |
150 | AC_DEFINE(HAVE_LA_SALEAE_LOGIC, 1, [Saleae Logic support]) | |
151 | fi | |
152 | ||
153 | AC_ARG_ENABLE(zeroplus-logic-cube, | |
154 | AC_HELP_STRING([--enable-zeroplus-logic-cube], | |
155 | [enable Zeroplus Logic Cube support [default=yes]]), | |
156 | [LA_ZEROPLUS_LOGIC_CUBE="$enableval"], | |
157 | [LA_ZEROPLUS_LOGIC_CUBE=yes]) | |
158 | AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes) | |
159 | if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then | |
160 | AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [Zeroplus Logic Cube support]) | |
161 | fi | |
162 | ||
163 | # Checks for libraries. | |
164 | ||
165 | # This variable collects the pkg-config names of all detected libs. | |
166 | # It is then used to construct the "Requires.private:" field in the | |
167 | # libsigrok.pc file. | |
6dddd902 | 168 | SR_PKGLIBS="" |
826938d8 UH |
169 | |
170 | # libglib-2.0 is always needed. | |
171 | # Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement). | |
172 | AM_PATH_GLIB_2_0([2.22.0], | |
173 | [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"]) | |
174 | ||
175 | # libgthread-2.0 is always needed (e.g. for the demo hardware driver). | |
176 | PKG_CHECK_MODULES([gthread], [gthread-2.0 >= 2.22.0], | |
177 | [CFLAGS="$CFLAGS $gthread_CFLAGS"; LIBS="$LIBS $gthread_LIBS"; | |
6dddd902 | 178 | SR_PKGLIBS="$SR_PKGLIBS gthread-2.0"]) |
826938d8 UH |
179 | |
180 | # libusb is only needed for some hardware drivers. | |
181 | if test "x$LA_SALEAE_LOGIC" != xno \ | |
182 | -o "x$LA_ASIX_SIGMA" != xno \ | |
183 | -o "x$LA_CHRONOVU_LA8" != xno \ | |
f302a082 JH |
184 | -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno \ |
185 | -o "x$LA_FX2LAFW" != xno; then | |
826938d8 UH |
186 | case "$build" in |
187 | *freebsd*) | |
188 | # FreeBSD comes with an "integrated" libusb-1.0-style USB API. | |
189 | AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1], | |
190 | [Specifies whether we have a libusb.h header.]) | |
191 | ;; | |
192 | *) | |
193 | PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.5], | |
194 | [CFLAGS="$CFLAGS $libusb_CFLAGS"; | |
195 | LIBS="$LIBS $libusb_LIBS"; | |
6dddd902 | 196 | SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"]) |
826938d8 UH |
197 | AC_CHECK_LIB(usb-1.0, libusb_init) |
198 | ;; | |
199 | esac | |
200 | fi | |
201 | ||
202 | # libzip is always needed. | |
203 | PKG_CHECK_MODULES([libzip], [libzip >= 0.8], | |
204 | [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS"; | |
6dddd902 | 205 | SR_PKGLIBS="$SR_PKGLIBS libzip"]) |
826938d8 UH |
206 | |
207 | # zlib is only needed for some hardware drivers. | |
208 | if test "x$LA_ASIX_SIGMA" != xno; then | |
44b6aafd UH |
209 | case "$build" in |
210 | *freebsd*) | |
211 | # FreeBSD has zlib, but no pkg-config file for it. | |
6dddd902 | 212 | # Check manually, and do NOT add it to SR_PKGLIBS. |
44b6aafd UH |
213 | AC_CHECK_LIB(z, uncompress) |
214 | ;; | |
215 | *) | |
216 | PKG_CHECK_MODULES([zlib], [zlib >= 1.2.3.1], | |
217 | [CFLAGS="$CFLAGS $zlib_CFLAGS"; LIBS="$LIBS $zlib_LIBS"; | |
6dddd902 | 218 | SR_PKGLIBS="$SR_PKGLIBS zlib"]) |
44b6aafd UH |
219 | ;; |
220 | esac | |
826938d8 UH |
221 | fi |
222 | ||
223 | # libftdi is only needed for some hardware drivers. | |
224 | if test "x$LA_ASIX_SIGMA" != xno \ | |
225 | -o "x$LA_CHRONOVU_LA8" != xno; then | |
226 | PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16], | |
227 | [CFLAGS="$CFLAGS $libftdi_CFLAGS"; | |
228 | LIBS="$LIBS $libftdi_LIBS"; | |
6dddd902 | 229 | SR_PKGLIBS="$SR_PKGLIBS libftdi"]) |
826938d8 UH |
230 | fi |
231 | ||
232 | # libudev is only needed for some hardware drivers. | |
233 | if test "x$LA_LINK_MSO19" != xno; then | |
234 | PKG_CHECK_MODULES([libudev], [libudev >= 151], | |
235 | [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS"; | |
6dddd902 | 236 | SR_PKGLIBS="$SR_PKGLIBS libudev"]) |
826938d8 UH |
237 | fi |
238 | ||
239 | # ALSA is only needed for some hardware drivers. | |
240 | if test "x$LA_ALSA" != xno; then | |
241 | PKG_CHECK_MODULES([alsa], [alsa >= 1.0], | |
242 | [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS"; | |
6dddd902 | 243 | SR_PKGLIBS="$SR_PKGLIBS alsa"]) |
826938d8 UH |
244 | fi |
245 | ||
6dddd902 | 246 | AC_SUBST(SR_PKGLIBS) |
826938d8 UH |
247 | |
248 | # Checks for header files. | |
249 | # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h. | |
250 | AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h]) | |
251 | ||
252 | # Checks for typedefs, structures, and compiler characteristics. | |
253 | AC_C_INLINE | |
254 | AC_TYPE_INT8_T | |
255 | AC_TYPE_INT16_T | |
256 | AC_TYPE_INT32_T | |
257 | AC_TYPE_INT64_T | |
258 | AC_TYPE_UINT8_T | |
259 | AC_TYPE_UINT16_T | |
260 | AC_TYPE_UINT32_T | |
261 | AC_TYPE_UINT64_T | |
262 | AC_TYPE_SIZE_T | |
263 | ||
264 | # Checks for library functions. | |
265 | AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull]) | |
266 | ||
8e190238 | 267 | AC_SUBST(FIRMWARE_DIR, "$datadir/libsigrok/firmware") |
826938d8 UH |
268 | AC_SUBST(MAKEFLAGS, '--no-print-directory') |
269 | AC_SUBST(AM_LIBTOOLFLAGS, '--silent') | |
270 | ||
6dddd902 UH |
271 | SR_PACKAGE_VERSION_MAJOR=sr_package_version_major |
272 | SR_PACKAGE_VERSION_MINOR=sr_package_version_minor | |
273 | SR_PACKAGE_VERSION_MICRO=sr_package_version_micro | |
274 | SR_PACKAGE_VERSION=sr_package_version | |
3af71f0d | 275 | |
6dddd902 UH |
276 | AC_SUBST(SR_PACKAGE_VERSION_MAJOR) |
277 | AC_SUBST(SR_PACKAGE_VERSION_MINOR) | |
278 | AC_SUBST(SR_PACKAGE_VERSION_MICRO) | |
279 | AC_SUBST(SR_PACKAGE_VERSION) | |
3af71f0d | 280 | |
826938d8 | 281 | AC_CONFIG_FILES([Makefile |
4937b235 | 282 | sigrok.h |
db8ae7b9 UH |
283 | firmware/Makefile |
284 | hardware/Makefile | |
285 | hardware/alsa/Makefile | |
286 | hardware/asix-sigma/Makefile | |
287 | hardware/chronovu-la8/Makefile | |
288 | hardware/common/Makefile | |
289 | hardware/demo/Makefile | |
f302a082 | 290 | hardware/fx2lafw/Makefile |
db8ae7b9 UH |
291 | hardware/link-mso19/Makefile |
292 | hardware/openbench-logic-sniffer/Makefile | |
293 | hardware/saleae-logic/Makefile | |
294 | hardware/zeroplus-logic-cube/Makefile | |
295 | input/Makefile | |
296 | output/Makefile | |
297 | output/text/Makefile | |
298 | libsigrok.pc | |
826938d8 | 299 | contrib/Makefile |
826938d8 UH |
300 | ]) |
301 | ||
302 | AC_OUTPUT | |
303 | ||
304 | echo | |
45aed072 | 305 | echo "libsigrok configuration summary:" |
826938d8 | 306 | echo |
6dddd902 UH |
307 | echo " - Package version (major.minor.micro): $SR_PACKAGE_VERSION" |
308 | echo " - Library version (current:revision:age): $SR_LIB_VERSION" | |
45aed072 UH |
309 | echo " - Prefix: $prefix" |
310 | echo | |
311 | echo "Detected libraries:" | |
312 | echo | |
313 | ||
314 | # Note: This only works for libs with pkg-config integration. | |
315 | for lib in "glib-2.0" "gthread-2.0" "libusb-1.0" "libzip" "zlib" "libftdi" "libudev" "alsa"; do | |
316 | if `$PKG_CONFIG --exists $lib`; then | |
317 | ver=`$PKG_CONFIG --modversion $lib` | |
318 | answer="yes ($ver)" | |
319 | else | |
320 | answer="no" | |
321 | fi | |
322 | echo " - $lib: $answer" | |
323 | done | |
324 | ||
325 | echo | |
326 | echo "Enabled hardware drivers:" | |
327 | echo | |
328 | echo " - ASIX SIGMA...................... $LA_ASIX_SIGMA" | |
329 | echo " - ChronoVu LA8.................... $LA_CHRONOVU_LA8" | |
330 | echo " - Demo driver..................... $LA_DEMO" | |
b5750520 | 331 | echo " - fx2lafw (for FX2 LAs)........... $LA_FX2LAFW" |
45aed072 UH |
332 | echo " - Link MSO-19..................... $LA_LINK_MSO19" |
333 | echo " - Openbench Logic Sniffer......... $LA_OLS" | |
334 | echo " - Saleae Logic.................... $LA_SALEAE_LOGIC" | |
335 | echo " - Zeroplus Logic Cube............. $LA_ZEROPLUS_LOGIC_CUBE" | |
826938d8 UH |
336 | echo |
337 |