]>
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!). |
7eb90f23 | 24 | AC_INIT([libsigrokdecode], [0.4.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 | |
14b42dad UH |
36 | AH_TOP([#ifndef SRD_CONFIG_H |
37 | #define SRD_CONFIG_H /* To stop multiple inclusions. */]) | |
38 | AH_BOTTOM([#endif /* SRD_CONFIG_H */]) | |
a190e979 | 39 | |
a190e979 | 40 | # Checks for programs. |
a190e979 | 41 | AC_PROG_CC |
a190e979 UH |
42 | AC_PROG_INSTALL |
43 | AC_PROG_LN_S | |
44 | ||
7529cdaa UH |
45 | # Required for per-target flags or subdir-objects with C sources. |
46 | AM_PROG_CC_C_O | |
47 | ||
a190e979 UH |
48 | # Initialize libtool. |
49 | LT_INIT | |
50 | ||
7eb90f23 DE |
51 | # Set up the libsigrokdecode version defines. |
52 | SR_PKG_VERSION_SET([SRD_PACKAGE_VERSION], [AC_PACKAGE_VERSION]) | |
a190e979 | 53 | |
a101c52f | 54 | # Library version for libsigrokdecode (NOT the same as the package version). |
a190e979 UH |
55 | # Carefully read the libtool docs before updating these numbers! |
56 | # The algorithm for determining which number to change (and how) is nontrivial! | |
57 | # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info | |
7eb90f23 DE |
58 | SR_LIB_VERSION_SET([SRD_LIB_VERSION], [2:0:0]) |
59 | ||
60 | ############################ | |
61 | ## Package dependencies ## | |
62 | ############################ | |
63 | ||
64 | # Initialize pkg-config. | |
65 | # We require at least 0.22, as "Requires.private" behaviour changed there. | |
66 | PKG_PROG_PKG_CONFIG([0.22]) | |
67 | ||
68 | # Collect the pkg-config module names of all dependencies in SRD_PKGLIBS. | |
69 | # These are used to derive the compiler flags and for the "Requires.private" | |
70 | # field in the generated libsigrokdecode.pc file. | |
71 | SRD_PKGLIBS= | |
a654ef6e | 72 | SRD_PKGLIBS_TESTS= |
7eb90f23 DE |
73 | |
74 | # Keep track of all checked modules so we can list them at the end. | |
75 | SR_PKG_CHECK_SUMMARY([srd_pkglibs_summary]) | |
a190e979 | 76 | |
91c78794 | 77 | # Python 3 is always needed. |
7eb90f23 DE |
78 | SR_PKG_CHECK([python3], [SRD_PKGLIBS], |
79 | [python3 >= 3.2], [python-3.4 >= 3.4], [python-3.3 >= 3.3], [python-3.2 >= 3.2]) | |
80 | AS_IF([test "x$sr_have_python3" = xno], | |
81 | [AC_MSG_ERROR([Cannot find Python 3 development headers.])]) | |
a190e979 | 82 | |
1c0dbcc9 UH |
83 | # We also need to find the name of the python3 executable (for 'make install'). |
84 | # Some OSes call this python3, some call it python3.2, etc. etc. | |
7eb90f23 | 85 | AC_ARG_VAR([PYTHON3], [Python 3 interpreter]) |
1c0dbcc9 | 86 | AC_CHECK_PROGS([PYTHON3], [python3.4 python3.3 python3.2 python3]) |
7eb90f23 DE |
87 | AS_IF([test "x$PYTHON3" = x], |
88 | [AC_MSG_ERROR([Cannot find Python 3 interpreter.])]) | |
1c0dbcc9 | 89 | |
7eb90f23 DE |
90 | ###################### |
91 | ## Feature checks ## | |
92 | ###################### | |
93 | ||
94 | # Keep track of all checked modules so we can list them at the end. | |
95 | SR_PKG_CHECK_SUMMARY([srd_pkglibs_opt_summary]) | |
6af04d5a | 96 | |
7529cdaa | 97 | # The Check unit testing framework is optional. Disable if not found. |
a654ef6e | 98 | SR_PKG_CHECK([check], [SRD_PKGLIBS_TESTS], [check >= 0.9.4]) |
7eb90f23 | 99 | AM_CONDITIONAL([HAVE_CHECK], [test "x$sr_have_check" = xyes]) |
7529cdaa | 100 | |
7eb90f23 DE |
101 | # Enable the C99 standard if possible, and enforce the use |
102 | # of SRD_API to explicitly mark all public API functions. | |
103 | SRD_EXTRA_CFLAGS= | |
104 | SR_CHECK_COMPILE_FLAGS([SRD_EXTRA_CFLAGS], [C99], [-std=c99 -c99 -AC99 -qlanglvl=extc99]) | |
105 | SR_CHECK_COMPILE_FLAGS([SRD_EXTRA_CFLAGS], [visibility], [-fvisibility=hidden]) | |
a190e979 | 106 | |
7eb90f23 DE |
107 | # Select suitable compiler warning flags. |
108 | SR_ARG_ENABLE_WARNINGS([SRD_WFLAGS], [-Wall], [-Wall -Wextra -Wmissing-prototypes]) | |
a190e979 | 109 | |
7eb90f23 DE |
110 | # Link against libm, this is required (among other things) by Python. |
111 | SRD_EXTRA_LIBS= | |
112 | SR_SEARCH_LIBS([SRD_EXTRA_LIBS], [pow], [m]) | |
a101c52f | 113 | |
3a2086f0 DE |
114 | AC_SYS_LARGEFILE |
115 | ||
7eb90f23 DE |
116 | ############################## |
117 | ## Finalize configuration ## | |
118 | ############################## | |
a101c52f | 119 | |
7eb90f23 | 120 | AC_SUBST([SRD_PKGLIBS]) |
11bd6317 | 121 | |
7eb90f23 DE |
122 | # Retrieve the compile and link flags for all modules combined. |
123 | # Also, bail out at this point if any module dependency is not met. | |
124 | PKG_CHECK_MODULES([LIBSIGROKDECODE], [glib-2.0 >= 2.24.0 $SRD_PKGLIBS]) | |
a654ef6e | 125 | PKG_CHECK_MODULES([TESTS], [$SRD_PKGLIBS_TESTS glib-2.0 $SRD_PKGLIBS]) |
a190e979 | 126 | |
7eb90f23 | 127 | srd_glib_version=`$PKG_CONFIG --modversion glib-2.0 2>&AS_MESSAGE_LOG_FD` |
a190e979 | 128 | |
7eb90f23 DE |
129 | AC_CONFIG_FILES([Makefile libsigrokdecode.pc]) |
130 | ||
131 | AC_OUTPUT | |
aa56f7ad | 132 | |
7eb90f23 DE |
133 | cat >&AS_MESSAGE_FD <<_EOF |
134 | ||
135 | libsigrokdecode configuration summary: | |
136 | - Package version................. $SRD_PACKAGE_VERSION | |
137 | - Library ABI version............. $SRD_LIB_VERSION | |
138 | - Prefix.......................... $prefix | |
139 | - Building on..................... $build | |
140 | - Building for.................... $host | |
141 | - Additional C compiler flags..... $SRD_EXTRA_CFLAGS | |
142 | - C compiler warnings............. $SRD_WFLAGS | |
143 | ||
144 | Detected libraries (required): | |
145 | - glib-2.0 >= 2.24.0.............. $srd_glib_version | |
146 | $srd_pkglibs_summary | |
147 | Detected libraries (optional): | |
148 | $srd_pkglibs_opt_summary | |
149 | _EOF |