]> sigrok.org Git - libsigrokdecode.git/blame - configure.ac
srd: UART: Add more aliases, report invalid bits.
[libsigrokdecode.git] / configure.ac
CommitLineData
a190e979
UH
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
81eb8e80 20AC_PREREQ([2.61])
a190e979 21
a101c52f
UH
22# libsigrokdecode package version number (NOT the same as shared lib version!).
23m4_define([libsigrokdecode_major_version], [0])
24m4_define([libsigrokdecode_minor_version], [2])
25m4_define([libsigrokdecode_micro_version], [0])
26m4_define([libsigrokdecode_version],
27 [libsigrokdecode_major_version.libsigrokdecode_minor_version.libsigrokdecode_micro_version])
a190e979 28
2891e1bc
UH
29AC_INIT([libsigrokdecode], [libsigrokdecode_version],
30 [sigrok-devel@lists.sourceforge.net], [libsigrokdecode],
31 [http://www.sigrok.org])
a190e979 32AC_CONFIG_HEADER([config.h])
087d133d
UH
33AC_CONFIG_MACRO_DIR([autostuff])
34AC_CONFIG_AUX_DIR([autostuff])
a190e979
UH
35
36AM_INIT_AUTOMAKE([-Wall -Werror foreign std-options])
37m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
38
2891e1bc
UH
39AH_TOP([#ifndef LIBSIGROKDECODE_CONFIG_H
40#define LIBSIGROKDECODE_CONFIG_H /* To stop multiple inclusions. */])
41AH_BOTTOM([#endif /* LIBSIGROKDECODE_CONFIG_H */])
a190e979
UH
42
43CFLAGS="-g -Wall -Wextra"
44
45# Checks for programs.
46AC_PROG_CXX
47AC_PROG_CC
48AC_PROG_CPP
49AC_PROG_INSTALL
50AC_PROG_LN_S
51
52# Initialize libtool.
53LT_INIT
54
55# Initialize pkg-config.
56# We require at least 0.22, as "Requires.private" behaviour changed there.
57PKG_PROG_PKG_CONFIG([0.22])
58
a101c52f 59# Library version for libsigrokdecode (NOT the same as the package version).
a190e979
UH
60# Carefully read the libtool docs before updating these numbers!
61# The algorithm for determining which number to change (and how) is nontrivial!
62# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
a101c52f
UH
63LIBSIGROKDECODE_LT_CURRENT=0
64LIBSIGROKDECODE_LT_REVISION=0
65LIBSIGROKDECODE_LT_AGE=0
66LIBSIGROKDECODE_LT_VERSION="$LIBSIGROKDECODE_LT_CURRENT:$LIBSIGROKDECODE_LT_REVISION:$LIBSIGROKDECODE_LT_AGE"
67LIBSIGROKDECODE_LT_LDFLAGS="-version-info $LIBSIGROKDECODE_LT_VERSION"
68AC_SUBST(LIBSIGROKDECODE_LT_LDFLAGS)
a190e979 69
a190e979
UH
70# Checks for libraries.
71
a190e979 72# libglib-2.0 is always needed.
2891e1bc
UH
73# Note: glib-2.0 is part of the libsigrokdecode API
74# (hard pkg-config requirement).
a190e979 75AM_PATH_GLIB_2_0([2.22.0],
2891e1bc 76 [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
a190e979 77
084f0f94 78# Python support. We require at least Python >= 3.0.
b67eb0bd
UH
79AC_ARG_VAR([PYTHON3_CONFIG], [path to python3-config utility])
80AC_CHECK_PROGS([PYTHON3_CONFIG], [python3-config python3.2-config python3.1-config python3.0-config])
a190e979
UH
81CPPFLAGS_PYTHON=""
82LDFLAGS_PYTHON=""
83case "$build" in
a190e979
UH
84*mingw*)
85 # We currently hardcode the paths to the Python 3.2 default install
86 # location as there's no 'python-config' script on Windows, it seems.
b67eb0bd 87 AC_MSG_WARN([using hardcoded Python3 configuration on MinGW])
a190e979
UH
88 CPPFLAGS_PYTHON="-I/c/Python32/include"
89 LDFLAGS_PYTHON="-L/c/Python32/libs -lpython32"
90 ;;
91*)
631b080a
RC
92 # We know that Linux has 'python3-config'.
93 # On Darwin, Macports has python3.x-config, fink has python3-config.
94 # Mac OS X (Snow Leopard) ships with 'python-config' per default, but
95 # that's Python 2.x, so not useful for us.
b67eb0bd
UH
96 # Everything else is untested, we just hope 'PYTHON3_CONFIG' works.
97 if test -n "$PYTHON3_CONFIG"; then
98 CPPFLAGS_PYTHON="$($PYTHON3_CONFIG --includes)"
99 LDFLAGS_PYTHON="$($PYTHON3_CONFIG --ldflags)"
631b080a
RC
100 else
101 AC_MSG_ERROR([python3-config not found])
102 fi
a190e979
UH
103 ;;
104esac
105AC_SUBST(CPPFLAGS_PYTHON)
106AC_SUBST(LDFLAGS_PYTHON)
107
a190e979
UH
108# Checks for header files.
109# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
81eb8e80 110# AC_CHECK_HEADERS([])
a190e979
UH
111
112# Checks for typedefs, structures, and compiler characteristics.
113AC_C_INLINE
114AC_TYPE_INT8_T
115AC_TYPE_INT16_T
116AC_TYPE_INT32_T
117AC_TYPE_INT64_T
118AC_TYPE_UINT8_T
119AC_TYPE_UINT16_T
120AC_TYPE_UINT32_T
121AC_TYPE_UINT64_T
122AC_TYPE_SIZE_T
123
124# Checks for library functions.
81eb8e80 125AC_CHECK_FUNCS([memset strtoull])
a190e979 126
066e65a3 127AC_SUBST(DECODERS_DIR, "$datadir/libsigrokdecode/decoders")
a190e979
UH
128AC_SUBST(MAKEFLAGS, '--no-print-directory')
129AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
130
a101c52f
UH
131LIBSIGROKDECODE_MAJOR_VERSION=libsigrokdecode_major_version
132LIBSIGROKDECODE_MINOR_VERSION=libsigrokdecode_minor_version
133LIBSIGROKDECODE_MICRO_VERSION=libsigrokdecode_micro_version
134LIBSIGROKDECODE_VERSION=libsigrokdecode_version
135
136AC_SUBST(LIBSIGROKDECODE_MAJOR_VERSION)
137AC_SUBST(LIBSIGROKDECODE_MINOR_VERSION)
138AC_SUBST(LIBSIGROKDECODE_MICRO_VERSION)
139AC_SUBST(LIBSIGROKDECODE_VERSION)
140
141AC_DEFINE(LIBSIGROKDECODE_MAJOR_VERSION, [libsigrokdecode_major_version],
142 [Define to the libsigrokdecode major package version])
143AC_DEFINE(LIBSIGROKDECODE_MINOR_VERSION, [libsigrokdecode_minor_version],
144 [Define to the libsigrokdecode minor package version])
145AC_DEFINE(LIBSIGROKDECODE_MICRO_VERSION, [libsigrokdecode_micro_version],
146 [Define to the libsigrokdecode micro package version])
147AC_DEFINE(LIBSIGROKDECODE_VERSION, [libsigrokdecode_version],
148 [Define to the libsigrokdecode package version])
a190e979
UH
149
150AC_CONFIG_FILES([Makefile
2891e1bc
UH
151 libsigrokdecode.pc
152 decoders/Makefile
a190e979
UH
153 ])
154
155AC_OUTPUT
156
aa56f7ad
UH
157echo
158echo "libsigrokdecode configuration summary:"
159echo
160echo " - Package version (major.minor.micro): $LIBSIGROKDECODE_VERSION"
161echo " - Library version (current:revision:age): $LIBSIGROKDECODE_LT_VERSION"
162echo " - Prefix: $prefix"
163echo
164echo "Detected libraries:"
165echo
166
167# Note: This only works for libs with pkg-config integration.
168for lib in "glib-2.0"; do
169 if `$PKG_CONFIG --exists $lib`; then
170 ver=`$PKG_CONFIG --modversion $lib`
171 answer="yes ($ver)"
172 else
173 answer="no"
174 fi
175 echo " - $lib: $answer"
176done
177
178echo
179echo "Detected Python:"
180echo
181echo " - Python CPPFLAGS: $CPPFLAGS_PYTHON"
182echo " - Python LDFLAGS: $LDFLAGS_PYTHON"
183echo
184