]> sigrok.org Git - sigrok-cli.git/blame - configure.ac
show: use getter result to determine "current" presence (voltage range)
[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
f4599c1a 23AC_INIT([sigrok-cli], [0.8.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
9d642270 34AC_CANONICAL_HOST
43e5747a
UH
35
36# Checks for programs.
37AC_PROG_CC
43e5747a 38AC_PROG_INSTALL
43e5747a 39
c5f46105
DE
40# Set the standard the C library headers should conform to.
41AH_VERBATIM([_POSIX_C_SOURCE], [/* The targeted POSIX standard. */
42#ifndef _POSIX_C_SOURCE
43# define _POSIX_C_SOURCE 200112L
44#endif])
45
9d642270
DE
46# Get compiler versions.
47SR_PROG_VERSION([$CC], [sc_cc_version])
48
49# Set up the sigrok-cli version defines.
50SR_PKG_VERSION_SET([SC_PACKAGE_VERSION], [AC_PACKAGE_VERSION])
51
52#############################
53## Optional dependencies ##
54#############################
43e5747a
UH
55
56# Initialize pkg-config.
57# We require at least 0.22, as "Requires.private" behaviour changed there.
58PKG_PROG_PKG_CONFIG([0.22])
59
9d642270
DE
60# Keep track of all checked modules so we can list them at the end.
61SR_PKG_CHECK_SUMMARY([sc_pkglibs_summary])
62
63# Collect the pkg-config module names of all dependencies.
64SR_VAR_OPT_PKG([SC_PKGLIBS])
43e5747a 65
9d642270 66SR_ARG_OPT_PKG([libsigrokdecode], [SRD],,
247d467a 67 [libsigrokdecode >= 0.5.0])
81f487d6 68
9d642270
DE
69######################
70## Feature checks ##
71######################
43e5747a 72
9d642270 73AC_LANG([C])
43e5747a 74
9d642270
DE
75# Enable the C99 standard if possible.
76SC_EXTRA_CFLAGS=
77SR_CHECK_COMPILE_FLAGS([SC_EXTRA_CFLAGS], [C99],
78 [-std=c99 -c99 -AC99 -qlanglvl=extc99])
43e5747a 79
9d642270
DE
80SR_ARG_ENABLE_WARNINGS([SC_WFLAGS], [-Wall], [-Wall -Wextra])
81
82# Check host characteristics.
83AC_SYS_LARGEFILE
84
85##############################
86## Finalize configuration ##
87##############################
88
89# Retrieve the compile and link flags for all modules combined.
90# Also, bail out at this point if any module dependency is not met.
91PKG_CHECK_MODULES([SIGROK_CLI],
247d467a 92 [glib-2.0 >= 2.32.0 libsigrok >= 0.5.0 $SC_PKGLIBS])
9d642270 93
4db16cc5
GS
94# Check for version dependent availability of functions.
95srd_save_cflags=$CFLAGS
96srd_save_libs=$LIBS
97CFLAGS="$SIGROK_CLI_CFLAGS $CFLAGS"
98LIBS="$SIGROK_CLI_LIBS $LIBS"
99AC_CHECK_FUNCS([srd_session_send_eof])
100CFLAGS=$srd_save_cflags
101LIBS=$srd_save_libs
102
9d642270
DE
103sc_glib_version=`$PKG_CONFIG --modversion glib-2.0 2>&AS_MESSAGE_LOG_FD`
104sc_libsigrok_version=`$PKG_CONFIG --modversion libsigrok 2>&AS_MESSAGE_LOG_FD`
43e5747a 105
6da249da 106AC_CONFIG_FILES([Makefile contrib/sigrok-cli_cross.nsi])
43e5747a
UH
107
108AC_OUTPUT
109
9d642270
DE
110cat >&AS_MESSAGE_FD <<_EOF
111
112sigrok-cli configuration summary:
113 - Package version................. $SC_PACKAGE_VERSION
114 - Prefix.......................... $prefix
115 - Building on..................... $build
116 - Building for.................... $host
117
118Compile configuration:
119 - C compiler...................... $CC
120 - C compiler version.............. $sc_cc_version
121 - C compiler flags................ $CFLAGS
122 - Additional C compiler flags..... $SC_EXTRA_CFLAGS
123 - C compiler warnings............. $SC_WFLAGS
9d94914c 124 - Linker flags.................... $LDFLAGS
9d642270
DE
125
126Detected libraries (required):
3addebb2 127 - glib-2.0 >= 2.32.0.............. $sc_glib_version
247d467a 128 - libsigrok >= 0.5.0.............. $sc_libsigrok_version
81f487d6 129
9d642270
DE
130Detected libraries (optional):
131$sc_pkglibs_summary
132_EOF