]>
Commit | Line | Data |
---|---|---|
dd37a782 UH |
1 | ## |
2 | ## This file is part of the sigrok-test project. | |
3 | ## | |
4 | ## Copyright (C) 2010 Bert Vermeulen <bert@biot.com> | |
5 | ## Copyright (C) 2014 Uwe Hermann <uwe@hermann-uwe.de> | |
6 | ## | |
7 | ## This program is free software: you can redistribute it and/or modify | |
8 | ## it under the terms of the GNU General Public License as published by | |
9 | ## the Free Software Foundation, either version 3 of the License, or | |
10 | ## (at your option) any later version. | |
11 | ## | |
12 | ## This program is distributed in the hope that it will be useful, | |
13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ## GNU General Public License for more details. | |
16 | ## | |
17 | ## You should have received a copy of the GNU General Public License | |
18 | ## along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | ## | |
20 | ||
21 | # We require at least autoconf 2.63 (AC_INIT format changed there). | |
22 | AC_PREREQ([2.63]) | |
23 | ||
24 | AC_INIT([sigrok-test], [0.1.0], [sigrok-devel@lists.sourceforge.net], | |
25 | [sigrok-test], [http://www.sigrok.org]) | |
8189d812 DE |
26 | AC_CONFIG_MACRO_DIR([m4]) |
27 | AC_CONFIG_AUX_DIR([autostuff]) | |
c0aa6cc1 | 28 | AC_CONFIG_HEADERS([config.h]) |
dd37a782 UH |
29 | |
30 | # We require at least automake 1.11 (needed for 'silent rules'). | |
8189d812 DE |
31 | AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define subdir-objects check-news]) |
32 | AM_SILENT_RULES([yes]) | |
dd37a782 | 33 | |
8189d812 | 34 | AC_CANONICAL_HOST |
dd37a782 UH |
35 | |
36 | # Checks for programs. | |
37 | AC_PROG_CC | |
38 | ||
39 | # Required for per-target flags or subdir-objects with C sources. | |
40 | AM_PROG_CC_C_O | |
41 | ||
8189d812 DE |
42 | # Get compiler versions. |
43 | SR_PROG_VERSION([$CC], [st_cc_version]) | |
44 | ||
45 | ############################ | |
46 | ## Package dependencies ## | |
47 | ############################ | |
48 | ||
dd37a782 UH |
49 | # Initialize pkg-config. |
50 | # We require at least 0.22, as "Requires.private" behaviour changed there. | |
51 | PKG_PROG_PKG_CONFIG([0.22]) | |
52 | ||
8189d812 DE |
53 | # Keep track of all checked modules so we can list them at the end. |
54 | ST_PKGLIBS= | |
55 | SR_PKG_CHECK_SUMMARY([st_pkglibs_summary]) | |
dd37a782 | 56 | |
8189d812 | 57 | # Python 3 is always needed. |
2064a252 UH |
58 | # Starting with Python 3.8 we need to check for "python-3.8-embed" |
59 | # first, since usually only that variant will add "-lpython3.8". | |
60 | # https://docs.python.org/3/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build | |
8189d812 | 61 | SR_PKG_CHECK([python3], [ST_PKGLIBS], |
7d8cfad0 GS |
62 | [python-3.8-embed], [python3-embed], |
63 | [python-3.8 >= 3.8], [python-3.7 >= 3.7], [python-3.6 >= 3.6], | |
64 | [python-3.5 >= 3.5], [python-3.4 >= 3.4], [python-3.3 >= 3.3], | |
65 | [python-3.2 >= 3.2], [python3 >= 3.2]) | |
8189d812 DE |
66 | AS_IF([test "x$sr_have_python3" = xno], |
67 | [AC_MSG_ERROR([Cannot find Python 3 development headers.])]) | |
dd37a782 | 68 | |
8189d812 DE |
69 | ###################### |
70 | ## Feature checks ## | |
71 | ###################### | |
dd37a782 | 72 | |
8189d812 | 73 | AC_LANG([C]) |
dd37a782 | 74 | |
8189d812 DE |
75 | # Enable the C99 standard if possible. |
76 | ST_EXTRA_CFLAGS= | |
77 | SR_CHECK_COMPILE_FLAGS([ST_EXTRA_CFLAGS], [C99], | |
78 | [-std=c99 -c99 -AC99 -qlanglvl=extc99]) | |
dd37a782 | 79 | |
8189d812 DE |
80 | SR_ARG_ENABLE_WARNINGS([ST_WFLAGS], |
81 | [-Wall], [-Wall -Wextra -Wmissing-prototypes]) | |
dd37a782 | 82 | |
8189d812 DE |
83 | # Check host characteristics. |
84 | AC_SYS_LARGEFILE | |
dd37a782 | 85 | |
8189d812 DE |
86 | # Checks for header files. |
87 | AC_CHECK_HEADER([sys/resource.h],, | |
88 | [AC_MSG_ERROR([Missing required header sys/resource.h])]) | |
89 | ||
90 | ############################## | |
91 | ## Finalize configuration ## | |
92 | ############################## | |
93 | ||
94 | # Retrieve the compile and link flags for all modules combined. | |
95 | # Also, bail out at this point if any module dependency is not met. | |
c0aa6cc1 | 96 | # Check availability of library version dependent features. |
8189d812 | 97 | PKG_CHECK_MODULES([SIGROK_TEST], |
df62f6f3 | 98 | [glib-2.0 >= 2.24.0 libsigrok >= 0.5.0 libsigrokdecode >= 0.5.0 $ST_PKGLIBS]) |
c0aa6cc1 GS |
99 | AC_LANG([C]) |
100 | st_save_cflags=$CFLAGS | |
101 | st_save_libs=$LIBS | |
102 | CFLAGS="$SIGROK_TEST_CFLAGS $CFLAGS" | |
103 | LIBS="$SIGROK_TEST_LIBS $LIBS" | |
104 | AC_CHECK_FUNCS([srd_session_send_eof]) | |
105 | CFLAGS=$st_save_cflags | |
106 | LIBS=$st_save_libs | |
8189d812 DE |
107 | |
108 | # Allow the user to override the location of the protocol decoders. | |
109 | AC_ARG_WITH([decodersdir], | |
110 | [AS_HELP_STRING([--with-decodersdir=DIR], | |
111 | [specify location of protcol decoders [default=auto]])], | |
112 | [st_decodersdir=$withval], [st_decodersdir=auto]) | |
113 | ||
114 | AS_IF([test "x$st_decodersdir" = xauto], [ | |
115 | st_decodersdir=`$PKG_CONFIG --variable=decodersdir libsigrokdecode 2>&AS_MESSAGE_LOG_FD` | |
116 | AS_IF([test "[$]?" != 0 || test -z "$st_decodersdir"], | |
117 | [st_decodersdir='$(datadir)/libsigrokdecode/decoders']) | |
118 | ]) | |
119 | AC_SUBST([DECODERS_DIR], [$st_decodersdir]) | |
120 | ||
121 | st_glib_version=`$PKG_CONFIG --modversion glib-2.0 2>&AS_MESSAGE_LOG_FD` | |
122 | st_libsigrok_version=`$PKG_CONFIG --modversion libsigrok 2>&AS_MESSAGE_LOG_FD` | |
123 | st_libsigrokdecode_version=`$PKG_CONFIG --modversion libsigrokdecode 2>&AS_MESSAGE_LOG_FD` | |
dd37a782 | 124 | |
8189d812 | 125 | AC_CONFIG_FILES([Makefile]) |
dd37a782 UH |
126 | AC_OUTPUT |
127 | ||
8189d812 DE |
128 | cat >&AS_MESSAGE_FD <<_EOF |
129 | ||
130 | sigrok-test configuration summary: | |
131 | - Package version................. $PACKAGE_VERSION | |
132 | - Prefix.......................... $prefix | |
133 | - Decoders directory.............. $st_decodersdir | |
134 | - Building on..................... $build | |
135 | - Building for.................... $host | |
136 | ||
137 | Compile configuration: | |
138 | - C compiler...................... $CC | |
139 | - C compiler version.............. $st_cc_version | |
140 | - C compiler flags................ $CFLAGS | |
141 | - Additional C compiler flags..... $ST_EXTRA_CFLAGS | |
142 | - C compiler warnings............. $ST_WFLAGS | |
2dbe278c | 143 | - Linker flags.................... $LDFLAGS |
8189d812 DE |
144 | |
145 | Detected libraries (required): | |
146 | - glib-2.0 >= 2.24.0.............. $st_glib_version | |
df62f6f3 UH |
147 | - libsigrok >= 0.5.0.............. $st_libsigrok_version |
148 | - libsigrokdecode >= 0.5.0........ $st_libsigrokdecode_version | |
8189d812 DE |
149 | $st_pkglibs_summary |
150 | _EOF |