]>
Commit | Line | Data |
---|---|---|
826938d8 | 1 | ## |
50985c20 | 2 | ## This file is part of the libsigrok project. |
826938d8 | 3 | ## |
c73d2ea4 | 4 | ## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com> |
d375b3c3 | 5 | ## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com> |
826938d8 UH |
6 | ## |
7 | ## This program is free software: you can redistribute it and/or modify | |
8 | ## it under the terms of the GNU General Public License as published by | |
9 | ## the Free Software Foundation, either version 3 of the License, or | |
10 | ## (at your option) any later version. | |
11 | ## | |
12 | ## This program is distributed in the hope that it will be useful, | |
13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ## GNU General Public License for more details. | |
16 | ## | |
17 | ## You should have received a copy of the GNU General Public License | |
18 | ## along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | ## | |
20 | ||
ef7228ba UH |
21 | # We require at least autoconf 2.63 (AC_INIT format changed there). |
22 | AC_PREREQ([2.63]) | |
826938d8 | 23 | |
3af71f0d | 24 | # libsigrok package version number (NOT the same as shared lib version!). |
6dddd902 | 25 | m4_define([sr_package_version_major], [0]) |
e6b8f35f | 26 | m4_define([sr_package_version_minor], [4]) |
4133caab | 27 | m4_define([sr_package_version_micro], [0]) |
826938d8 | 28 | |
7f289d14 DE |
29 | AC_INIT([libsigrok], [sr_package_version_major.sr_package_version_minor.sr_package_version_micro], |
30 | [sigrok-devel@lists.sourceforge.net], | |
db8ae7b9 | 31 | [libsigrok], [http://www.sigrok.org]) |
b2478a23 | 32 | AC_CONFIG_HEADERS([config.h include/libsigrok/version.h]) |
d8521c93 UH |
33 | AC_CONFIG_MACRO_DIR([autostuff]) |
34 | AC_CONFIG_AUX_DIR([autostuff]) | |
826938d8 | 35 | |
ef7228ba | 36 | # We require at least automake 1.11 (needed for 'silent rules'). |
9ac018d0 | 37 | AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define nostdinc subdir-objects check-news color-tests]) |
826938d8 | 38 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
432e5e95 | 39 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
826938d8 | 40 | |
6dddd902 UH |
41 | AH_TOP([#ifndef SR_CONFIG_H |
42 | #define SR_CONFIG_H /* To stop multiple inclusions. */]) | |
43 | AH_BOTTOM([#endif /* SR_CONFIG_H */]) | |
826938d8 | 44 | |
1a081ca6 UH |
45 | # Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden |
46 | # and enforce use of SR_API to explicitly mark all public API functions. | |
4f10853e | 47 | COMMON_FLAGS="$CFLAGS -Wall -Wextra -fvisibility=hidden" |
e35e1e7b | 48 | CFLAGS="$COMMON_FLAGS -std=c11 -D_POSIX_C_SOURCE=200112L -Wmissing-prototypes" |
c23c8659 | 49 | CXXFLAGS="-std=c++11 $COMMON_FLAGS" |
826938d8 UH |
50 | |
51 | # Checks for programs. | |
826938d8 UH |
52 | AC_PROG_CC |
53 | AC_PROG_CPP | |
c23c8659 | 54 | AC_PROG_CXX |
826938d8 UH |
55 | AC_PROG_INSTALL |
56 | AC_PROG_LN_S | |
57 | ||
bb203cde UH |
58 | # Required for per-target flags or subdir-objects with C sources. |
59 | AM_PROG_CC_C_O | |
60 | ||
826938d8 UH |
61 | # Initialize libtool. |
62 | LT_INIT | |
63 | ||
64 | # Initialize pkg-config. | |
65 | # We require at least 0.22, as "Requires.private" behaviour changed there. | |
66 | PKG_PROG_PKG_CONFIG([0.22]) | |
67 | ||
7f289d14 DE |
68 | CONFIG_STATUS_DEPENDENCIES= |
69 | SR_PACKAGE_VERSION="AC_PACKAGE_VERSION" | |
70 | ||
71 | # Check if we can get revision information from git. | |
72 | sr_head=`git -C "$srcdir" rev-parse --verify --short HEAD 2>&AS_MESSAGE_LOG_FD` | |
73 | ||
74 | AS_IF([test "$?" -eq 0 && test -n "$sr_head"], [ | |
75 | CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/.git/HEAD' | |
76 | sr_head_name=`git -C "$srcdir" rev-parse --symbolic-full-name HEAD 2>&AS_MESSAGE_LOG_FD` | |
77 | AS_IF([test "$?" -eq 0 && test -f "$srcdir/.git/$sr_head_name"], | |
78 | [CONFIG_STATUS_DEPENDENCIES="$CONFIG_STATUS_DEPENDENCIES \$(top_srcdir)/.git/$sr_head_name"]) | |
79 | ||
80 | # Append the revision hash unless we are exactly on a tagged release. | |
81 | git -C "$srcdir" describe --match 'AC_PACKAGE_NAME-AC_PACKAGE_VERSION' \ | |
82 | --exact-match >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD \ | |
83 | || SR_PACKAGE_VERSION="$SR_PACKAGE_VERSION-git-$sr_head" | |
84 | ]) | |
85 | AC_SUBST([CONFIG_STATUS_DEPENDENCIES]) | |
86 | AC_SUBST([SR_PACKAGE_VERSION]) | |
b2478a23 DE |
87 | |
88 | AC_DEFINE([SR_PACKAGE_VERSION_MAJOR], [sr_package_version_major], [.]) | |
89 | AC_DEFINE([SR_PACKAGE_VERSION_MINOR], [sr_package_version_minor], [.]) | |
90 | AC_DEFINE([SR_PACKAGE_VERSION_MICRO], [sr_package_version_micro], [.]) | |
91 | AC_DEFINE_UNQUOTED([SR_PACKAGE_VERSION_STRING], ["$SR_PACKAGE_VERSION"], [.]) | |
92 | ||
3af71f0d | 93 | # Library version for libsigrok (NOT the same as the package version). |
826938d8 UH |
94 | # Carefully read the libtool docs before updating these numbers! |
95 | # The algorithm for determining which number to change (and how) is nontrivial! | |
96 | # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info | |
85ca913c UH |
97 | SR_LIB_VERSION_CURRENT=2 |
98 | SR_LIB_VERSION_REVISION=0 | |
6dddd902 | 99 | SR_LIB_VERSION_AGE=0 |
b2478a23 DE |
100 | |
101 | AC_SUBST([SR_LIB_VERSION], ["$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE"]) | |
102 | AC_SUBST([SR_LIB_LDFLAGS], ["-version-info $SR_LIB_VERSION"]) | |
103 | ||
104 | AC_DEFINE_UNQUOTED([SR_LIB_VERSION_CURRENT], [$SR_LIB_VERSION_CURRENT], [.]) | |
105 | AC_DEFINE_UNQUOTED([SR_LIB_VERSION_REVISION], [$SR_LIB_VERSION_REVISION], [.]) | |
106 | AC_DEFINE_UNQUOTED([SR_LIB_VERSION_AGE], [$SR_LIB_VERSION_AGE], [.]) | |
107 | AC_DEFINE_UNQUOTED([SR_LIB_VERSION_STRING], ["$SR_LIB_VERSION"], [.]) | |
826938d8 | 108 | |
c5f179a9 DE |
109 | AC_ARG_ENABLE([all-drivers], |
110 | [AS_HELP_STRING([--enable-all-drivers], | |
111 | [enable all drivers by default [[default=yes]]])], | |
dbf2482e BV |
112 | [HW_ENABLED_DEFAULT="$enableval"], |
113 | [HW_ENABLED_DEFAULT="yes"]) | |
114 | ||
c5f179a9 DE |
115 | ## _SR_DRIVER(Device name, driver-name, enable, var-name) |
116 | m4_define([_SR_DRIVER], [ | |
117 | AC_ARG_ENABLE([$4], | |
118 | [AS_HELP_STRING([--enable-$2], [enable $1 support])], | |
119 | [$4=$enableval], [$4=$3]) | |
120 | m4_append([SR_DRIVER_SUMMARY], | |
121 | [ - m4_translit(m4_format([%-32s], [$2]), [ ], [.]) [$]$4], | |
122 | m4_newline) | |
123 | AC_CONFIG_COMMANDS_PRE([dnl | |
124 | AM_CONDITIONAL([$4], [test "x[$]$4" = xyes]) | |
125 | AM_COND_IF([$4], [AC_DEFINE([HAVE_$4], [1], [Whether to support $1 device.])]) | |
126 | ]) | |
d4b38748 | 127 | ]) |
c5f179a9 DE |
128 | ## SR_DRIVER(Device name, driver-name, [no]) |
129 | m4_define([SR_DRIVER], | |
130 | [_SR_DRIVER([$1], [$2], | |
131 | m4_default_quoted([$3], [$HW_ENABLED_DEFAULT]), | |
132 | m4_expand([AS_TR_CPP([HW_$2])]))]) | |
133 | ||
134 | SR_DRIVER([Agilent DMM], [agilent-dmm]) | |
135 | SR_DRIVER([Appa 55II], [appa-55ii]) | |
136 | SR_DRIVER([ASIX SIGMA/SIGMA2], [asix-sigma]) | |
137 | SR_DRIVER([Atten PPS3xxx], [atten-pps3xxx]) | |
138 | SR_DRIVER([BayLibre ACME], [baylibre-acme]) | |
139 | SR_DRIVER([BeagleLogic], [beaglelogic]) | |
140 | SR_DRIVER([Brymen BM86x], [brymen-bm86x]) | |
141 | SR_DRIVER([Brymen DMM], [brymen-dmm]) | |
142 | SR_DRIVER([CEM DT-885x], [cem-dt-885x]) | |
143 | SR_DRIVER([Center 3xx], [center-3xx]) | |
144 | SR_DRIVER([ChronoVu LA], [chronovu-la]) | |
145 | SR_DRIVER([Colead SLM], [colead-slm]) | |
146 | SR_DRIVER([Conrad DIGI 35 CPU], [conrad-digi-35-cpu]) | |
147 | SR_DRIVER([DER EE DE-5000], [deree-de5000]) | |
148 | SR_DRIVER([demo], [demo]) | |
149 | SR_DRIVER([Fluke DMM], [fluke-dmm]) | |
150 | SR_DRIVER([fx2lafw], [fx2lafw]) | |
151 | SR_DRIVER([GMC MH 1x/2x], [gmc-mh-1x-2x]) | |
152 | SR_DRIVER([Hameg HMO], [hameg-hmo]) | |
153 | SR_DRIVER([Hantek DSO], [hantek-dso]) | |
154 | SR_DRIVER([Ikalogic Scanalogic-2], [ikalogic-scanalogic2]) | |
155 | SR_DRIVER([Ikalogic Scanaplus], [ikalogic-scanaplus]) | |
156 | SR_DRIVER([Kecheng KC-330B], [kecheng-kc-330b]) | |
157 | SR_DRIVER([Lascar EL-USB], [lascar-el-usb]) | |
158 | SR_DRIVER([Manson HCS-3xxx], [manson-hcs-3xxx]) | |
159 | SR_DRIVER([maynuo-m97], [maynuo-m97]) | |
160 | SR_DRIVER([MIC 985xx], [mic-985xx]) | |
161 | SR_DRIVER([Motech LPS 30x], [motech-lps-30x]) | |
162 | SR_DRIVER([Norma DMM], [norma-dmm]) | |
163 | SR_DRIVER([OpenBench Logic Sniffer], [openbench-logic-sniffer]) | |
164 | SR_DRIVER([Pipistrello-OLS], [pipistrello-ols]) | |
165 | SR_DRIVER([Rigol DS], [rigol-ds]) | |
166 | SR_DRIVER([Saleae Logic16], [saleae-logic16]) | |
167 | SR_DRIVER([SCPI PPS], [scpi-pps]) | |
168 | SR_DRIVER([serial DMM], [serial-dmm]) | |
169 | SR_DRIVER([Sysclk LWLA], [sysclk-lwla]) | |
170 | SR_DRIVER([Teleinfo], [teleinfo]) | |
171 | SR_DRIVER([Testo], [testo]) | |
172 | SR_DRIVER([Tondaj SL-814], [tondaj-sl-814]) | |
173 | SR_DRIVER([UNI-T DMM], [uni-t-dmm]) | |
174 | SR_DRIVER([UNI-T UT32x], [uni-t-ut32x]) | |
175 | SR_DRIVER([Victor DMM], [victor-dmm]) | |
176 | SR_DRIVER([Yokogawa DL/DLM], [yokogawa-dlm]) | |
177 | SR_DRIVER([ZEROPLUS Logic Cube], [zeroplus-logic-cube]) | |
826938d8 | 178 | |
a4737997 MF |
179 | AC_ARG_ENABLE(libserialport, |
180 | AC_HELP_STRING([--disable-libserialport], | |
181 | [disable libserialport support [default=detect]])) | |
182 | ||
183 | AC_ARG_ENABLE(libftdi, | |
184 | AC_HELP_STRING([--disable-libftdi], | |
185 | [disable libftdi support [default=detect]])) | |
186 | ||
187 | AC_ARG_ENABLE(libusb, | |
188 | AC_HELP_STRING([--disable-libusb], | |
189 | [disable libusb support [default=detect]])) | |
190 | ||
62ea3ef5 | 191 | # Language binding '--enable' options: |
c23c8659 | 192 | |
6223feeb BV |
193 | AC_ARG_ENABLE(bindings, |
194 | AC_HELP_STRING([--enable-bindings], | |
195 | [build language bindings [default=yes]]), | |
196 | [BINDINGS_ALL="$enableval"], [BINDINGS_ALL="yes"]) | |
197 | ||
198 | AC_ARG_ENABLE(cxx, | |
c23c8659 ML |
199 | AC_HELP_STRING([--enable-cxx], |
200 | [build C++ bindings [default=yes]]), | |
6223feeb | 201 | [BINDINGS_CXX="$enableval"], [BINDINGS_CXX=$BINDINGS_ALL]) |
c23c8659 | 202 | |
f7740954 ML |
203 | AC_ARG_ENABLE(python, |
204 | AC_HELP_STRING([--enable-python], | |
205 | [build Python bindings [default=yes]]), | |
6223feeb | 206 | [BINDINGS_PYTHON="$enableval"], [BINDINGS_PYTHON=$BINDINGS_ALL]) |
f7740954 | 207 | |
9fcf4d0b ML |
208 | AC_ARG_ENABLE(java, |
209 | AC_HELP_STRING([--enable-java], | |
210 | [build Java bindings [default=yes]]), | |
6223feeb | 211 | [BINDINGS_JAVA="$enableval"], [BINDINGS_JAVA=$BINDINGS_ALL]) |
9fcf4d0b | 212 | |
3e27b177 MC |
213 | AC_ARG_WITH(jni-include-path, |
214 | AC_HELP_STRING([--with-jni-include-path=path], | |
215 | [specify include path for JNI [default=autodetect]]), | |
216 | [JNI_INCLUDE_DIRS="$withval"], [JNI_INCLUDE_DIRS=auto]) | |
217 | ||
c23c8659 ML |
218 | # Check if the C++ compiler supports the C++11 standard. |
219 | ||
f8158d56 BV |
220 | m4_ifdef([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX_11(,[optional])], |
221 | [AC_MSG_NOTICE([Missing macro m4_toupper(aX_CXX_COMPILE_STDCXX_11), no C++11 check])]) | |
c23c8659 ML |
222 | |
223 | if test "x$HAVE_CXX11" != "x1"; then | |
1029d384 | 224 | BINDINGS_CXX="no"; cxx_msg="C++11 compiler required" |
c23c8659 ML |
225 | fi |
226 | ||
62ea3ef5 | 227 | # The C++ bindings use Doxygen to parse libsigrok symbols. |
3532ed01 ML |
228 | AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes]) |
229 | if test "x$HAVE_DOXYGEN" != "xyes"; then | |
62ea3ef5 | 230 | BINDINGS_CXX="no"; cxx_msg="Doxygen required" |
bcacb863 BV |
231 | fi |
232 | ||
de44e114 | 233 | # Python is needed for the C++ bindings. |
da89e23a ML |
234 | AM_PATH_PYTHON([2.7], [HAVE_PYTHON="yes"], |
235 | [HAVE_PYTHON="no"; BINDINGS_CXX="no"; cxx_msg="Python required"]) | |
de44e114 | 236 | |
62ea3ef5 | 237 | # The Python bindings need Python development files. |
57d62c4c | 238 | PKG_CHECK_MODULES([python], [python >= 2.7], |
62ea3ef5 UH |
239 | [CXXFLAGS="$CXXFLAGS $python_CFLAGS"; |
240 | CXXLIBS="$CXXLIBS $python_LIBS"], | |
2ba308ec | 241 | [PKG_CHECK_MODULES([python27], [python-2.7 >= 2.7], |
62ea3ef5 UH |
242 | [CXXFLAGS="$CXXFLAGS $python27_CFLAGS"; |
243 | CXXLIBS="$CXXLIBS $python27_LIBS"], | |
2ba308ec | 244 | [BINDINGS_PYTHON="no"; python_msg="Python headers required"])]) |
bcacb863 | 245 | |
de44e114 | 246 | # The Python bindings need the setuptools Python module. |
0afa91b7 | 247 | m4_ifdef([AX_PYTHON_MODULE], [AX_PYTHON_MODULE([setuptools])], |
62ea3ef5 | 248 | # We'll let it go through even if the macro wasn't found, the Python |
0afa91b7 BV |
249 | # module may still be there. |
250 | [HAVE_PYTHON_SETUPTOOLS="yes"; | |
251 | AC_MSG_NOTICE([Missing macro m4_toupper(aX_PYTHON_MODULE), no setuptools check])] | |
252 | ) | |
253 | if test "x$HAVE_PYMOD_SETUPTOOLS" != "xyes"; then | |
de44e114 | 254 | BINDINGS_PYTHON="no"; python_msg="Python setuptools module required" |
0afa91b7 | 255 | fi |
f7740954 | 256 | |
62ea3ef5 | 257 | # The Python and Java bindings use SWIG to generate code. |
0afa91b7 BV |
258 | AC_CHECK_PROG([HAVE_SWIG], [swig], [yes]) |
259 | if test "x$HAVE_SWIG" != "xyes"; then | |
62ea3ef5 UH |
260 | BINDINGS_PYTHON="no"; python_msg="SWIG required" |
261 | BINDINGS_JAVA="no"; java_msg="SWIG required" | |
f7740954 ML |
262 | fi |
263 | ||
826938d8 UH |
264 | # Checks for libraries. |
265 | ||
1c6736ab ML |
266 | case "$host" in |
267 | *mingw*) | |
268 | # We need to link against the Winsock2 library for SCPI over TCP. | |
269 | LIBS="$LIBS -lws2_32";; | |
270 | esac | |
271 | ||
826938d8 UH |
272 | # This variable collects the pkg-config names of all detected libs. |
273 | # It is then used to construct the "Requires.private:" field in the | |
274 | # libsigrok.pc file. | |
6dddd902 | 275 | SR_PKGLIBS="" |
826938d8 | 276 | |
ee8ddd8f UH |
277 | # libm (the standard math library) is always needed. |
278 | AC_SEARCH_LIBS([pow], [m]) | |
279 | ||
7d4874c1 | 280 | # RPC is only needed for VXI support. |
d5876cfb AJ |
281 | AC_MSG_CHECKING([for RPC support]) |
282 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <rpc/rpc.h>], | |
62ea3ef5 UH |
283 | [CLIENT *rpc_test(void)], |
284 | [{ return clnt_create("", 0, 0, ""); }])], | |
285 | [AC_MSG_RESULT([yes]); have_rpc=1], | |
286 | [AC_MSG_RESULT([no]); have_rpc=0]) | |
d5876cfb | 287 | # Define HAVE_RPC in config.h if we found RPC support. |
7d4874c1 | 288 | AC_DEFINE_UNQUOTED(HAVE_RPC, [$have_rpc], [Specifies whether we have RPC support.]) |
d5876cfb | 289 | # VXI support is only compiled if RPC support was found. |
7d4874c1 | 290 | AM_CONDITIONAL(NEED_RPC, test "x$have_rpc" != "x0") |
d5876cfb | 291 | |
bd7b83cf UH |
292 | AC_DEFINE_UNQUOTED(HOST, ["$host"], [.]) |
293 | ||
aba69262 | 294 | # libglib-2.0 is always needed. Abort if it's not found. |
826938d8 | 295 | # Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement). |
5801d558 UH |
296 | # We require at least 2.32.0 due to e.g. g_variant_new_fixed_array(). |
297 | AM_PATH_GLIB_2_0([2.32.0], | |
4f10853e | 298 | [LIB_CFLAGS="$LIB_CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"]) |
826938d8 | 299 | |
aba69262 | 300 | # libzip is always needed. Abort if it's not found. |
8819bf5a | 301 | PKG_CHECK_MODULES([libzip], [libzip >= 0.10], |
4f10853e | 302 | [LIB_CFLAGS="$LIB_CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS"; |
6dddd902 | 303 | SR_PKGLIBS="$SR_PKGLIBS libzip"]) |
bd7b83cf UH |
304 | libzip_ver=`$PKG_CONFIG --modversion libzip` |
305 | AC_DEFINE_UNQUOTED(HAVE_LIBZIP_VER, ["$libzip_ver"], [.]) | |
826938d8 | 306 | |
c4f2dfd0 UH |
307 | # libserialport is only needed for some hardware drivers. Disable the |
308 | # respective drivers if it is not found. | |
a4737997 | 309 | if test "x$enable_libserialport" != "xno"; then |
8d801467 | 310 | PKG_CHECK_MODULES([libserialport], [libserialport >= 0.1.1], |
a4737997 MF |
311 | [have_libserialport="yes"; LIB_CFLAGS="$LIB_CFLAGS $libserialport_CFLAGS"; |
312 | LIBS="$LIBS $libserialport_LIBS"; | |
313 | SR_PKGLIBS="$SR_PKGLIBS libserialport"], | |
314 | [have_libserialport="no"]) | |
315 | if test "x$enable_libserialport$have_libserialport" = "xyesno"; then | |
62ea3ef5 | 316 | AC_MSG_ERROR([libserialport support requested, but it was not found.]) |
a4737997 MF |
317 | fi |
318 | else | |
319 | have_libserialport="no" | |
320 | fi | |
a4737997 MF |
321 | if test "x$have_libserialport" = "xno"; then |
322 | HW_AGILENT_DMM="no"; HW_APPA_55II="no"; | |
1c183900 | 323 | HW_ATTEN_PPS3XXX="no"; HW_BRYMEN_DMM="no"; HW_CEM_DT_885X="no"; |
823b4e58 | 324 | HW_CENTER_3XX="no"; HW_COLEAD_SLM="no"; HW_CONRAD_DIGI_35_CPU="no"; |
b5089195 JH |
325 | HW_DEREE_DE5000="no"; HW_FLUKE_DMM="no"; HW_GMC_MH_1X_2X="no"; |
326 | HW_HAMEG_HMO="no"; HW_MANSON_HCS_3XXX="no"; HW_MIC_985XX="no"; | |
327 | HW_MOTECH_LPS_30X="no"; HW_NORMA_DMM="no"; | |
328 | HW_OPENBENCH_LOGIC_SNIFFER="no"; HW_SERIAL_DMM="no"; | |
d4b38748 | 329 | HW_TELEINFO="no"; HW_TONDAJ_SL_814="no"; |
a4737997 | 330 | else |
62ea3ef5 | 331 | # Define HAVE_LIBSERIALPORT in config.h if we found libserialport. |
c4f2dfd0 UH |
332 | AC_DEFINE_UNQUOTED(HAVE_LIBSERIALPORT, [1], |
333 | [Specifies whether we have libserialport.]) | |
334 | fi | |
335 | ||
336 | # Serial port helper code is only compiled in if libserialport was found. | |
337 | AM_CONDITIONAL(NEED_SERIAL, test "x$have_libserialport" != xno) | |
a9bce5a5 | 338 | |
62ea3ef5 | 339 | # The VISA SCPI backend is only compiled in if librevisa was found. |
d5062672 | 340 | PKG_CHECK_MODULES([librevisa], [librevisa >= 0.0.20130412], |
4f10853e | 341 | [have_librevisa="yes"; LIB_CFLAGS="$LIB_CFLAGS $librevisa_CFLAGS"; |
1fb2312f | 342 | LIBS="$LIBS $librevisa_LIBS"; |
b84b7ee7 ML |
343 | SR_PKGLIBS="$SR_PKGLIBS librevisa"], |
344 | [have_librevisa="no"]) | |
1fb2312f | 345 | AM_CONDITIONAL(NEED_VISA, test "x$have_librevisa" != xno) |
1fb2312f | 346 | if test "x$have_librevisa" != "xno"; then |
62ea3ef5 | 347 | # Define HAVE_LIBREVISA in config.h if we found librevisa. |
1fb2312f ML |
348 | AC_DEFINE_UNQUOTED(HAVE_LIBREVISA, [1], |
349 | [Specifies whether we have librevisa.]) | |
bd7b83cf UH |
350 | librevisa_ver=`$PKG_CONFIG --modversion librevisa` |
351 | AC_DEFINE_UNQUOTED(HAVE_LIBREVISA_VER, ["$librevisa_ver"], [.]) | |
1fb2312f ML |
352 | fi |
353 | ||
62ea3ef5 | 354 | # The GPIB SCPI backend is only compiled in if libgpib is found. |
d6e63a2c BV |
355 | PKG_CHECK_MODULES([libgpib], [libgpib], |
356 | [have_libgpib="yes"; LIB_CFLAGS="$LIB_CFLAGS $libgpib_CFLAGS"; | |
357 | LIBS="$LIBS $libgpib_LIBS"; | |
358 | SR_PKGLIBS="$SR_PKGLIBS libgpib"], | |
359 | [have_libgpib="no"]) | |
bb2a4ed4 ML |
360 | AM_CONDITIONAL(NEED_GPIB, test "x$have_libgpib" != xno) |
361 | if test "x$have_libgpib" != "xno"; then | |
62ea3ef5 | 362 | # Define HAVE_LIBGPIB in config.h if we found libgpib. |
bb2a4ed4 ML |
363 | AC_DEFINE_UNQUOTED(HAVE_LIBGPIB, [1], |
364 | [Specifies whether we have libgpib.]) | |
bd7b83cf UH |
365 | libgpib_ver=`$PKG_CONFIG --modversion libgpib` |
366 | AC_DEFINE_UNQUOTED(HAVE_LIBGPIB_VER, ["$libgpib_ver"], [.]) | |
bb2a4ed4 ML |
367 | fi |
368 | ||
aba69262 UH |
369 | # libusb-1.0 is only needed for some hardware drivers. Disable the respective |
370 | # drivers if it is not found. | |
a4737997 MF |
371 | if test "x$enable_libusb" != "xno"; then |
372 | case "$host" in | |
373 | *freebsd*) | |
374 | # FreeBSD comes with an "integrated" libusb-1.0-style USB API. | |
375 | # This means libusb-1.0 is always available, no need to check for it, | |
376 | # and no need to (potentially) disable any drivers if it's not found. | |
377 | have_libusb1_0="yes" | |
378 | ;; | |
379 | *) | |
380 | PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.16], | |
381 | [have_libusb1_0="yes"; LIB_CFLAGS="$LIB_CFLAGS $libusb_CFLAGS"; | |
382 | LIBS="$LIBS $libusb_LIBS"; | |
383 | SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"], | |
384 | [have_libusb1_0="no"]) | |
385 | if test "x$enable_libusb$have_libusb1_0" = "xyesno"; then | |
62ea3ef5 | 386 | AC_MSG_ERROR([libusb support requested, but it was not found.]) |
a4737997 MF |
387 | fi |
388 | ;; | |
389 | esac | |
390 | else | |
391 | have_libusb1_0="no" | |
392 | fi | |
a4737997 MF |
393 | if test "x$have_libusb1_0" = "xno"; then |
394 | HW_BRYMEN_BM86X="no"; HW_FX2LAFW="no"; | |
395 | HW_HANTEK_DSO="no"; HW_IKALOGIC_SCANALOGIC2="no"; | |
396 | HW_KECHENG_KC_330B="no"; HW_LASCAR_EL_USB="no"; | |
0acdd793 | 397 | HW_SYSCLK_LWLA="no"; HW_TESTO="no"; HW_UNI_T_DMM="no"; |
a4737997 MF |
398 | HW_UNI_T_UT32X="no"; HW_VICTOR_DMM="no"; |
399 | HW_ZEROPLUS_LOGIC_CUBE="no"; HW_SALEAE_LOGIC16="no"; | |
400 | else | |
62ea3ef5 | 401 | # Define HAVE_LIBUSB_1_0 in config.h if we found libusb-1.0. |
aba69262 | 402 | AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1], |
62ea3ef5 | 403 | [Specifies whether we have libusb-1.0.]) |
a4737997 | 404 | fi |
aba69262 | 405 | |
3fd1d0ee UH |
406 | # USB + FX2 firmware helper code is only compiled in if libusb-1.0 was found. |
407 | AM_CONDITIONAL(NEED_USB, test "x$have_libusb1_0" != xno) | |
408 | ||
aba69262 | 409 | # libftdi is only needed for some hardware drivers. Disable them if not found. |
a4737997 MF |
410 | if test "x$enable_libftdi" != "xno"; then |
411 | PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16], | |
412 | [have_libftdi="yes"; LIB_CFLAGS="$LIB_CFLAGS $libftdi_CFLAGS"; | |
bd7b83cf UH |
413 | LIBS="$LIBS $libftdi_LIBS"; SR_PKGLIBS="$SR_PKGLIBS libftdi"; |
414 | libftdi_ver=`$PKG_CONFIG --modversion libftdi`], | |
c78bcc6f | 415 | [PKG_CHECK_MODULES([libftdi1], [libftdi1 >= 1.0], |
92506359 DH |
416 | [LIB_CFLAGS="$LIB_CFLAGS $libftdi1_CFLAGS"; |
417 | LIBS="$LIBS $libftdi1_LIBS"; | |
bd7b83cf UH |
418 | SR_PKGLIBS="$SR_PKGLIBS libftdi1"; |
419 | libftdi_ver=`$PKG_CONFIG --modversion libftdi1`], | |
92506359 | 420 | [have_libftdi="no"])]) |
a4737997 | 421 | if test "x$enable_libftdi$have_libftdi" = "xyesno"; then |
62ea3ef5 | 422 | AC_MSG_ERROR([libftdi support requested, but it was not found.]) |
a4737997 MF |
423 | fi |
424 | else | |
425 | have_libftdi="no" | |
426 | fi | |
a4737997 MF |
427 | if test "x$have_libftdi" = "xno"; then |
428 | HW_ASIX_SIGMA="no"; HW_CHRONOVU_LA="no"; HW_IKALOGIC_SCANAPLUS="no"; | |
4bd80e12 | 429 | HW_PIPISTRELLO_OLS="no"; |
bd7b83cf UH |
430 | else |
431 | # Define HAVE_LIBFTDI in config.h if we found libftdi. | |
432 | AC_DEFINE_UNQUOTED(HAVE_LIBFTDI, [1], | |
433 | [Specifies whether we have libftdi.]) | |
434 | AC_DEFINE_UNQUOTED(HAVE_LIBFTDI_VER, ["$libftdi_ver"], [.]) | |
a4737997 | 435 | fi |
aba69262 | 436 | |
c23c8659 ML |
437 | # glibmm-2.4 is needed for the C++ bindings. |
438 | PKG_CHECK_MODULES([glibmm], [glibmm-2.4 >= 2.32.0], | |
439 | [CXXFLAGS="$CXXFLAGS $glibmm_CFLAGS"; | |
1029d384 BV |
440 | CXXLIBS="$CXXLIBS $glibmm_LIBS"], |
441 | [BINDINGS_CXX="no"; cxx_msg="glibmm required"]) | |
c23c8659 | 442 | |
62ea3ef5 | 443 | # C++ bindings want stoi and stod. |
1f501d72 | 444 | if test "x$BINDINGS_CXX" = "xyes"; then |
d92de05a MC |
445 | AC_LANG_PUSH([C++]) |
446 | AC_MSG_CHECKING([for stoi and stod]) | |
447 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <string>], | |
62ea3ef5 UH |
448 | [{ return std::stoi("1") + std::stod("1.0"); }])], |
449 | [AC_MSG_RESULT([yes]); | |
d92de05a MC |
450 | AC_DEFINE_UNQUOTED(HAVE_STOI_STOD, [1], |
451 | [Specifies whether we have the stoi and stod functions.])], | |
62ea3ef5 | 452 | [AC_MSG_RESULT([no])]) |
d92de05a MC |
453 | AC_LANG_POP([C++]) |
454 | fi | |
455 | ||
f7740954 | 456 | # PyGObject is needed for the Python bindings. |
022a7fe0 | 457 | PKG_CHECK_MODULES([pygobject], [pygobject-3.0 >= 3.0.0], |
62ea3ef5 UH |
458 | [CXXFLAGS="$CXXFLAGS $pygobject_CFLAGS"; |
459 | CXXLIBS="$CXXLIBS $pygobject_LIBS"; | |
abc7146d ML |
460 | PKG_CHECK_MODULES([pygobject_3_7_91], [pygobject-3.0 >= 3.7.91], |
461 | [pyg_flags_signed=0], [pyg_flags_signed=1]); | |
462 | AC_DEFINE_UNQUOTED(PYGOBJECT_FLAGS_SIGNED, [$pyg_flags_signed], | |
62ea3ef5 | 463 | [Whether last argument to pyg_flags_get_value() is signed.])], |
1029d384 | 464 | [BINDINGS_PYTHON="no"; python_msg="Python pygobject module required"]) |
f7740954 | 465 | |
aba69262 | 466 | # The Check unit testing framework is optional. Disable if not found. |
79bb0e97 | 467 | PKG_CHECK_MODULES([check], [check >= 0.9.4], |
82bfb646 | 468 | [have_check="yes"], [have_check="no"]) |
79bb0e97 UH |
469 | AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes") |
470 | ||
375340a7 UH |
471 | # The BeagleLogic driver needs sys/mman.h and sys/ioctl.h. Don't try to |
472 | # build it if these headers aren't available. | |
473 | AC_CHECK_HEADERS([sys/mman.h sys/ioctl.h], [], [HW_BEAGLELOGIC="no"]) | |
474 | ||
176c7219 UH |
475 | # The BayLibre ACME driver needs sys/timerfd.h. Don't try to build it if |
476 | # this header isn't available. | |
477 | AC_CHECK_HEADERS([sys/timerfd.h], [], [HW_BAYLIBRE_ACME="no"]) | |
478 | ||
a0b277ba | 479 | # The ACME driver can only be built for Linux. |
f80b3fe2 | 480 | case "$host" in |
25609412 UH |
481 | *linux*) ;; |
482 | *) HW_BAYLIBRE_ACME="no" ;; | |
a0b277ba BG |
483 | esac |
484 | ||
6dddd902 | 485 | AC_SUBST(SR_PKGLIBS) |
826938d8 | 486 | |
c1aae900 DE |
487 | CFLAGS="$CFLAGS $LIB_CFLAGS" |
488 | CXXFLAGS="$CXXFLAGS $LIB_CFLAGS" | |
4f10853e | 489 | |
9fcf4d0b | 490 | # Find Java compiler and JNI includes for Java bindings. |
9fcf4d0b | 491 | AC_CHECK_PROG([HAVE_JAVAC], [javac], [yes], [no]) |
84b448ee | 492 | if test "x$HAVE_JAVAC" = "xyes" && test "x$BINDINGS_JAVA" = "xyes"; then |
9fcf4d0b | 493 | AX_PROG_JAVAC |
3e27b177 MC |
494 | if test "x$JNI_INCLUDE_DIRS" = "xauto"; then |
495 | if test "x$cross_compiling" = "xyes"; then | |
496 | JNI_INCLUDE_DIRS= | |
497 | else | |
498 | AX_JNI_INCLUDE_DIR | |
499 | fi | |
500 | fi | |
9fcf4d0b ML |
501 | for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do |
502 | CXXFLAGS="$CXXFLAGS -I$JNI_INCLUDE_DIR" | |
503 | done | |
3e27b177 MC |
504 | AC_LANG_PUSH([C++]) |
505 | AC_CHECK_HEADERS([jni.h], [], [BINDINGS_JAVA="no"; java_msg="Java JNI headers required"]) | |
506 | AC_LANG_POP([C++]) | |
9fcf4d0b | 507 | else |
1029d384 BV |
508 | BINDINGS_JAVA="no"; java_msg="Java compiler required" |
509 | fi | |
510 | ||
511 | # Python and Java bindings depend on C++ bindings. | |
512 | if test "x$BINDINGS_CXX" != "xyes"; then | |
513 | BINDINGS_PYTHON="no"; python_msg="C++ bindings required" | |
514 | BINDINGS_JAVA="no"; java_msg="C++ bindings required" | |
9fcf4d0b ML |
515 | fi |
516 | ||
c23c8659 ML |
517 | AM_CONDITIONAL(BINDINGS_CXX, test x$BINDINGS_CXX = xyes) |
518 | ||
f7740954 ML |
519 | AM_CONDITIONAL(BINDINGS_PYTHON, test x$BINDINGS_PYTHON = xyes) |
520 | ||
9fcf4d0b ML |
521 | AM_CONDITIONAL(BINDINGS_JAVA, test x$BINDINGS_JAVA = xyes) |
522 | ||
826938d8 | 523 | # Checks for header files. |
375340a7 UH |
524 | # These are already implicitly checked: inttypes.h stdint.h stdlib.h string.h |
525 | # unistd.h memory.h strings.h dlfcn.h sys/types.h sys/stat.h. | |
826938d8 UH |
526 | |
527 | # Checks for typedefs, structures, and compiler characteristics. | |
7b5daad4 | 528 | AC_C_BIGENDIAN |
826938d8 | 529 | |
27a2497d | 530 | AC_SUBST([FIRMWARE_DIR], ['$(datadir)/sigrok-firmware']) |
826938d8 UH |
531 | AC_SUBST(MAKEFLAGS, '--no-print-directory') |
532 | AC_SUBST(AM_LIBTOOLFLAGS, '--silent') | |
533 | ||
b2478a23 | 534 | AC_CONFIG_FILES([Makefile libsigrok.pc bindings/cxx/libsigrokcxx.pc]) |
826938d8 UH |
535 | |
536 | AC_OUTPUT | |
537 | ||
538 | echo | |
45aed072 | 539 | echo "libsigrok configuration summary:" |
826938d8 | 540 | echo |
6dddd902 UH |
541 | echo " - Package version (major.minor.micro): $SR_PACKAGE_VERSION" |
542 | echo " - Library version (current:revision:age): $SR_LIB_VERSION" | |
45aed072 | 543 | echo " - Prefix: $prefix" |
6bad8487 UH |
544 | echo " - Building on: $build" |
545 | echo " - Building for: $host" | |
45aed072 UH |
546 | echo |
547 | echo "Detected libraries:" | |
548 | echo | |
549 | ||
550 | # Note: This only works for libs with pkg-config integration. | |
8d801467 | 551 | for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1.1" \ |
d5062672 | 552 | "librevisa >= 0.0.20130412" "libusb-1.0 >= 1.0.16" "libftdi >= 0.16" \ |
62ea3ef5 UH |
553 | "libftdi1 >= 1.0" "libgpib" "glibmm-2.4 >= 2.32.0" \ |
554 | "pygobject-3.0 >= 3.0.0" "check >= 0.9.4" | |
d6e63a2c | 555 | do |
958326f8 | 556 | optional="OPTIONAL" |
5801d558 | 557 | if test "x$lib" = "xglib-2.0 >= 2.32.0"; then optional="REQUIRED"; fi |
958326f8 | 558 | if test "x$lib" = "xlibzip >= 0.10"; then optional="REQUIRED"; fi |
45aed072 UH |
559 | if `$PKG_CONFIG --exists $lib`; then |
560 | ver=`$PKG_CONFIG --modversion $lib` | |
561 | answer="yes ($ver)" | |
562 | else | |
563 | answer="no" | |
564 | fi | |
958326f8 | 565 | echo " - ($optional) $lib: $answer" |
45aed072 UH |
566 | done |
567 | ||
c5f179a9 DE |
568 | cat <<_EOF |
569 | ||
570 | Enabled hardware drivers: | |
571 | SR_DRIVER_SUMMARY | |
572 | ||
573 | _EOF | |
826938d8 | 574 | |
62ea3ef5 | 575 | # Prepare final bindings report messages. |
1029d384 BV |
576 | final_cxx="" |
577 | final_python="" | |
578 | final_java="" | |
579 | if test "$enable_bindings" = "no"; then | |
580 | final_cxx=" (disabled)" | |
581 | final_python=" (disabled)" | |
582 | final_java=" (disabled)" | |
583 | else | |
584 | if test "$enable_cxx" = "no"; then | |
585 | final_cxx=" (disabled)" | |
586 | elif test "$BINDINGS_CXX" = "no"; then | |
587 | final_cxx=" ($cxx_msg)" | |
588 | fi | |
589 | if test "$enable_python" = "no"; then | |
590 | final_python=" (disabled)" | |
591 | elif test "$BINDINGS_PYTHON" = "no"; then | |
592 | final_python=" ($python_msg)" | |
593 | fi | |
594 | if test "$enable_java" = "no"; then | |
595 | final_java=" (disabled)" | |
596 | elif test "$BINDINGS_JAVA" = "no"; then | |
597 | final_java=" ($java_msg)" | |
598 | fi | |
599 | fi | |
600 | ||
a0ca437d UH |
601 | echo "Enabled SCPI backends:" |
602 | echo " - TCP............................. yes" | |
603 | if test "x$have_rpc" = "x0"; then | |
604 | echo " - RPC............................. no" | |
605 | else | |
606 | echo " - RPC............................. yes" | |
607 | fi | |
608 | echo " - serial.......................... $have_libserialport" | |
609 | echo " - VISA............................ $have_librevisa" | |
610 | echo " - GPIB............................ $have_libgpib" | |
611 | echo " - USBTMC.......................... $have_libusb1_0" | |
612 | echo | |
613 | ||
614 | echo "Enabled language bindings:" | |
1029d384 BV |
615 | echo " - C++............................. $BINDINGS_CXX$final_cxx" |
616 | echo " - Python.......................... $BINDINGS_PYTHON$final_python" | |
617 | echo " - Java............................ $BINDINGS_JAVA$final_java" | |
c23c8659 | 618 | echo |