]> sigrok.org Git - libsigrok.git/blob - configure.ac
agilent-dmm: don't log anything if no conn params given
[libsigrok.git] / configure.ac
1 ##
2 ## This file is part of the sigrok project.
3 ##
4 ## Copyright (C) 2010-2012 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 # We require at least autoconf 2.63 (AC_INIT format changed there).
21 AC_PREREQ([2.63])
22
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], [2])
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])
28
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])
34
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])
39
40 AH_TOP([#ifndef SR_CONFIG_H
41 #define SR_CONFIG_H    /* To stop multiple inclusions. */])
42 AH_BOTTOM([#endif /* SR_CONFIG_H */])
43
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"
47
48 # Checks for programs.
49 AC_PROG_CXX
50 AC_PROG_CC
51 AC_PROG_CPP
52 AC_PROG_INSTALL
53 AC_PROG_LN_S
54
55 # Initialize libtool.
56 LT_INIT
57
58 # Initialize pkg-config.
59 # We require at least 0.22, as "Requires.private" behaviour changed there.
60 PKG_PROG_PKG_CONFIG([0.22])
61
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=1
67 SR_LIB_VERSION_REVISION=0
68 SR_LIB_VERSION_AGE=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)
76
77 # Hardware support '--enable' options.
78
79 AC_ARG_ENABLE(agilent-dmm, AC_HELP_STRING([--enable-agilent-dmm],
80               [enable Agilent DMM driver support [default=yes]]),
81               [HW_AGILENT_DMM="$enableval"],
82               [HW_AGILENT_DMM=yes])
83 AM_CONDITIONAL(HW_AGILENT_DMM, test x$HW_AGILENT_DMM = xyes)
84 if test "x$HW_AGILENT_DMM" = "xyes"; then
85         AC_DEFINE(HAVE_HW_AGILENT_DMM, 1, [Agilent DMM driver support])
86 fi
87
88 # Disabled by default, unfinished.
89 AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
90               [enable ALSA driver support [default=no]]),
91               [LA_ALSA="$enableval"],
92               [LA_ALSA=no])
93 AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes)
94 if test "x$LA_ALSA" = "xyes"; then
95         AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support])
96 fi
97
98 AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
99               [enable ASIX SIGMA/SIGMA2 support [default=yes]]),
100               [LA_ASIX_SIGMA="$enableval"],
101               [LA_ASIX_SIGMA=yes])
102 AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
103 if test "x$LA_ASIX_SIGMA" = "xyes"; then
104         AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX SIGMA/SIGMA2 support])
105 fi
106
107 AC_ARG_ENABLE(chronovu-la8, AC_HELP_STRING([--enable-chronovu-la8],
108               [enable ChronoVu LA8 support [default=yes]]),
109               [LA_CHRONOVU_LA8="$enableval"],
110               [LA_CHRONOVU_LA8=yes])
111 AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
112 if test "x$LA_CHRONOVU_LA8" = "xyes"; then
113         AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
114 fi
115
116 AC_ARG_ENABLE(fx2lafw, AC_HELP_STRING([--enable-fx2lafw],
117               [enable fx2lafw support (for FX2 LAs). [default=yes]]),
118               [LA_FX2LAFW="$enableval"],
119               [LA_FX2LAFW=yes])
120 AM_CONDITIONAL(LA_FX2LAFW, test x$LA_FX2LAFW = xyes)
121 if test "x$LA_FX2LAFW" = "xyes"; then
122         AC_DEFINE(HAVE_LA_FX2LAFW, 1, [fx2lafw support])
123 fi
124
125 AC_ARG_ENABLE(genericdmm, AC_HELP_STRING([--enable-genericdmm],
126               [enable genericdmm support (for most DMMs). [default=yes]]),
127               [HW_GENERICDMM="$enableval"],
128               [HW_GENERICDMM=yes])
129 AM_CONDITIONAL(HW_GENERICDMM, test x$HW_GENERICDMM = xyes)
130 if test "x$HW_GENERICDMM" = "xyes"; then
131         AC_DEFINE(HAVE_HW_GENERICDMM, 1, [Generic DMM support])
132 fi
133
134 AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
135               [enable demo driver support [default=yes]]),
136               [LA_DEMO="$enableval"],
137               [LA_DEMO=yes])
138 AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
139 if test "x$LA_DEMO" = "xyes"; then
140         AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
141 fi
142
143 # Disabled by default, unfinished.
144 AC_ARG_ENABLE(link-mso19, AC_HELP_STRING([--enable-link-mso19],
145               [enable Link Instruments MSO-19 support [default=no]]),
146               [LA_LINK_MSO19="$enableval"],
147               [LA_LINK_MSO19=no])
148 AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
149 if test "x$LA_LINK_MSO19" = "xyes"; then
150         AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
151 fi
152
153 AC_ARG_ENABLE(ols, AC_HELP_STRING([--enable-ols],
154               [enable OpenBench Logic Sniffer (OLS) support [default=yes]]),
155               [LA_OLS="$enableval"],
156               [LA_OLS=yes])
157 AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
158 if test "x$LA_OLS" = "xyes"; then
159         AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
160 fi
161
162 AC_ARG_ENABLE(zeroplus-logic-cube,
163               AC_HELP_STRING([--enable-zeroplus-logic-cube],
164               [enable ZEROPLUS Logic Cube support [default=yes]]),
165               [LA_ZEROPLUS_LOGIC_CUBE="$enableval"],
166               [LA_ZEROPLUS_LOGIC_CUBE=yes])
167 AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes)
168 if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
169         AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [ZEROPLUS Logic Cube support])
170 fi
171
172 AC_ARG_ENABLE(hantek-dso,
173               AC_HELP_STRING([--enable-hantek-dso],
174               [enable Hantek DSO support [default=yes]]),
175               [HW_HANTEK_DSO="$enableval"],
176               [HW_HANTEK_DSO=yes])
177 AM_CONDITIONAL(HW_HANTEK_DSO, test x$HW_HANTEK_DSO = xyes)
178 if test "x$HW_HANTEK_DSO" = "xyes"; then
179         AC_DEFINE(HAVE_HW_HANTEK_DSO, 1, [Hantek DSO support])
180 fi
181
182 # Checks for libraries.
183
184 # This variable collects the pkg-config names of all detected libs.
185 # It is then used to construct the "Requires.private:" field in the
186 # libsigrok.pc file.
187 SR_PKGLIBS=""
188
189 # libglib-2.0 is always needed.
190 # Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
191 AM_PATH_GLIB_2_0([2.28.0],
192         [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
193
194 # libgthread-2.0 is always needed (e.g. for the demo hardware driver).
195 PKG_CHECK_MODULES([gthread], [gthread-2.0 >= 2.22.0],
196         [CFLAGS="$CFLAGS $gthread_CFLAGS"; LIBS="$LIBS $gthread_LIBS";
197         SR_PKGLIBS="$SR_PKGLIBS gthread-2.0"])
198
199 # libusb is only needed for some hardware drivers.
200 if test "x$LA_ASIX_SIGMA" != xno \
201    -o "x$LA_CHRONOVU_LA8" != xno \
202    -o "x$LA_FX2LAFW" != xno \
203    -o "x$HW_HANTEK_DSO" != xno \
204    -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno; then
205         case "$build" in
206         *freebsd*)
207                 # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
208                 AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
209                         [Specifies whether we have a libusb.h header.])
210                 ;;
211         *)
212                 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.5],
213                         [CFLAGS="$CFLAGS $libusb_CFLAGS";
214                         LIBS="$LIBS $libusb_LIBS";
215                         SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"])
216                 AC_CHECK_LIB(usb-1.0, libusb_init)
217                 ;;
218         esac
219 fi
220
221 # libzip is always needed.
222 PKG_CHECK_MODULES([libzip], [libzip >= 0.8],
223         [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
224         SR_PKGLIBS="$SR_PKGLIBS libzip"])
225
226 # libftdi is only needed for some hardware drivers.
227 if test "x$LA_ASIX_SIGMA" != xno \
228      -o "x$LA_CHRONOVU_LA8" != xno; then
229         PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
230                 [CFLAGS="$CFLAGS $libftdi_CFLAGS";
231                 LIBS="$LIBS $libftdi_LIBS";
232                 SR_PKGLIBS="$SR_PKGLIBS libftdi"])
233 fi
234
235 # libudev is only needed for some hardware drivers.
236 if test "x$LA_LINK_MSO19" != xno; then
237         PKG_CHECK_MODULES([libudev], [libudev >= 151],
238                 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
239                 SR_PKGLIBS="$SR_PKGLIBS libudev"])
240 fi
241
242 # ALSA is only needed for some hardware drivers.
243 if test "x$LA_ALSA" != xno; then
244         PKG_CHECK_MODULES([alsa], [alsa >= 1.0],
245                 [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS";
246                 SR_PKGLIBS="$SR_PKGLIBS alsa"])
247 fi
248
249 # EZUSB FX2 firmware helpers only needed for some hardware drivers
250 AM_CONDITIONAL(NEED_EZUSB, \
251         test "x$LA_FX2LAFW" != xno \
252         -o "x$HW_HANTEK_DSO" != xno \
253 )
254
255 # Serial port helpers only needed for some hardware drivers
256 AM_CONDITIONAL(NEED_SERIAL, \
257         test "x$LA_OLS" != xno \
258         -o "x$HW_AGILENT_DMM" != xno \
259         -o "x$HW_GENERICDMM" != xno \
260 )
261
262 AC_SUBST(SR_PKGLIBS)
263
264 # Checks for header files.
265 # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
266 AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
267
268 # Checks for typedefs, structures, and compiler characteristics.
269 AC_C_INLINE
270 AC_TYPE_INT8_T
271 AC_TYPE_INT16_T
272 AC_TYPE_INT32_T
273 AC_TYPE_INT64_T
274 AC_TYPE_UINT8_T
275 AC_TYPE_UINT16_T
276 AC_TYPE_UINT32_T
277 AC_TYPE_UINT64_T
278 AC_TYPE_SIZE_T
279
280 # Checks for library functions.
281 AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
282
283 AC_SUBST(FIRMWARE_DIR, "$datadir/sigrok-firmware")
284 AC_SUBST(MAKEFLAGS, '--no-print-directory')
285 AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
286
287 SR_PACKAGE_VERSION_MAJOR=sr_package_version_major
288 SR_PACKAGE_VERSION_MINOR=sr_package_version_minor
289 SR_PACKAGE_VERSION_MICRO=sr_package_version_micro
290 SR_PACKAGE_VERSION=sr_package_version
291
292 AC_SUBST(SR_PACKAGE_VERSION_MAJOR)
293 AC_SUBST(SR_PACKAGE_VERSION_MINOR)
294 AC_SUBST(SR_PACKAGE_VERSION_MICRO)
295 AC_SUBST(SR_PACKAGE_VERSION)
296
297 AC_CONFIG_FILES([Makefile
298                  version.h
299                  hardware/Makefile
300                  hardware/agilent-dmm/Makefile
301                  hardware/alsa/Makefile
302                  hardware/asix-sigma/Makefile
303                  hardware/chronovu-la8/Makefile
304                  hardware/common/Makefile
305                  hardware/demo/Makefile
306                  hardware/fx2lafw/Makefile
307                  hardware/genericdmm/Makefile
308                  hardware/link-mso19/Makefile
309                  hardware/openbench-logic-sniffer/Makefile
310                  hardware/zeroplus-logic-cube/Makefile
311                  hardware/hantek-dso/Makefile
312                  input/Makefile
313                  output/Makefile
314                  output/text/Makefile
315                  libsigrok.pc
316                  contrib/Makefile
317                 ])
318
319 AC_OUTPUT
320
321 echo
322 echo "libsigrok configuration summary:"
323 echo
324 echo "  - Package version (major.minor.micro):    $SR_PACKAGE_VERSION"
325 echo "  - Library version (current:revision:age): $SR_LIB_VERSION"
326 echo "  - Prefix: $prefix"
327 echo
328 echo "Detected libraries:"
329 echo
330
331 # Note: This only works for libs with pkg-config integration.
332 for lib in "glib-2.0" "gthread-2.0" "libusb-1.0" "libzip" "libftdi" "libudev" "alsa"; do
333         if `$PKG_CONFIG --exists $lib`; then
334                 ver=`$PKG_CONFIG --modversion $lib`
335                 answer="yes ($ver)"
336         else
337                 answer="no"
338         fi
339         echo "  - $lib: $answer"
340 done
341
342 echo
343 echo "Enabled hardware drivers:"
344 echo
345 echo "  - Agilent DMM..................... $HW_AGILENT_DMM"
346 echo "  - ASIX SIGMA/SIGMA2............... $LA_ASIX_SIGMA"
347 echo "  - ChronoVu LA8.................... $LA_CHRONOVU_LA8"
348 echo "  - Demo driver..................... $LA_DEMO"
349 echo "  - fx2lafw (for FX2 LAs)........... $LA_FX2LAFW"
350 echo "  - Generic DMM..................... $HW_GENERICDMM"
351 echo "  - Link MSO-19..................... $LA_LINK_MSO19"
352 echo "  - Openbench Logic Sniffer......... $LA_OLS"
353 echo "  - ZEROPLUS Logic Cube............. $LA_ZEROPLUS_LOGIC_CUBE"
354 echo "  - Hantek DSO...................... $HW_HANTEK_DSO"
355 echo
356