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