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