]> sigrok.org Git - sigrok-cli.git/blame - configure.ac
Build: Adopt modernized Autotools build system
[sigrok-cli.git] / configure.ac
CommitLineData
43e5747a 1##
630293b4 2## This file is part of the sigrok-cli project.
43e5747a
UH
3##
4## Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
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
2658103e
UH
20# We require at least autoconf 2.63 (AC_INIT format changed there).
21AC_PREREQ([2.63])
43e5747a 22
9d642270 23AC_INIT([sigrok-cli], [0.6.0], [sigrok-devel@lists.sourceforge.net],
de0a066e 24 [sigrok-cli], [http://www.sigrok.org])
f0f2c3f3 25AC_CONFIG_SRCDIR([sigrok-cli.h])
9d642270 26AC_CONFIG_MACRO_DIR([m4])
d04f8fdc 27AC_CONFIG_AUX_DIR([autostuff])
9d642270 28AC_CONFIG_HEADERS([config.h])
43e5747a 29
2658103e 30# We require at least automake 1.11 (needed for 'silent rules').
9d642270
DE
31AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define std-options check-news])
32AM_SILENT_RULES([yes])
43e5747a 33
91425119 34AH_TOP([#ifndef SIGROK_CLI_CONFIG_H
43e5747a
UH
35#define SIGROK_CLI_CONFIG_H /* To stop multiple inclusions. */])
36AH_BOTTOM([#endif /* SIGROK_CLI_CONFIG_H */])
37
9d642270 38AC_CANONICAL_HOST
43e5747a
UH
39
40# Checks for programs.
41AC_PROG_CC
43e5747a 42AC_PROG_INSTALL
43e5747a 43
9d642270
DE
44# Get compiler versions.
45SR_PROG_VERSION([$CC], [sc_cc_version])
46
47# Set up the sigrok-cli version defines.
48SR_PKG_VERSION_SET([SC_PACKAGE_VERSION], [AC_PACKAGE_VERSION])
49
50#############################
51## Optional dependencies ##
52#############################
43e5747a
UH
53
54# Initialize pkg-config.
55# We require at least 0.22, as "Requires.private" behaviour changed there.
56PKG_PROG_PKG_CONFIG([0.22])
57
9d642270
DE
58# Keep track of all checked modules so we can list them at the end.
59SR_PKG_CHECK_SUMMARY([sc_pkglibs_summary])
60
61# Collect the pkg-config module names of all dependencies.
62SR_VAR_OPT_PKG([SC_PKGLIBS])
43e5747a 63
9d642270
DE
64SR_ARG_OPT_PKG([libsigrokdecode], [SRD],,
65 [libsigrokdecode >= 0.4.0])
81f487d6 66
9d642270
DE
67######################
68## Feature checks ##
69######################
43e5747a 70
9d642270 71AC_LANG([C])
43e5747a 72
9d642270
DE
73# Enable the C99 standard if possible.
74SC_EXTRA_CFLAGS=
75SR_CHECK_COMPILE_FLAGS([SC_EXTRA_CFLAGS], [C99],
76 [-std=c99 -c99 -AC99 -qlanglvl=extc99])
43e5747a 77
9d642270
DE
78SR_ARG_ENABLE_WARNINGS([SC_WFLAGS], [-Wall], [-Wall -Wextra])
79
80# Check host characteristics.
81AC_SYS_LARGEFILE
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_CLI],
90 [glib-2.0 >= 2.28.0 libsigrok >= 0.4.0 $SC_PKGLIBS])
91
92sc_glib_version=`$PKG_CONFIG --modversion glib-2.0 2>&AS_MESSAGE_LOG_FD`
93sc_libsigrok_version=`$PKG_CONFIG --modversion libsigrok 2>&AS_MESSAGE_LOG_FD`
43e5747a 94
6da249da 95AC_CONFIG_FILES([Makefile contrib/sigrok-cli_cross.nsi])
43e5747a
UH
96
97AC_OUTPUT
98
9d642270
DE
99cat >&AS_MESSAGE_FD <<_EOF
100
101sigrok-cli configuration summary:
102 - Package version................. $SC_PACKAGE_VERSION
103 - Prefix.......................... $prefix
104 - Building on..................... $build
105 - Building for.................... $host
106
107Compile configuration:
108 - C compiler...................... $CC
109 - C compiler version.............. $sc_cc_version
110 - C compiler flags................ $CFLAGS
111 - Additional C compiler flags..... $SC_EXTRA_CFLAGS
112 - C compiler warnings............. $SC_WFLAGS
113
114Detected libraries (required):
115 - glib-2.0 >= 2.28.0.............. $sc_glib_version
116 - libsigrok >= 0.4.0.............. $sc_libsigrok_version
81f487d6 117
9d642270
DE
118Detected libraries (optional):
119$sc_pkglibs_summary
120_EOF