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