]>
Commit | Line | Data |
---|---|---|
a190e979 | 1 | ## |
50bd5d25 | 2 | ## This file is part of the libsigrokdecode project. |
a190e979 UH |
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 | ||
066ecdab UH |
20 | # We require at least autoconf 2.63 (AC_INIT format changed there). |
21 | AC_PREREQ([2.63]) | |
a190e979 | 22 | |
a101c52f | 23 | # libsigrokdecode package version number (NOT the same as shared lib version!). |
d9a77d2e | 24 | AC_INIT([libsigrokdecode], [0.6.0], |
2891e1bc UH |
25 | [sigrok-devel@lists.sourceforge.net], [libsigrokdecode], |
26 | [http://www.sigrok.org]) | |
7eb90f23 | 27 | AC_CONFIG_MACRO_DIR([m4]) |
087d133d | 28 | AC_CONFIG_AUX_DIR([autostuff]) |
7eb90f23 | 29 | AC_CONFIG_HEADERS([config.h version.h]) |
a190e979 | 30 | |
066ecdab | 31 | # We require at least automake 1.11 (needed for 'silent rules'). |
7eb90f23 DE |
32 | AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define subdir-objects check-news color-tests]) |
33 | AM_SILENT_RULES([yes]) | |
bdd820e3 | 34 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
a190e979 | 35 | |
9576e005 DE |
36 | AC_CANONICAL_HOST |
37 | ||
a190e979 | 38 | # Checks for programs. |
a190e979 | 39 | AC_PROG_CC |
a190e979 UH |
40 | AC_PROG_INSTALL |
41 | AC_PROG_LN_S | |
42 | ||
43426897 GS |
43 | AC_C_CONST |
44 | ||
7529cdaa UH |
45 | # Required for per-target flags or subdir-objects with C sources. |
46 | AM_PROG_CC_C_O | |
47 | ||
650f1946 GS |
48 | # Support building Windows DLLs. |
49 | AC_LIBTOOL_WIN32_DLL | |
50 | AM_PROG_CC_STDC | |
51 | AM_PROG_LIBTOOL | |
52 | ||
fdfc532e DE |
53 | # Set the standard the C library headers should conform to. |
54 | AH_VERBATIM([_POSIX_C_SOURCE], [/* The targeted POSIX standard. */ | |
55 | #ifndef _POSIX_C_SOURCE | |
56 | # define _POSIX_C_SOURCE 200112L | |
57 | #endif]) | |
58 | ||
9576e005 DE |
59 | # Get compiler versions. |
60 | SR_PROG_VERSION([$CC], [srd_cc_version]) | |
61 | ||
a190e979 UH |
62 | # Initialize libtool. |
63 | LT_INIT | |
64 | ||
7eb90f23 DE |
65 | # Set up the libsigrokdecode version defines. |
66 | SR_PKG_VERSION_SET([SRD_PACKAGE_VERSION], [AC_PACKAGE_VERSION]) | |
a190e979 | 67 | |
a101c52f | 68 | # Library version for libsigrokdecode (NOT the same as the package version). |
a190e979 UH |
69 | # Carefully read the libtool docs before updating these numbers! |
70 | # The algorithm for determining which number to change (and how) is nontrivial! | |
71 | # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info | |
b144d635 | 72 | # Format: current:revision:age. |
1ac02afa | 73 | SR_LIB_VERSION_SET([SRD_LIB_VERSION], [4:0:0]) |
7eb90f23 | 74 | |
583001b3 DE |
75 | AM_CONDITIONAL([WIN32], [test -z "${host_os##mingw*}" || test -z "${host_os##cygwin*}"]) |
76 | ||
0173a8ba GS |
77 | # Initialize pkg-config. |
78 | # We require at least 0.22, as "Requires.private" behaviour changed there. | |
79 | PKG_PROG_PKG_CONFIG | |
80 | ||
7eb90f23 DE |
81 | ############################ |
82 | ## Package dependencies ## | |
83 | ############################ | |
84 | ||
85 | # Initialize pkg-config. | |
86 | # We require at least 0.22, as "Requires.private" behaviour changed there. | |
87 | PKG_PROG_PKG_CONFIG([0.22]) | |
88 | ||
89 | # Collect the pkg-config module names of all dependencies in SRD_PKGLIBS. | |
90 | # These are used to derive the compiler flags and for the "Requires.private" | |
91 | # field in the generated libsigrokdecode.pc file. | |
92 | SRD_PKGLIBS= | |
a654ef6e | 93 | SRD_PKGLIBS_TESTS= |
7eb90f23 DE |
94 | |
95 | # Keep track of all checked modules so we can list them at the end. | |
96 | SR_PKG_CHECK_SUMMARY([srd_pkglibs_summary]) | |
a190e979 | 97 | |
91c78794 | 98 | # Python 3 is always needed. |
afae4fa6 UH |
99 | # Starting with Python 3.8 we need to check for "python-3.8-embed" |
100 | # first, since usually only that variant will add "-lpython3.8". | |
101 | # https://docs.python.org/3/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build | |
7eb90f23 | 102 | SR_PKG_CHECK([python3], [SRD_PKGLIBS], |
afae4fa6 | 103 | [python-3.8-embed], [python-3.8 >= 3.8], [python-3.7 >= 3.7], [python-3.6 >= 3.6], [python-3.5 >= 3.5], [python-3.4 >= 3.4], [python-3.3 >= 3.3], [python-3.2 >= 3.2], [python3 >= 3.2]) |
7eb90f23 DE |
104 | AS_IF([test "x$sr_have_python3" = xno], |
105 | [AC_MSG_ERROR([Cannot find Python 3 development headers.])]) | |
a190e979 | 106 | |
1c0dbcc9 UH |
107 | # We also need to find the name of the python3 executable (for 'make install'). |
108 | # Some OSes call this python3, some call it python3.2, etc. etc. | |
7eb90f23 | 109 | AC_ARG_VAR([PYTHON3], [Python 3 interpreter]) |
afae4fa6 | 110 | AC_CHECK_PROGS([PYTHON3], [python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3]) |
7eb90f23 DE |
111 | AS_IF([test "x$PYTHON3" = x], |
112 | [AC_MSG_ERROR([Cannot find Python 3 interpreter.])]) | |
1c0dbcc9 | 113 | |
7eb90f23 DE |
114 | ###################### |
115 | ## Feature checks ## | |
116 | ###################### | |
117 | ||
118 | # Keep track of all checked modules so we can list them at the end. | |
119 | SR_PKG_CHECK_SUMMARY([srd_pkglibs_opt_summary]) | |
6af04d5a | 120 | |
7529cdaa | 121 | # The Check unit testing framework is optional. Disable if not found. |
a654ef6e | 122 | SR_PKG_CHECK([check], [SRD_PKGLIBS_TESTS], [check >= 0.9.4]) |
7eb90f23 | 123 | AM_CONDITIONAL([HAVE_CHECK], [test "x$sr_have_check" = xyes]) |
7529cdaa | 124 | |
7eb90f23 DE |
125 | # Enable the C99 standard if possible, and enforce the use |
126 | # of SRD_API to explicitly mark all public API functions. | |
127 | SRD_EXTRA_CFLAGS= | |
128 | SR_CHECK_COMPILE_FLAGS([SRD_EXTRA_CFLAGS], [C99], [-std=c99 -c99 -AC99 -qlanglvl=extc99]) | |
129 | SR_CHECK_COMPILE_FLAGS([SRD_EXTRA_CFLAGS], [visibility], [-fvisibility=hidden]) | |
a190e979 | 130 | |
7eb90f23 | 131 | # Select suitable compiler warning flags. |
d652ef84 | 132 | SR_ARG_ENABLE_WARNINGS([SRD_WFLAGS], [-Wall], [-Wall -Wextra -Wmissing-prototypes -Wshadow -Wformat=2 -Wno-format-nonliteral -Wfloat-equal]) |
a190e979 | 133 | |
7eb90f23 DE |
134 | # Link against libm, this is required (among other things) by Python. |
135 | SRD_EXTRA_LIBS= | |
136 | SR_SEARCH_LIBS([SRD_EXTRA_LIBS], [pow], [m]) | |
a101c52f | 137 | |
3a2086f0 DE |
138 | AC_SYS_LARGEFILE |
139 | ||
35716e66 JH |
140 | AC_C_BIGENDIAN |
141 | ||
650f1946 GS |
142 | ######################### |
143 | ## Optional features. ## | |
144 | ######################### | |
145 | ||
146 | # Enable IRMP support by default. Accept user overrides. | |
147 | AC_ARG_ENABLE([irmp], | |
148 | [AS_HELP_STRING([--enable-irmp], [enable IRMP shared object [default=yes]])], | |
149 | [], [enable_irmp_so=yes]) | |
150 | AM_CONDITIONAL([WITH_IRMP], [test "x$enable_irmp_so" = "xyes"]) | |
151 | test -n "$enable_irmp_so" || enable_irmp_so=no | |
152 | ||
7eb90f23 DE |
153 | ############################## |
154 | ## Finalize configuration ## | |
155 | ############################## | |
a101c52f | 156 | |
7eb90f23 | 157 | AC_SUBST([SRD_PKGLIBS]) |
11bd6317 | 158 | |
7eb90f23 DE |
159 | # Retrieve the compile and link flags for all modules combined. |
160 | # Also, bail out at this point if any module dependency is not met. | |
1a41642e | 161 | PKG_CHECK_MODULES([LIBSIGROKDECODE], [glib-2.0 >= 2.34 $SRD_PKGLIBS]) |
a654ef6e | 162 | PKG_CHECK_MODULES([TESTS], [$SRD_PKGLIBS_TESTS glib-2.0 $SRD_PKGLIBS]) |
a190e979 | 163 | |
7eb90f23 | 164 | srd_glib_version=`$PKG_CONFIG --modversion glib-2.0 2>&AS_MESSAGE_LOG_FD` |
a190e979 | 165 | |
cdb49509 UH |
166 | AC_DEFINE_UNQUOTED([CONF_HOST], ["$host"], |
167 | [The canonical host libsigrokdecode will run on.]) | |
168 | ||
7eb90f23 DE |
169 | AC_CONFIG_FILES([Makefile libsigrokdecode.pc]) |
170 | ||
171 | AC_OUTPUT | |
aa56f7ad | 172 | |
7eb90f23 DE |
173 | cat >&AS_MESSAGE_FD <<_EOF |
174 | ||
175 | libsigrokdecode configuration summary: | |
176 | - Package version................. $SRD_PACKAGE_VERSION | |
177 | - Library ABI version............. $SRD_LIB_VERSION | |
178 | - Prefix.......................... $prefix | |
179 | - Building on..................... $build | |
180 | - Building for.................... $host | |
75ee2693 | 181 | - Building shared / static........ $enable_shared / $enable_static |
9576e005 DE |
182 | |
183 | Compile configuration: | |
a4b5d9a9 | 184 | - C compiler...................... $CC |
9576e005 | 185 | - C compiler version.............. $srd_cc_version |
a4b5d9a9 | 186 | - C compiler flags................ $CFLAGS |
7eb90f23 DE |
187 | - Additional C compiler flags..... $SRD_EXTRA_CFLAGS |
188 | - C compiler warnings............. $SRD_WFLAGS | |
1ec8b3ac | 189 | - Linker flags.................... $LDFLAGS |
7eb90f23 DE |
190 | |
191 | Detected libraries (required): | |
1a41642e | 192 | - glib-2.0 >= 2.34................ $srd_glib_version |
7eb90f23 DE |
193 | $srd_pkglibs_summary |
194 | Detected libraries (optional): | |
195 | $srd_pkglibs_opt_summary | |
650f1946 GS |
196 | Optional features: |
197 | - IRMP support library .......... $enable_irmp_so | |
7eb90f23 | 198 | _EOF |