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