]> sigrok.org Git - sigrok-test.git/blame - configure.ac
sdcard_sd: Updates after recent PD changes.
[sigrok-test.git] / configure.ac
CommitLineData
dd37a782
UH
1##
2## This file is part of the sigrok-test project.
3##
4## Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
5## Copyright (C) 2014 Uwe Hermann <uwe@hermann-uwe.de>
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
21# We require at least autoconf 2.63 (AC_INIT format changed there).
22AC_PREREQ([2.63])
23
24AC_INIT([sigrok-test], [0.1.0], [sigrok-devel@lists.sourceforge.net],
25 [sigrok-test], [http://www.sigrok.org])
8189d812
DE
26AC_CONFIG_MACRO_DIR([m4])
27AC_CONFIG_AUX_DIR([autostuff])
dd37a782
UH
28
29# We require at least automake 1.11 (needed for 'silent rules').
8189d812
DE
30AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define subdir-objects check-news])
31AM_SILENT_RULES([yes])
dd37a782 32
8189d812 33AC_CANONICAL_HOST
dd37a782
UH
34
35# Checks for programs.
36AC_PROG_CC
37
38# Required for per-target flags or subdir-objects with C sources.
39AM_PROG_CC_C_O
40
8189d812
DE
41# Get compiler versions.
42SR_PROG_VERSION([$CC], [st_cc_version])
43
44############################
45## Package dependencies ##
46############################
47
dd37a782
UH
48# Initialize pkg-config.
49# We require at least 0.22, as "Requires.private" behaviour changed there.
50PKG_PROG_PKG_CONFIG([0.22])
51
8189d812
DE
52# Keep track of all checked modules so we can list them at the end.
53ST_PKGLIBS=
54SR_PKG_CHECK_SUMMARY([st_pkglibs_summary])
dd37a782 55
8189d812
DE
56# Python 3 is always needed.
57SR_PKG_CHECK([python3], [ST_PKGLIBS],
315bff6b 58 [python3 >= 3.2], [python-3.5 >= 3.5], [python-3.4 >= 3.4], [python-3.3 >= 3.3], [python-3.2 >= 3.2])
8189d812
DE
59AS_IF([test "x$sr_have_python3" = xno],
60 [AC_MSG_ERROR([Cannot find Python 3 development headers.])])
dd37a782 61
8189d812
DE
62######################
63## Feature checks ##
64######################
dd37a782 65
8189d812 66AC_LANG([C])
dd37a782 67
8189d812
DE
68# Enable the C99 standard if possible.
69ST_EXTRA_CFLAGS=
70SR_CHECK_COMPILE_FLAGS([ST_EXTRA_CFLAGS], [C99],
71 [-std=c99 -c99 -AC99 -qlanglvl=extc99])
dd37a782 72
8189d812
DE
73SR_ARG_ENABLE_WARNINGS([ST_WFLAGS],
74 [-Wall], [-Wall -Wextra -Wmissing-prototypes])
dd37a782 75
8189d812
DE
76# Check host characteristics.
77AC_SYS_LARGEFILE
dd37a782 78
8189d812
DE
79# Checks for header files.
80AC_CHECK_HEADER([sys/resource.h],,
81 [AC_MSG_ERROR([Missing required header sys/resource.h])])
82
83##############################
84## Finalize configuration ##
85##############################
86
87# Retrieve the compile and link flags for all modules combined.
88# Also, bail out at this point if any module dependency is not met.
89PKG_CHECK_MODULES([SIGROK_TEST],
df62f6f3 90 [glib-2.0 >= 2.24.0 libsigrok >= 0.5.0 libsigrokdecode >= 0.5.0 $ST_PKGLIBS])
8189d812
DE
91
92# Allow the user to override the location of the protocol decoders.
93AC_ARG_WITH([decodersdir],
94 [AS_HELP_STRING([--with-decodersdir=DIR],
95 [specify location of protcol decoders [default=auto]])],
96 [st_decodersdir=$withval], [st_decodersdir=auto])
97
98AS_IF([test "x$st_decodersdir" = xauto], [
99 st_decodersdir=`$PKG_CONFIG --variable=decodersdir libsigrokdecode 2>&AS_MESSAGE_LOG_FD`
100 AS_IF([test "[$]?" != 0 || test -z "$st_decodersdir"],
101 [st_decodersdir='$(datadir)/libsigrokdecode/decoders'])
102])
103AC_SUBST([DECODERS_DIR], [$st_decodersdir])
104
105st_glib_version=`$PKG_CONFIG --modversion glib-2.0 2>&AS_MESSAGE_LOG_FD`
106st_libsigrok_version=`$PKG_CONFIG --modversion libsigrok 2>&AS_MESSAGE_LOG_FD`
107st_libsigrokdecode_version=`$PKG_CONFIG --modversion libsigrokdecode 2>&AS_MESSAGE_LOG_FD`
dd37a782 108
8189d812 109AC_CONFIG_FILES([Makefile])
dd37a782
UH
110AC_OUTPUT
111
8189d812
DE
112cat >&AS_MESSAGE_FD <<_EOF
113
114sigrok-test configuration summary:
115 - Package version................. $PACKAGE_VERSION
116 - Prefix.......................... $prefix
117 - Decoders directory.............. $st_decodersdir
118 - Building on..................... $build
119 - Building for.................... $host
120
121Compile configuration:
122 - C compiler...................... $CC
123 - C compiler version.............. $st_cc_version
124 - C compiler flags................ $CFLAGS
125 - Additional C compiler flags..... $ST_EXTRA_CFLAGS
126 - C compiler warnings............. $ST_WFLAGS
2dbe278c 127 - Linker flags.................... $LDFLAGS
8189d812
DE
128
129Detected libraries (required):
130 - glib-2.0 >= 2.24.0.............. $st_glib_version
df62f6f3
UH
131 - libsigrok >= 0.5.0.............. $st_libsigrok_version
132 - libsigrokdecode >= 0.5.0........ $st_libsigrokdecode_version
8189d812
DE
133$st_pkglibs_summary
134_EOF