blob: 88149d8b53cac191a584f66e8c1916d2e63fe983 [file] [log] [blame]
Uwe Hermann826938d2011-12-30 10:42:39 +01001##
2## This file is part of the sigrok project.
3##
Bert Vermeulenc73d2ea2012-02-13 14:31:51 +01004## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
Uwe Hermann826938d2011-12-30 10:42:39 +01005##
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
Uwe Hermannef7228b2012-01-28 21:26:56 +010020# We require at least autoconf 2.63 (AC_INIT format changed there).
21AC_PREREQ([2.63])
Uwe Hermann826938d2011-12-30 10:42:39 +010022
Uwe Hermann3af71f02012-01-04 00:05:43 +010023# libsigrok package version number (NOT the same as shared lib version!).
Uwe Hermann6dddd902012-03-31 11:28:24 +020024m4_define([sr_package_version_major], [0])
25m4_define([sr_package_version_minor], [1])
26m4_define([sr_package_version_micro], [0])
27m4_define([sr_package_version], [sr_package_version_major.sr_package_version_minor.sr_package_version_micro])
Uwe Hermann826938d2011-12-30 10:42:39 +010028
Uwe Hermann6dddd902012-03-31 11:28:24 +020029AC_INIT([libsigrok], [sr_package_version], [sigrok-devel@lists.sourceforge.net],
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +010030 [libsigrok], [http://www.sigrok.org])
Uwe Hermann826938d2011-12-30 10:42:39 +010031AC_CONFIG_HEADER([config.h])
Uwe Hermannd8521c92012-01-03 21:55:48 +010032AC_CONFIG_MACRO_DIR([autostuff])
33AC_CONFIG_AUX_DIR([autostuff])
Uwe Hermann826938d2011-12-30 10:42:39 +010034
Uwe Hermannef7228b2012-01-28 21:26:56 +010035# We require at least automake 1.11 (needed for 'silent rules').
36AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign std-options])
Uwe Hermann826938d2011-12-30 10:42:39 +010037m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
38
Uwe Hermann6dddd902012-03-31 11:28:24 +020039AH_TOP([#ifndef SR_CONFIG_H
40#define SR_CONFIG_H /* To stop multiple inclusions. */])
41AH_BOTTOM([#endif /* SR_CONFIG_H */])
Uwe Hermann826938d2011-12-30 10:42:39 +010042
Uwe Hermann1a081ca2012-02-01 23:40:35 +010043# 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.
45CFLAGS="-g -Wall -Wextra -fvisibility=hidden"
Uwe Hermann826938d2011-12-30 10:42:39 +010046
47# Checks for programs.
48AC_PROG_CXX
49AC_PROG_CC
50AC_PROG_CPP
51AC_PROG_INSTALL
52AC_PROG_LN_S
53
54# Initialize libtool.
55LT_INIT
56
57# Initialize pkg-config.
58# We require at least 0.22, as "Requires.private" behaviour changed there.
59PKG_PROG_PKG_CONFIG([0.22])
60
Uwe Hermann3af71f02012-01-04 00:05:43 +010061# Library version for libsigrok (NOT the same as the package version).
Uwe Hermann826938d2011-12-30 10:42:39 +010062# 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
Uwe Hermann6dddd902012-03-31 11:28:24 +020065SR_LIB_VERSION_CURRENT=0
66SR_LIB_VERSION_REVISION=0
67SR_LIB_VERSION_AGE=0
68SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE"
69SR_LIB_LDFLAGS="-version-info $SR_LIB_VERSION"
70AC_SUBST(SR_LIB_VERSION_CURRENT)
71AC_SUBST(SR_LIB_VERSION_REVISION)
72AC_SUBST(SR_LIB_VERSION_AGE)
73AC_SUBST(SR_LIB_VERSION)
74AC_SUBST(SR_LIB_LDFLAGS)
Uwe Hermann826938d2011-12-30 10:42:39 +010075
Uwe Hermann826938d2011-12-30 10:42:39 +010076# Logic analyzer hardware support '--enable' options.
77
78# Disabled by default, unfinished.
79AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa],
80 [enable ALSA driver support [default=no]]),
81 [LA_ALSA="$enableval"],
82 [LA_ALSA=no])
83AM_CONDITIONAL(LA_ALSA, test x$LA_ALSA = xyes)
84if test "x$LA_ALSA" = "xyes"; then
85 AC_DEFINE(HAVE_LA_ALSA, 1, [ALSA driver support])
86fi
87
88AC_ARG_ENABLE(asix-sigma, AC_HELP_STRING([--enable-asix-sigma],
Uwe Hermann6352d032012-05-02 19:02:03 +020089 [enable ASIX SIGMA/SIGMA2 support [default=yes]]),
Uwe Hermann826938d2011-12-30 10:42:39 +010090 [LA_ASIX_SIGMA="$enableval"],
91 [LA_ASIX_SIGMA=yes])
92AM_CONDITIONAL(LA_ASIX_SIGMA, test x$LA_ASIX_SIGMA = xyes)
93if test "x$LA_ASIX_SIGMA" = "xyes"; then
Uwe Hermann6352d032012-05-02 19:02:03 +020094 AC_DEFINE(HAVE_LA_ASIX_SIGMA, 1, [ASIX SIGMA/SIGMA2 support])
Uwe Hermann826938d2011-12-30 10:42:39 +010095fi
96
97AC_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])
101AM_CONDITIONAL(LA_CHRONOVU_LA8, test x$LA_CHRONOVU_LA8 = xyes)
102if test "x$LA_CHRONOVU_LA8" = "xyes"; then
103 AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
104fi
105
Uwe Hermann2e26e0a2012-03-31 11:57:46 +0200106# Disabled per default for now, will be enabled when it's tested some more.
Joel Holdsworthf302a082012-02-11 12:08:49 +0000107AC_ARG_ENABLE(fx2lafw, AC_HELP_STRING([--enable-fx2lafw],
Uwe Hermann2e26e0a2012-03-31 11:57:46 +0200108 [enable fx2lafw support (for FX2 LAs). [default=no]]),
Joel Holdsworthf302a082012-02-11 12:08:49 +0000109 [LA_FX2LAFW="$enableval"],
Joel Holdsworthd56ee262012-04-18 19:10:15 +0100110 [LA_FX2LAFW=yes])
Joel Holdsworthf302a082012-02-11 12:08:49 +0000111AM_CONDITIONAL(LA_FX2LAFW, test x$LA_FX2LAFW = xyes)
112if test "x$LA_FX2LAFW" = "xyes"; then
113 AC_DEFINE(HAVE_LA_FX2LAFW, 1, [fx2lafw support])
114fi
115
Uwe Hermann826938d2011-12-30 10:42:39 +0100116AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
117 [enable demo driver support [default=yes]]),
118 [LA_DEMO="$enableval"],
119 [LA_DEMO=yes])
120AM_CONDITIONAL(LA_DEMO, test x$LA_DEMO = xyes)
121if test "x$LA_DEMO" = "xyes"; then
122 AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support])
123fi
124
125# Disabled by default, unfinished.
126AC_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])
130AM_CONDITIONAL(LA_LINK_MSO19, test x$LA_LINK_MSO19 = xyes)
131if test "x$LA_LINK_MSO19" = "xyes"; then
132 AC_DEFINE(HAVE_LA_LINK_MSO19, 1, [Link Instruments MSO-19 support])
133fi
134
135AC_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])
139AM_CONDITIONAL(LA_OLS, test x$LA_OLS = xyes)
140if test "x$LA_OLS" = "xyes"; then
141 AC_DEFINE(HAVE_LA_OLS, 1, [OpenBench Logic Sniffer (OLS) support])
142fi
143
Uwe Hermann826938d2011-12-30 10:42:39 +0100144AC_ARG_ENABLE(zeroplus-logic-cube,
145 AC_HELP_STRING([--enable-zeroplus-logic-cube],
146 [enable Zeroplus Logic Cube support [default=yes]]),
147 [LA_ZEROPLUS_LOGIC_CUBE="$enableval"],
148 [LA_ZEROPLUS_LOGIC_CUBE=yes])
149AM_CONDITIONAL(LA_ZEROPLUS_LOGIC_CUBE, test x$LA_ZEROPLUS_LOGIC_CUBE = xyes)
150if test "x$LA_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
151 AC_DEFINE(HAVE_LA_ZEROPLUS_LOGIC_CUBE, 1, [Zeroplus Logic Cube support])
152fi
153
154# Checks for libraries.
155
156# This variable collects the pkg-config names of all detected libs.
157# It is then used to construct the "Requires.private:" field in the
158# libsigrok.pc file.
Uwe Hermann6dddd902012-03-31 11:28:24 +0200159SR_PKGLIBS=""
Uwe Hermann826938d2011-12-30 10:42:39 +0100160
161# libglib-2.0 is always needed.
162# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
163AM_PATH_GLIB_2_0([2.22.0],
164 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
165
166# libgthread-2.0 is always needed (e.g. for the demo hardware driver).
167PKG_CHECK_MODULES([gthread], [gthread-2.0 >= 2.22.0],
168 [CFLAGS="$CFLAGS $gthread_CFLAGS"; LIBS="$LIBS $gthread_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200169 SR_PKGLIBS="$SR_PKGLIBS gthread-2.0"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100170
171# libusb is only needed for some hardware drivers.
Joel Holdsworth824b1a82012-04-18 19:17:25 +0100172if test "x$LA_ASIX_SIGMA" != xno \
Uwe Hermann826938d2011-12-30 10:42:39 +0100173 -o "x$LA_CHRONOVU_LA8" != xno \
Joel Holdsworthf302a082012-02-11 12:08:49 +0000174 -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno \
175 -o "x$LA_FX2LAFW" != xno; then
Uwe Hermann826938d2011-12-30 10:42:39 +0100176 case "$build" in
177 *freebsd*)
178 # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
179 AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
180 [Specifies whether we have a libusb.h header.])
181 ;;
182 *)
183 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.5],
184 [CFLAGS="$CFLAGS $libusb_CFLAGS";
185 LIBS="$LIBS $libusb_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200186 SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100187 AC_CHECK_LIB(usb-1.0, libusb_init)
188 ;;
189 esac
190fi
191
192# libzip is always needed.
193PKG_CHECK_MODULES([libzip], [libzip >= 0.8],
194 [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200195 SR_PKGLIBS="$SR_PKGLIBS libzip"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100196
Uwe Hermann826938d2011-12-30 10:42:39 +0100197# libftdi is only needed for some hardware drivers.
198if test "x$LA_ASIX_SIGMA" != xno \
199 -o "x$LA_CHRONOVU_LA8" != xno; then
200 PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
201 [CFLAGS="$CFLAGS $libftdi_CFLAGS";
202 LIBS="$LIBS $libftdi_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200203 SR_PKGLIBS="$SR_PKGLIBS libftdi"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100204fi
205
206# libudev is only needed for some hardware drivers.
207if test "x$LA_LINK_MSO19" != xno; then
208 PKG_CHECK_MODULES([libudev], [libudev >= 151],
209 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200210 SR_PKGLIBS="$SR_PKGLIBS libudev"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100211fi
212
213# ALSA is only needed for some hardware drivers.
214if test "x$LA_ALSA" != xno; then
215 PKG_CHECK_MODULES([alsa], [alsa >= 1.0],
216 [CFLAGS="$CFLAGS $alsa_CFLAGS"; LIBS="$LIBS $alsa_LIBS";
Uwe Hermann6dddd902012-03-31 11:28:24 +0200217 SR_PKGLIBS="$SR_PKGLIBS alsa"])
Uwe Hermann826938d2011-12-30 10:42:39 +0100218fi
219
Uwe Hermann6dddd902012-03-31 11:28:24 +0200220AC_SUBST(SR_PKGLIBS)
Uwe Hermann826938d2011-12-30 10:42:39 +0100221
222# Checks for header files.
223# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
224AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
225
226# Checks for typedefs, structures, and compiler characteristics.
227AC_C_INLINE
228AC_TYPE_INT8_T
229AC_TYPE_INT16_T
230AC_TYPE_INT32_T
231AC_TYPE_INT64_T
232AC_TYPE_UINT8_T
233AC_TYPE_UINT16_T
234AC_TYPE_UINT32_T
235AC_TYPE_UINT64_T
236AC_TYPE_SIZE_T
237
238# Checks for library functions.
239AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull])
240
Uwe Hermann8e190232012-01-03 20:06:36 +0100241AC_SUBST(FIRMWARE_DIR, "$datadir/libsigrok/firmware")
Uwe Hermann826938d2011-12-30 10:42:39 +0100242AC_SUBST(MAKEFLAGS, '--no-print-directory')
243AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
244
Uwe Hermann6dddd902012-03-31 11:28:24 +0200245SR_PACKAGE_VERSION_MAJOR=sr_package_version_major
246SR_PACKAGE_VERSION_MINOR=sr_package_version_minor
247SR_PACKAGE_VERSION_MICRO=sr_package_version_micro
248SR_PACKAGE_VERSION=sr_package_version
Uwe Hermann826938d2011-12-30 10:42:39 +0100249
Uwe Hermann6dddd902012-03-31 11:28:24 +0200250AC_SUBST(SR_PACKAGE_VERSION_MAJOR)
251AC_SUBST(SR_PACKAGE_VERSION_MINOR)
252AC_SUBST(SR_PACKAGE_VERSION_MICRO)
253AC_SUBST(SR_PACKAGE_VERSION)
Uwe Hermann826938d2011-12-30 10:42:39 +0100254
Uwe Hermann826938d2011-12-30 10:42:39 +0100255AC_CONFIG_FILES([Makefile
Uwe Hermann4937b232012-03-24 10:03:36 +0100256 sigrok.h
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100257 firmware/Makefile
258 hardware/Makefile
259 hardware/alsa/Makefile
260 hardware/asix-sigma/Makefile
261 hardware/chronovu-la8/Makefile
262 hardware/common/Makefile
263 hardware/demo/Makefile
Joel Holdsworthf302a082012-02-11 12:08:49 +0000264 hardware/fx2lafw/Makefile
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100265 hardware/link-mso19/Makefile
266 hardware/openbench-logic-sniffer/Makefile
Uwe Hermanndb8ae7b2011-12-30 10:50:00 +0100267 hardware/zeroplus-logic-cube/Makefile
268 input/Makefile
269 output/Makefile
270 output/text/Makefile
271 libsigrok.pc
Uwe Hermann826938d2011-12-30 10:42:39 +0100272 contrib/Makefile
Uwe Hermann826938d2011-12-30 10:42:39 +0100273 ])
274
275AC_OUTPUT
276
277echo
Uwe Hermann45aed072012-01-04 00:49:21 +0100278echo "libsigrok configuration summary:"
Uwe Hermann826938d2011-12-30 10:42:39 +0100279echo
Uwe Hermann6dddd902012-03-31 11:28:24 +0200280echo " - Package version (major.minor.micro): $SR_PACKAGE_VERSION"
281echo " - Library version (current:revision:age): $SR_LIB_VERSION"
Uwe Hermann45aed072012-01-04 00:49:21 +0100282echo " - Prefix: $prefix"
283echo
284echo "Detected libraries:"
285echo
286
287# Note: This only works for libs with pkg-config integration.
HÃ¥vard Espelande210c6c2012-04-22 14:31:40 +0200288for lib in "glib-2.0" "gthread-2.0" "libusb-1.0" "libzip" "libftdi" "libudev" "alsa"; do
Uwe Hermann45aed072012-01-04 00:49:21 +0100289 if `$PKG_CONFIG --exists $lib`; then
290 ver=`$PKG_CONFIG --modversion $lib`
291 answer="yes ($ver)"
292 else
293 answer="no"
294 fi
295 echo " - $lib: $answer"
296done
297
298echo
299echo "Enabled hardware drivers:"
300echo
Uwe Hermann6352d032012-05-02 19:02:03 +0200301echo " - ASIX SIGMA/SIGMA2............... $LA_ASIX_SIGMA"
Uwe Hermann45aed072012-01-04 00:49:21 +0100302echo " - ChronoVu LA8.................... $LA_CHRONOVU_LA8"
303echo " - Demo driver..................... $LA_DEMO"
Uwe Hermannb5750522012-03-21 19:45:46 +0100304echo " - fx2lafw (for FX2 LAs)........... $LA_FX2LAFW"
Uwe Hermann45aed072012-01-04 00:49:21 +0100305echo " - Link MSO-19..................... $LA_LINK_MSO19"
306echo " - Openbench Logic Sniffer......... $LA_OLS"
Uwe Hermann45aed072012-01-04 00:49:21 +0100307echo " - Zeroplus Logic Cube............. $LA_ZEROPLUS_LOGIC_CUBE"
Uwe Hermann826938d2011-12-30 10:42:39 +0100308echo
309