blob: 65e0b42390bb4745488cc1bf13550f0cc18bf9d1 [file] [log] [blame]
Uwe Hermann43e57472011-12-30 11:23:22 +01001##
Uwe Hermann630293b2013-04-23 22:10:41 +02002## This file is part of the sigrok-cli project.
Uwe Hermann43e57472011-12-30 11:23:22 +01003##
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
Uwe Hermann26581032012-01-28 21:26:56 +010020# We require at least autoconf 2.63 (AC_INIT format changed there).
21AC_PREREQ([2.63])
Uwe Hermann43e57472011-12-30 11:23:22 +010022
Uwe Hermannb6479f72013-05-04 21:37:41 +020023AC_INIT([sigrok-cli], [0.4.0], [sigrok-devel@lists.sourceforge.net],
Bert Vermeulende0a0662013-03-12 22:49:16 +010024 [sigrok-cli], [http://www.sigrok.org])
Uwe Hermann43e57472011-12-30 11:23:22 +010025
Bert Vermeulenf0f2c3f2013-11-17 19:19:55 +010026AC_CONFIG_SRCDIR([sigrok-cli.h])
Uwe Hermann43e57472011-12-30 11:23:22 +010027
28AC_CONFIG_HEADERS([config.h])
Uwe Hermannd04f8fd2012-01-03 21:55:48 +010029AC_CONFIG_MACRO_DIR([autostuff])
30AC_CONFIG_AUX_DIR([autostuff])
Uwe Hermann43e57472011-12-30 11:23:22 +010031
Uwe Hermann26581032012-01-28 21:26:56 +010032# We require at least automake 1.11 (needed for 'silent rules').
Uwe Hermann82dad9a2013-03-17 13:09:35 +010033AM_INIT_AUTOMAKE([1.11 -Wall -Werror std-options check-news])
Uwe Hermann43e57472011-12-30 11:23:22 +010034m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Pekka Nikander04ef7072012-05-11 19:23:21 +030035m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Uwe Hermann43e57472011-12-30 11:23:22 +010036
Uwe Hermann91425112012-01-04 00:49:06 +010037AH_TOP([#ifndef SIGROK_CLI_CONFIG_H
Uwe Hermann43e57472011-12-30 11:23:22 +010038#define SIGROK_CLI_CONFIG_H /* To stop multiple inclusions. */])
39AH_BOTTOM([#endif /* SIGROK_CLI_CONFIG_H */])
40
Uwe Hermann12ea9522012-12-28 17:30:56 +010041# Enable more compiler warnings via -Wall and -Wextra.
42CFLAGS="$CFLAGS -Wall -Wextra"
Uwe Hermann43e57472011-12-30 11:23:22 +010043
44# Checks for programs.
45AC_PROG_CC
46AC_PROG_CPP
47AC_PROG_INSTALL
48AC_PROG_LN_S
49
50# Initialize libtool.
51LT_INIT
52
53# Initialize pkg-config.
54# We require at least 0.22, as "Requires.private" behaviour changed there.
55PKG_PROG_PKG_CONFIG([0.22])
56
57# Checks for libraries.
Bert Vermeulende0a0662013-03-12 22:49:16 +010058AC_ARG_WITH([libsigrokdecode],
59 AS_HELP_STRING([--with-libsigrokdecode],
60 [compile with libsigrokdecode support]),
61 [WITH_SRD=$enableval],[WITH_SRD=yes])
62AM_CONDITIONAL(WITH_SRD, test x$WITH_SRD = xyes)
Uwe Hermann43e57472011-12-30 11:23:22 +010063
Bert Vermeulen366237a2012-06-23 01:17:36 +020064AM_PATH_GLIB_2_0([2.28.0],
Bert Vermeulende0a0662013-03-12 22:49:16 +010065 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
Uwe Hermann81f487d2012-01-04 03:09:20 +010066
Uwe Hermann6deff8e2012-06-01 00:23:47 +020067PKG_CHECK_MODULES([libsigrok], [libsigrok >= 0.2.0],
Uwe Hermann43e57472011-12-30 11:23:22 +010068 [CFLAGS="$CFLAGS $libsigrok_CFLAGS";
69 LIBS="$LIBS $libsigrok_LIBS"])
70
Bert Vermeulende0a0662013-03-12 22:49:16 +010071if test "x$WITH_SRD" = "xyes"; then
Uwe Hermann70918962013-05-03 19:53:09 +020072 PKG_CHECK_MODULES([libsigrokdecode], [libsigrokdecode >= 0.2.0],
Bert Vermeulende0a0662013-03-12 22:49:16 +010073 [CFLAGS="$CFLAGS $libsigrokdecode_CFLAGS";
74 LIBS="$LIBS $libsigrokdecode_LIBS";
75 AC_DEFINE(HAVE_SRD, [1], [libsigrokdecode is available.])]
76 )
77fi
Uwe Hermann43e57472011-12-30 11:23:22 +010078
79# Checks for header files.
80# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
Uwe Hermann43e57472011-12-30 11:23:22 +010081
82AC_SUBST(MAKEFLAGS, '--no-print-directory')
83AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
84
85AC_CONFIG_FILES([Makefile
Uwe Hermann2c45d102012-02-06 21:39:13 +010086 contrib/Makefile
Uwe Hermann58b03622013-04-22 13:46:13 +020087 contrib/sigrok-cli_cross.nsi
Uwe Hermann43e57472011-12-30 11:23:22 +010088 doc/Makefile])
89
90AC_OUTPUT
91
Uwe Hermann81f487d2012-01-04 03:09:20 +010092echo
93echo "sigrok-cli configuration summary:"
94echo
95echo " - Package version: $VERSION"
96echo " - Prefix: $prefix"
Uwe Hermann397969a2013-04-15 12:30:31 +020097echo " - Building on: $build"
98echo " - Building for: $host"
Uwe Hermann81f487d2012-01-04 03:09:20 +010099echo
100echo "Detected libraries:"
101echo
102
103# Note: This only works for libs with pkg-config integration.
Uwe Hermann70918962013-05-03 19:53:09 +0200104for lib in "glib-2.0 >= 2.28.0" "libsigrok >= 0.2.0" "libsigrokdecode >= 0.2.0"; do
Bert Vermeulende0a0662013-03-12 22:49:16 +0100105 if test "$lib" = "libsigrokdecode" -a "$WITH_SRD" != "yes" ; then
106 answer="no"
107 else
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 fi
Uwe Hermann5a103202014-04-13 18:17:04 +0200115 echo " - (REQUIRED) $lib: $answer"
Uwe Hermann81f487d2012-01-04 03:09:20 +0100116done
117
118echo
119