2 ## This file is part of the sigrok-test project.
4 ## Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
5 ## Copyright (C) 2014 Uwe Hermann <uwe@hermann-uwe.de>
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.
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.
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/>.
21 # We require at least autoconf 2.63 (AC_INIT format changed there).
24 AC_INIT([sigrok-test], [0.1.0], [sigrok-devel@lists.sourceforge.net],
25 [sigrok-test], [http://www.sigrok.org])
26 AC_CONFIG_MACRO_DIR([m4])
27 AC_CONFIG_AUX_DIR([autostuff])
29 # We require at least automake 1.11 (needed for 'silent rules').
30 AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define subdir-objects check-news])
31 AM_SILENT_RULES([yes])
35 # Checks for programs.
38 # Required for per-target flags or subdir-objects with C sources.
41 # Get compiler versions.
42 SR_PROG_VERSION([$CC], [st_cc_version])
44 ############################
45 ## Package dependencies ##
46 ############################
48 # Initialize pkg-config.
49 # We require at least 0.22, as "Requires.private" behaviour changed there.
50 PKG_PROG_PKG_CONFIG([0.22])
52 # Keep track of all checked modules so we can list them at the end.
54 SR_PKG_CHECK_SUMMARY([st_pkglibs_summary])
56 # Python 3 is always needed.
57 # Starting with Python 3.8 we need to check for "python-3.8-embed"
58 # first, since usually only that variant will add "-lpython3.8".
59 # https://docs.python.org/3/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
60 SR_PKG_CHECK([python3], [ST_PKGLIBS],
61 [python-3.8-embed], [python-3.8 >= 3.8], [python-3.7 >= 3.7], [python-3.6 >= 3.6], [python-3.5 >= 3.5], [python-3.4 >= 3.4], [python-3.3 >= 3.3], [python-3.2 >= 3.2], [python3 >= 3.2])
62 AS_IF([test "x$sr_have_python3" = xno],
63 [AC_MSG_ERROR([Cannot find Python 3 development headers.])])
65 ######################
67 ######################
71 # Enable the C99 standard if possible.
73 SR_CHECK_COMPILE_FLAGS([ST_EXTRA_CFLAGS], [C99],
74 [-std=c99 -c99 -AC99 -qlanglvl=extc99])
76 SR_ARG_ENABLE_WARNINGS([ST_WFLAGS],
77 [-Wall], [-Wall -Wextra -Wmissing-prototypes])
79 # Check host characteristics.
82 # Checks for header files.
83 AC_CHECK_HEADER([sys/resource.h],,
84 [AC_MSG_ERROR([Missing required header sys/resource.h])])
86 ##############################
87 ## Finalize configuration ##
88 ##############################
90 # Retrieve the compile and link flags for all modules combined.
91 # Also, bail out at this point if any module dependency is not met.
92 PKG_CHECK_MODULES([SIGROK_TEST],
93 [glib-2.0 >= 2.24.0 libsigrok >= 0.5.0 libsigrokdecode >= 0.5.0 $ST_PKGLIBS])
95 # Allow the user to override the location of the protocol decoders.
96 AC_ARG_WITH([decodersdir],
97 [AS_HELP_STRING([--with-decodersdir=DIR],
98 [specify location of protcol decoders [default=auto]])],
99 [st_decodersdir=$withval], [st_decodersdir=auto])
101 AS_IF([test "x$st_decodersdir" = xauto], [
102 st_decodersdir=`$PKG_CONFIG --variable=decodersdir libsigrokdecode 2>&AS_MESSAGE_LOG_FD`
103 AS_IF([test "[$]?" != 0 || test -z "$st_decodersdir"],
104 [st_decodersdir='$(datadir)/libsigrokdecode/decoders'])
106 AC_SUBST([DECODERS_DIR], [$st_decodersdir])
108 st_glib_version=`$PKG_CONFIG --modversion glib-2.0 2>&AS_MESSAGE_LOG_FD`
109 st_libsigrok_version=`$PKG_CONFIG --modversion libsigrok 2>&AS_MESSAGE_LOG_FD`
110 st_libsigrokdecode_version=`$PKG_CONFIG --modversion libsigrokdecode 2>&AS_MESSAGE_LOG_FD`
112 AC_CONFIG_FILES([Makefile])
115 cat >&AS_MESSAGE_FD <<_EOF
117 sigrok-test configuration summary:
118 - Package version................. $PACKAGE_VERSION
119 - Prefix.......................... $prefix
120 - Decoders directory.............. $st_decodersdir
121 - Building on..................... $build
122 - Building for.................... $host
124 Compile configuration:
125 - C compiler...................... $CC
126 - C compiler version.............. $st_cc_version
127 - C compiler flags................ $CFLAGS
128 - Additional C compiler flags..... $ST_EXTRA_CFLAGS
129 - C compiler warnings............. $ST_WFLAGS
130 - Linker flags.................... $LDFLAGS
132 Detected libraries (required):
133 - glib-2.0 >= 2.24.0.............. $st_glib_version
134 - libsigrok >= 0.5.0.............. $st_libsigrok_version
135 - libsigrokdecode >= 0.5.0........ $st_libsigrokdecode_version