]>
Commit | Line | Data |
---|---|---|
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 | AC_PREREQ(2.61) | |
21 | ||
22 | # TODO: Should be libsigrokdecode, not sigrok. | |
23 | m4_define([sigrok_major_version], [0]) | |
24 | m4_define([sigrok_minor_version], [2]) | |
25 | m4_define([sigrok_micro_version], [0]) | |
26 | m4_define([sigrok_version], | |
27 | [sigrok_major_version.sigrok_minor_version.sigrok_micro_version]) | |
28 | ||
29 | AC_INIT([libsigrokdecode], [libsigrokdecode_version], | |
30 | [sigrok-devel@lists.sourceforge.net], [libsigrokdecode], | |
31 | [http://www.sigrok.org]) | |
32 | AC_CONFIG_HEADER([config.h]) | |
33 | AC_CONFIG_MACRO_DIR([m4]) | |
34 | ||
35 | AM_INIT_AUTOMAKE([-Wall -Werror foreign std-options]) | |
36 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | |
37 | ||
38 | AH_TOP([#ifndef LIBSIGROKDECODE_CONFIG_H | |
39 | #define LIBSIGROKDECODE_CONFIG_H /* To stop multiple inclusions. */]) | |
40 | AH_BOTTOM([#endif /* LIBSIGROKDECODE_CONFIG_H */]) | |
41 | ||
42 | CFLAGS="-g -Wall -Wextra" | |
43 | ||
44 | # Checks for programs. | |
45 | AC_PROG_CXX | |
46 | AC_PROG_CC | |
47 | AC_PROG_CPP | |
48 | AC_PROG_INSTALL | |
49 | AC_PROG_LN_S | |
50 | ||
51 | # Initialize libtool. | |
52 | LT_INIT | |
53 | ||
54 | # Initialize pkg-config. | |
55 | # We require at least 0.22, as "Requires.private" behaviour changed there. | |
56 | PKG_PROG_PKG_CONFIG([0.22]) | |
57 | ||
58 | # Library version for libsigrokdecode. | |
59 | # Carefully read the libtool docs before updating these numbers! | |
60 | # The algorithm for determining which number to change (and how) is nontrivial! | |
61 | # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info | |
62 | SIGROKDECODE_LT_CURRENT=0 | |
63 | SIGROKDECODE_LT_REVISION=0 | |
64 | SIGROKDECODE_LT_AGE=0 | |
65 | SIGROKDECODE_LT_VERSION="$SIGROKDECODE_LT_CURRENT:$SIGROKDECODE_LT_REVISION:$SIGROKDECODE_LT_AGE" | |
66 | SIGROKDECODE_LT_LDFLAGS="-version-info $SIGROKDECODE_LT_VERSION" | |
67 | AC_SUBST(SIGROKDECODE_LT_LDFLAGS) | |
68 | ||
69 | # Checks for libraries. | |
70 | ||
71 | # libglib-2.0 is always needed. | |
72 | # Note: glib-2.0 is part of the libsigrokdecode API | |
73 | # (hard pkg-config requirement). | |
74 | AM_PATH_GLIB_2_0([2.22.0], | |
75 | [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"]) | |
76 | ||
77 | # Python support. | |
78 | CPPFLAGS_PYTHON="" | |
79 | LDFLAGS_PYTHON="" | |
80 | case "$build" in | |
81 | *linux*) | |
82 | # We know that Linux has 'python3-config'. | |
83 | CPPFLAGS_PYTHON="$(python3-config --includes)" | |
84 | LDFLAGS_PYTHON="$(python3-config --ldflags)" | |
85 | ;; | |
86 | *darwin*) | |
87 | # On Darwin, Macports has python3.x-config, fink has python3-config. | |
88 | # Mac OS X (Snow Leopard) ships with 'python-config' per default, but | |
89 | # that's Python 2.x, so not useful for us. | |
90 | if test -x python3-config; then | |
91 | # python3-config exists, use it. | |
92 | CPPFLAGS_PYTHON="$(python3-config --includes)" | |
93 | LDFLAGS_PYTHON="$(python3-config --ldflags)" | |
94 | else | |
95 | # No python3-config found, so try hardcoded python3.2-config. | |
96 | CPPFLAGS_PYTHON="$(python3.2-config --includes)" | |
97 | LDFLAGS_PYTHON="$(python3.2-config --ldflags)" | |
98 | fi | |
99 | ;; | |
100 | *mingw*) | |
101 | # We currently hardcode the paths to the Python 3.2 default install | |
102 | # location as there's no 'python-config' script on Windows, it seems. | |
103 | CPPFLAGS_PYTHON="-I/c/Python32/include" | |
104 | LDFLAGS_PYTHON="-L/c/Python32/libs -lpython32" | |
105 | ;; | |
106 | *) | |
107 | # Everything else is untested, we just hope 'python3-config' works. | |
108 | CPPFLAGS_PYTHON="$(python3-config --includes)" | |
109 | LDFLAGS_PYTHON="$(python3-config --ldflags)" | |
110 | ;; | |
111 | esac | |
112 | AC_SUBST(CPPFLAGS_PYTHON) | |
113 | AC_SUBST(LDFLAGS_PYTHON) | |
114 | ||
115 | # Checks for header files. | |
116 | # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h. | |
117 | AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h]) | |
118 | ||
119 | # Checks for typedefs, structures, and compiler characteristics. | |
120 | AC_C_INLINE | |
121 | AC_TYPE_INT8_T | |
122 | AC_TYPE_INT16_T | |
123 | AC_TYPE_INT32_T | |
124 | AC_TYPE_INT64_T | |
125 | AC_TYPE_UINT8_T | |
126 | AC_TYPE_UINT16_T | |
127 | AC_TYPE_UINT32_T | |
128 | AC_TYPE_UINT64_T | |
129 | AC_TYPE_SIZE_T | |
130 | ||
131 | # Checks for library functions. | |
132 | AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull]) | |
133 | ||
134 | AC_SUBST(DECODERS_DIR, "$datadir/sigrok/decoders") | |
135 | AC_SUBST(MAKEFLAGS, '--no-print-directory') | |
136 | AC_SUBST(AM_LIBTOOLFLAGS, '--silent') | |
137 | ||
138 | SIGROK_MAJOR_VERSION=sigrok_major_version | |
139 | SIGROK_MINOR_VERSION=sigrok_minor_version | |
140 | SIGROK_MICRO_VERSION=sigrok_micro_version | |
141 | SIGROK_VERSION=sigrok_version | |
142 | ||
143 | AC_SUBST(SIGROK_MAJOR_VERSION) | |
144 | AC_SUBST(SIGROK_MINOR_VERSION) | |
145 | AC_SUBST(SIGROK_MICRO_VERSION) | |
146 | AC_SUBST(SIGROK_VERSION) | |
147 | ||
148 | AC_DEFINE(SIGROK_MAJOR_VERSION, [sigrok_major_version], | |
149 | [Define to the sigrok major version]) | |
150 | AC_DEFINE(SIGROK_MINOR_VERSION, [sigrok_minor_version], | |
151 | [Define to the sigrok minor version]) | |
152 | AC_DEFINE(SIGROK_MICRO_VERSION, [sigrok_micro_version], | |
153 | [Define to the sigrok micro version]) | |
154 | AC_DEFINE(SIGROK_VERSION, [sigrok_version], | |
155 | [Define to the sigrok version]) | |
156 | ||
157 | AC_CONFIG_FILES([Makefile | |
158 | libsigrokdecode.pc | |
159 | decoders/Makefile | |
160 | ]) | |
161 | ||
162 | AC_OUTPUT | |
163 |