]> sigrok.org Git - sigrok-cli.git/blob - configure.ac
cli: Show sr/srd versions determined at run-time.
[sigrok-cli.git] / configure.ac
1 ##
2 ## This file is part of the sigrok 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.3.0], [sigrok-devel@lists.sourceforge.net],
24         [sigrok-cli], [http://www.sigrok.org])
25
26 AC_CONFIG_SRCDIR([sigrok-cli.c])
27
28 AC_CONFIG_HEADERS([config.h])
29 AC_CONFIG_MACRO_DIR([autostuff])
30 AC_CONFIG_AUX_DIR([autostuff])
31
32 # We require at least automake 1.11 (needed for 'silent rules').
33 AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign std-options])
34 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
35
36 AH_TOP([#ifndef SIGROK_CLI_CONFIG_H
37 #define SIGROK_CLI_CONFIG_H    /* To stop multiple inclusions. */])
38 AH_BOTTOM([#endif /* SIGROK_CLI_CONFIG_H */])
39
40 CFLAGS="-g -Wall -Wextra"
41
42 # Checks for programs.
43 AC_PROG_CC
44 AC_PROG_CPP
45 AC_PROG_INSTALL
46 AC_PROG_LN_S
47
48 # Initialize libtool.
49 LT_INIT
50
51 # Initialize pkg-config.
52 # We require at least 0.22, as "Requires.private" behaviour changed there.
53 PKG_PROG_PKG_CONFIG([0.22])
54
55 # Checks for libraries.
56
57 AM_PATH_GLIB_2_0([2.22.0],
58         [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
59
60 PKG_CHECK_MODULES([libsigrok], [libsigrok >= 0.1.0],
61         [CFLAGS="$CFLAGS $libsigrok_CFLAGS";
62         LIBS="$LIBS $libsigrok_LIBS"])
63
64 PKG_CHECK_MODULES([libsigrokdecode], [libsigrokdecode >= 0.1.0],
65         [CFLAGS="$CFLAGS $libsigrokdecode_CFLAGS";
66         LIBS="$LIBS $libsigrokdecode_LIBS"])
67
68 # Checks for header files.
69 # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
70 AC_CHECK_HEADERS([sys/time.h termios.h])
71
72 # Checks for typedefs, structures, and compiler characteristics.
73 AC_C_INLINE
74 AC_TYPE_INT8_T
75 AC_TYPE_INT16_T
76 AC_TYPE_INT32_T
77 AC_TYPE_INT64_T
78 AC_TYPE_UINT8_T
79 AC_TYPE_UINT16_T
80 AC_TYPE_UINT32_T
81 AC_TYPE_UINT64_T
82 AC_TYPE_SIZE_T
83
84 # Checks for library functions.
85 AC_CHECK_FUNCS([strcasecmp strchr strerror strstr strtol])
86
87 AC_SUBST(MAKEFLAGS, '--no-print-directory')
88 AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
89
90 AC_CONFIG_FILES([Makefile
91                  contrib/Makefile
92                  contrib/sigrok-cli.nsi
93                  doc/Makefile])
94
95 AC_OUTPUT
96
97 echo
98 echo "sigrok-cli configuration summary:"
99 echo
100 echo "  - Package version: $VERSION"
101 echo "  - Prefix: $prefix"
102 echo
103 echo "Detected libraries:"
104 echo
105
106 # Note: This only works for libs with pkg-config integration.
107 for lib in "glib-2.0" "libsigrok" "libsigrokdecode"; do
108         if `$PKG_CONFIG --exists $lib`; then
109                 ver=`$PKG_CONFIG --modversion $lib`
110                 answer="yes ($ver)"
111         else
112                 answer="no"
113         fi
114         echo "  - $lib: $answer"
115 done
116
117 echo
118