2 ## This file is part of the sigrok-test project.
4 ## Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
5 ## Copyright (C) 2014 Uwe Hermann <uwe@hermann-uwe.de>
7 ## This program is free software: you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation, either version 3 of the License, or
10 ## (at your option) any later version.
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # We require at least autoconf 2.63 (AC_INIT format changed there).
24 AC_INIT([sigrok-test], [0.1.0], [sigrok-devel@lists.sourceforge.net],
25 [sigrok-test], [http://www.sigrok.org])
27 # We require at least automake 1.11 (needed for 'silent rules').
28 AM_INIT_AUTOMAKE([1.11 -Wall -Werror subdir-objects check-news])
29 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 # Enable more compiler warnings.
32 AM_CFLAGS="$AM_CFLAGS -Wall -Wextra -Wmissing-prototypes"
34 # Checks for programs.
37 # Required for per-target flags or subdir-objects with C sources.
40 # Initialize pkg-config.
41 # We require at least 0.22, as "Requires.private" behaviour changed there.
42 PKG_PROG_PKG_CONFIG([0.22])
44 AC_ARG_WITH(decodersdir,
45 AC_HELP_STRING([--with-decodersdir=path],
46 [specify decodersdir [default=DATAROOTDIR/libsigrokdecode/decoders]]),
47 [DECODERS_DIR=$withval], [DECODERS_DIR=$datadir/libsigrokdecode/decoders])
49 # Checks for libraries.
51 # libglib-2.0 is always needed.
52 AM_PATH_GLIB_2_0([2.24.0],
53 [AM_CFLAGS="$AM_CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
55 # Python 3 is always needed.
56 # Note: We need to try a few different variants, since some systems have a
57 # python3.pc file, others have a python-3.3.pc file, and so on.
58 # See also: http://sigrok.org/wiki/Libsigrokdecode/Python
62 PKG_CHECK_MODULES([python3], [python3 >= 3.2],
63 [pyver=`$PKG_CONFIG --modversion python3`;
64 CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python3_CFLAGS";
65 LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python3_LIBS"],
66 [PKG_CHECK_MODULES([python34], [python-3.4 >= 3.4],
67 [pyver=`$PKG_CONFIG --modversion python-3.4`;
68 CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python34_CFLAGS";
69 LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python34_LIBS"],
70 [PKG_CHECK_MODULES([python33], [python-3.3 >= 3.3],
71 [pyver=`$PKG_CONFIG --modversion python-3.3`;
72 CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python33_CFLAGS";
73 LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python33_LIBS"],
74 [PKG_CHECK_MODULES([python32], [python-3.2 >= 3.2],
75 [pyver=`$PKG_CONFIG --modversion python-3.2`;
76 CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python32_CFLAGS";
77 LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python32_LIBS"],
79 AM_CFLAGS="$AM_CFLAGS $CPPFLAGS_PYTHON"
80 AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS_PYTHON"
82 # libsigrok is always needed.
83 PKG_CHECK_MODULES([libsigrok], [libsigrok >= 0.3.0],
84 [AM_CFLAGS="$AM_CFLAGS $libsigrok_CFLAGS";
85 LIBS="$LIBS $libsigrok_LIBS"])
87 # libsigrokdecode is always needed.
88 PKG_CHECK_MODULES([libsigrokdecode], [libsigrokdecode >= 0.3.0],
89 [AM_CFLAGS="$AM_CFLAGS $libsigrokdecode_CFLAGS";
90 LIBS="$LIBS $libsigrokdecode_LIBS"])
92 # Checks for header files.
93 AC_CHECK_HEADER([sys/resource.h])
95 AC_SUBST(DECODERS_DIR)
96 AC_SUBST(MAKEFLAGS, '--no-print-directory')
97 AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
102 AC_CONFIG_FILES([Makefile])
107 echo "sigrok-test configuration summary:"
109 echo " - Package version (major.minor.micro): 0.1.0"
110 echo " - Prefix: $prefix"
112 echo "Detected libraries:"
115 if test "x$pyver" = "xnone"; then
116 echo " - (REQUIRED) python >= 3.2: no"
118 echo " - (REQUIRED) python >= 3.2: yes ($pyver)"
121 # Note: This only works for libs with pkg-config integration.
122 for lib in "glib-2.0 >= 2.24.0" "libsigrok >= 0.3.0" "libsigrokdecode >= 0.3.0"; do
124 if `$PKG_CONFIG --exists $lib`; then
125 ver=`$PKG_CONFIG --modversion $lib`
130 echo " - ($optional) $lib: $answer"