]>
Commit | Line | Data |
---|---|---|
1 | dnl configure.ac --- autoconf input file for systemtap | |
2 | dnl Process this file with autoconf to produce a configure script. | |
3 | ||
4 | AC_INIT([systemtap],[5.2],[systemtap@sourceware.org],[systemtap]) | |
5 | dnl ^^^ see also NEWS, systemtap.spec, testsuite/configure.ac | |
6 | dnl doc/SystemTap_Beginners_Guide/en-US/Book_Info.xml | |
7 | ||
8 | dnl Get the target arch for libHelperSDT.so | |
9 | AC_CANONICAL_TARGET | |
10 | ||
11 | AC_PREREQ([2.71]) | |
12 | dnl We don't maintain a ChangeLog, which makes us non-GNU -> foreign. | |
13 | AM_INIT_AUTOMAKE([no-dist foreign]) | |
14 | AM_MAINTAINER_MODE | |
15 | ||
16 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) | |
17 | ||
18 | PKG_PROG_PKG_CONFIG | |
19 | AC_USE_SYSTEM_EXTENSIONS | |
20 | AC_PROG_MKDIR_P | |
21 | AC_SUBST(MKDIR_P) | |
22 | AC_PROG_LN_S | |
23 | AC_PROG_CC | |
24 | AC_PROG_CXX | |
25 | AC_PROG_CPP | |
26 | AM_PROG_AR | |
27 | AM_PROG_CC_C_O | |
28 | AC_PROG_RANLIB | |
29 | AC_OBJEXT | |
30 | AC_EXEEXT | |
31 | AC_PROG_INSTALL | |
32 | AC_PROG_MAKE_SET | |
33 | AC_SUBST(CFLAGS) | |
34 | AC_SUBST(CXXFLAGS) | |
35 | AC_SYS_LARGEFILE | |
36 | AC_CHECK_FUNCS(ppoll) | |
37 | AC_CHECK_FUNCS(openat) | |
38 | AM_GNU_GETTEXT(external) | |
39 | AM_GNU_GETTEXT_VERSION([0.19.4]) | |
40 | ||
41 | # We want the 'PYTHON' varible to be python version 2. We also want | |
42 | # our custom 'PYTHON3' varible to be python version 3. | |
43 | # | |
44 | # Note that the python2/python3 code was inspired by code in the | |
45 | # 'abrt' configure: | |
46 | # <https://github.com/abrt/abrt/blob/master/configure.ac> | |
47 | # | |
48 | # First, figure out what version of python is in the executable named | |
49 | # 'python'. On most systems that is python version 2, but on arch | |
50 | # linux that is python version 3. | |
51 | AC_PATH_PROG([PYTHON_UNKNOWN], [python], [no]) | |
52 | if test "x$PYTHON_UNKNOWN" != "xno"; then | |
53 | # OK, we found 'python'. What version is it? | |
54 | AC_CACHE_CHECK([whether $PYTHON_UNKNOWN is version 2 or 3], | |
55 | [ac_cv_python_unknown_version], | |
56 | [ac_cv_python_unknown_version=`$PYTHON_UNKNOWN -c "import sys; sys.stdout.write(sys.version[[:3]][[0]])"`]) | |
57 | fi | |
58 | ||
59 | # Now we'll update the _AM_PYTHON_INTERPRETER_LIST variable (which | |
60 | # AM_PATH_PYTHON uses) to only be version 2 versions of python. Note | |
61 | # that the m4_define happens when autoconf is run, but the | |
62 | # PLAIN_PYTHON_INTERPRETER variable expansion will happen when the | |
63 | # user runs configure. | |
64 | # | |
65 | # Note that for python2, we prefer an executable named 'python2' over | |
66 | # one just named 'python'. | |
67 | if test "x$PYTHON_UNKNOWN" != "xno" -a "x$ac_cv_python_unknown_version" = "x2"; then | |
68 | PLAIN_PYTHON_INTERPRETER=python | |
69 | else | |
70 | PLAIN_PYTHON_INTERPRETER=python2 | |
71 | fi | |
72 | m4_define([_AM_PYTHON_INTERPRETER_LIST], | |
73 | [python2 $PLAIN_PYTHON_INTERPRETER python2.7 python2.6]) | |
74 | ||
75 | # Now we can call AM_PATH_PYTHON to find python version 2.6+ (and | |
76 | # version 2 only). | |
77 | AM_PATH_PYTHON([2.6], [], [:]) | |
78 | python_basename=$(basename "$PYTHON") | |
79 | AC_DEFINE_UNQUOTED([PYTHON_BASENAME], "${python_basename}", | |
80 | [Base name of the python2 interpreter binary.]) | |
81 | if test "x$PYTHON" != "x:"; then | |
82 | AC_DEFINE([PYTHON_EXISTS], [], | |
83 | [The python2 interpreter binary exists.]) | |
84 | fi | |
85 | ||
86 | # AM_PATH_PYTHON defines 'pyexecdir'. Make sure the python and | |
87 | # pyexecdir variables get sent down to the subconfigure in the | |
88 | # testsuite directory. | |
89 | AS_VAR_APPEND([ac_configure_args], [" python='$PYTHON' pyexecdir='$pyexecdir'"]) | |
90 | ||
91 | # Now let's try to find python version 3. | |
92 | AC_PATH_PROGS([PYTHON3], | |
93 | [python3 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0], [:]) | |
94 | python3_basename=$(basename "$PYTHON3") | |
95 | AC_DEFINE_UNQUOTED([PYTHON3_BASENAME], "${python3_basename}", | |
96 | [Base name of the python3 interpreter binary.]) | |
97 | ||
98 | # If we found python version 3, set up the other variables for python | |
99 | # version 3 that AM_PATH_PYTHON sets up for python version 2. | |
100 | if test "x$PYTHON3" != "x:"; then | |
101 | AC_DEFINE([PYTHON3_EXISTS], [], | |
102 | [The python3 interpreter binary exists.]) | |
103 | AC_CACHE_CHECK([for python3 version], [ac_cv_python3_version], | |
104 | [ac_cv_python3_version=`$PYTHON3 -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) | |
105 | AC_SUBST([PYTHON3_VERSION], [$ac_cv_python3_version]) | |
106 | AC_SUBST([PYTHON3_PREFIX], ['${prefix}']) | |
107 | AC_SUBST([PYTHON3_EXEC_PREFIX], ['${exec_prefix}']) | |
108 | AC_CACHE_CHECK([for python3 platform], [ac_cv_python3_platform], | |
109 | [ac_cv_python3_platform=`$PYTHON3 -c "import sys; sys.stdout.write(sys.platform)"`]) | |
110 | AC_SUBST([PYTHON3_PLATFORM], [$ac_cv_python3_platform]) | |
111 | ||
112 | AC_CACHE_CHECK([for python3 script directory], [ac_cv_python3_dir], | |
113 | [ac_cv_python3_dir=`$PYTHON3 -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(0,0,prefix='$PYTHON3_PREFIX'))"`]) | |
114 | AC_SUBST([python3dir], [$ac_cv_python3_dir]) | |
115 | ||
116 | AC_CACHE_CHECK([for python3 extension module directory], | |
117 | [ac_cv_py3execdir], | |
118 | [ac_cv_py3execdir=`$PYTHON3 -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0,prefix='$PYTHON3_EXEC_PREFIX'))"`]) | |
119 | AC_SUBST([py3execdir], [$ac_cv_py3execdir]) | |
120 | fi | |
121 | ||
122 | # Make sure the python3 and py3execdir variables get sent down to | |
123 | # the subconfigure in the testsuite directory. | |
124 | AS_VAR_APPEND([ac_configure_args], [" python3='$PYTHON3' py3execdir='$ac_cv_py3execdir'"]) | |
125 | ||
126 | dnl Allow the build to exclude -Werror | |
127 | AC_MSG_CHECKING([whether to build with -Werror]) | |
128 | AC_ARG_ENABLE([Werror], | |
129 | AS_HELP_STRING('[--enable-Werror], [compile with -Werror flags])) | |
130 | AS_IF([test "${enable_Werror}" != "no"], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) | |
131 | AM_CONDITIONAL([Werror], [test "${enable_Werror}" != "no"]) | |
132 | ||
133 | dnl Handle the prologues option. | |
134 | dnl | |
135 | dnl If the user didn't specify --enable-prologues/--disable-prologues | |
136 | dnl and the x86 system has a version of gcc less than version 4, | |
137 | dnl automatically enable prologues. | |
138 | if test "${enable_prologues+set}" != set; then | |
139 | AC_MSG_CHECKING([to see if prologue searching should be the default]) | |
140 | if { echo '#if __i386__ == 1 && __GNUC__ < 4' | |
141 | echo ' yes ' | |
142 | echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then | |
143 | enable_prologues=yes | |
144 | AC_MSG_RESULT([yes]) | |
145 | else | |
146 | AC_MSG_RESULT([no]) | |
147 | fi | |
148 | fi | |
149 | AC_ARG_ENABLE([prologues], | |
150 | AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]), | |
151 | [ | |
152 | if test "$enable_prologues" = yes; then | |
153 | AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default]) | |
154 | fi]) | |
155 | ||
156 | dnl Handle the disable-sdt-probes option. | |
157 | dnl | |
158 | dnl Default to --disable-sdt-probes if --enable-sdt-probes/--disable-prologues | |
159 | dnl was not specified and the gcc version is less than version 4, | |
160 | ||
161 | if test "${enable_sdt_probes+set}" != set; then | |
162 | AC_MSG_CHECKING([to see if sdt probes should be the default]) | |
163 | if { echo '#if __GNUC__ < 4' | |
164 | echo ' yes ' | |
165 | echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then | |
166 | enable_sdt_probes=no | |
167 | AC_MSG_RESULT([no]) | |
168 | else | |
169 | AC_MSG_RESULT([yes]) | |
170 | fi | |
171 | fi | |
172 | AC_ARG_ENABLE([sdt-probes], | |
173 | [AS_HELP_STRING([--disable-sdt-probes], | |
174 | [disable process.mark probes in stap, staprun, stapio])]) | |
175 | AS_IF([test "x$enable_sdt_probes" != xno], [ | |
176 | AC_DEFINE([ENABLE_SDT_PROBES], [1], | |
177 | [Define to 1 to enable process.mark probes in stap, staprun, stapio.]) | |
178 | ]) | |
179 | ||
180 | dnl We're now requiring *some* C++11, using RHEL6 (gcc 4.4.7) as a baseline. | |
181 | dnl This is too strict about __cplusplus for gcc < 4.7, so we have a manual fallback. | |
182 | AX_CXX_COMPILE_STDCXX(11, noext, optional) | |
183 | have_cxx0x="no" | |
184 | AS_IF([test "x$HAVE_CXX11" != x1],[ | |
185 | AC_LANG_PUSH(C++) | |
186 | AX_CHECK_COMPILE_FLAG([-std=c++0x], [ | |
187 | AC_MSG_NOTICE([Compiling with -std=c++0x]) | |
188 | CXX="$CXX -std=c++0x" | |
189 | HAVE_CXX11=1 | |
190 | have_cxx0x="yes" | |
191 | ], [ | |
192 | AC_MSG_ERROR([A compiler with C++11 support is required.]) | |
193 | ]) | |
194 | AC_LANG_POP(C++) | |
195 | ]) | |
196 | ||
197 | dnl Some versions of dyninst (10.1) need -faligned-new | |
198 | dnl If -faligned-new available, pass it in | |
199 | AC_LANG_PUSH(C++) | |
200 | AX_CHECK_COMPILE_FLAG([-faligned-new], ALIGNEDNEW="-faligned-new", ALIGNEDNEW="") | |
201 | AC_LANG_POP(C++) | |
202 | ||
203 | AC_SUBST(ALIGNEDNEW) | |
204 | ||
205 | dnl Carry forward some empty PIE*FLAGS so we don't have to modify | |
206 | dnl all the Makefile.am's just now. | |
207 | AC_SUBST(PIELDFLAGS) | |
208 | AC_SUBST(PIECFLAGS) | |
209 | AC_SUBST(PIECXXFLAGS) | |
210 | ||
211 | dnl Handle optional debuginfod support. If not specified by the user, | |
212 | dnl use it if present. If given --with-debuginfod=/PATH, interpret /PATH as a prefix | |
213 | dnl of an elfutils install tree. | |
214 | AC_ARG_WITH([debuginfod], | |
215 | AS_HELP_STRING([--with-debuginfod],[Enable debuginfo lookups with debuginfod (auto/yes/no)]), | |
216 | [], [with_debuginfod=auto]) | |
217 | AC_MSG_CHECKING([whether to use debuginfod]) | |
218 | if expr "$with_debuginfod" : "/.*" >/dev/null; then | |
219 | dnl take the user at his or her word | |
220 | debuginfod_LDFLAGS=-L$with_debuginfod/lib | |
221 | debuginfod_LIBS=-ldebuginfod | |
222 | debuginfod_CFLAGS=-I$with_debuginfod/include | |
223 | have_debuginfod=1 | |
224 | AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.]) | |
225 | AC_MSG_RESULT([yes]) | |
226 | elif test "x$with_debuginfod" != xno; then | |
227 | dnl check in the system pkgconfig | |
228 | PKG_CHECK_MODULES([debuginfod], [libdebuginfod >= 0.179], | |
229 | [have_debuginfod=1 | |
230 | AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.])], | |
231 | [if test "x$with_debuginfod" = xyes; then | |
232 | AC_MSG_ERROR(["--with-debuginfod was given, but libdebuginfod is missing or unusable."]) | |
233 | fi]) | |
234 | else | |
235 | AC_MSG_RESULT([no]) | |
236 | fi | |
237 | ||
238 | ac_save_CFLAGS="$CFLAGS" | |
239 | ac_save_LDFLAGS="$LDFLAGS" | |
240 | CFLAGS="$CFLAGS $debuginfod_CFLAGS" | |
241 | LDFLAGS="$LDFLAGS $debuginfod_LDFLAGS" | |
242 | AC_CHECK_LIB(debuginfod, debuginfod_find_metadata, [ | |
243 | AC_DEFINE([METADATA_QUERY_ENABLED], [1], [Define if a new enough version of elfutils exists to support metadata querying]) | |
244 | ]) | |
245 | CFLAGS="$ac_save_CFLAGS" | |
246 | LDFLAGS="$ac_save_LDFLAGS" | |
247 | AC_SUBST(debuginfod_LDFLAGS) | |
248 | ||
249 | dnl Handle optional sqlite support. If enabled/disabled by the user, | |
250 | dnl do the right thing. If not specified by the user, use it if | |
251 | dnl present. | |
252 | AC_ARG_ENABLE([sqlite], | |
253 | AS_HELP_STRING([--enable-sqlite], [build with sqlite support]), | |
254 | [], dnl ACTION-IF-GIVEN | |
255 | [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN | |
256 | sqlite3_LIBS= | |
257 | AS_IF([test "x$enable_sqlite" != xno], | |
258 | [PKG_CHECK_MODULES([sqlite3], [sqlite3 > 3.7], | |
259 | [AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the 'sqlite3' library (-lsqlite3).])], | |
260 | [if test "x$enable_sqlite" != xcheck; then | |
261 | AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite > 3.7 failed]) | |
262 | fi])]) | |
263 | ||
264 | dnl Handle the option to only build runtime | |
265 | AC_ARG_ENABLE([translator], | |
266 | AS_HELP_STRING([--disable-translator], [build only runtime utilities]), | |
267 | [], | |
268 | [enable_translator="yes"]) | |
269 | AM_CONDITIONAL([BUILD_TRANSLATOR], [test "$enable_translator" = "yes"]) | |
270 | ||
271 | dnl Handle the option to build the crash extension | |
272 | AC_ARG_ENABLE([crash], | |
273 | AS_HELP_STRING([--enable-crash@<:@=DIRECTORY@:>@], | |
274 | [enable crash extension (default is disabled). Optional DIRECTORY | |
275 | is the path to the crash header file (needed if installed in a | |
276 | non-standard location).]), | |
277 | [if test "$enable_crash" != "no"; then | |
278 | dnl Handle custom install dir (if needed) | |
279 | save_CPPFLAGS="$CPPFLAGS" | |
280 | if test "$enable_crash" != "yes"; then | |
281 | staplog_CPPFLAGS=-I$enable_crash | |
282 | CPPFLAGS="${staplog_CPPFLAGS} $CPPFLAGS" | |
283 | AC_SUBST([staplog_CPPFLAGS]) | |
284 | fi | |
285 | AC_CHECK_HEADERS([crash/defs.h], [], | |
286 | [AC_MSG_ERROR([cannot find required crash header (crash-devel may need to be installed)])], | |
287 | [ | |
288 | #define NR_CPUS 256 | |
289 | ]) | |
290 | CPPFLAGS="$save_CPPFLAGS" | |
291 | fi], | |
292 | [enable_crash="no"]) | |
293 | AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"]) | |
294 | ||
295 | dnl Handle the option to build the documentation | |
296 | dnl --enable-docs=check checks for LaTeX et al. and decides accordingly | |
297 | building_docs="no" | |
298 | dnl Handle the option to install the prebuilt PDFs and man pages. | |
299 | dnl Automatically turned on if --enable-docs is on or if --enable-docs=prebuilt. | |
300 | installing_prebuilt_docs="yes" | |
301 | AC_ARG_ENABLE([docs], | |
302 | AS_HELP_STRING([--enable-docs], | |
303 | [enable building documentation (default to only installing prebuilt docs).]), | |
304 | [enable_docs=$enableval], | |
305 | [enable_docs="prebuilt"]) | |
306 | AC_CHECK_PROG(have_latex, latex, yes, no) | |
307 | AC_CHECK_PROG(have_dvips, dvips, yes, no) | |
308 | AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no) | |
309 | if test "x${have_latex}${have_dvips}${have_ps2pdf}" != "xyesyesyes"; then | |
310 | if test "$enable_docs" = "yes"; then | |
311 | AC_MSG_ERROR([cannot find all tools for building documentation]) | |
312 | fi | |
313 | if test "$enable_docs" = "check"; then | |
314 | AC_MSG_WARN([will not build documentation, cannot find all tools]) | |
315 | fi | |
316 | fi | |
317 | if test "$enable_docs" = "prebuilt"; then | |
318 | AC_MSG_NOTICE([will only install prebuilt documentation]) | |
319 | fi | |
320 | if test "x${have_latex}${have_dvips}${have_ps2pdf}" = "xyesyesyes" -a "$enable_docs" != "no" -a "$enable_docs" != "prebuilt"; then | |
321 | building_docs="yes" | |
322 | installing_prebuilt_docs="yes" | |
323 | fi | |
324 | if test "$enable_docs" = "no"; then | |
325 | installing_prebuilt_docs="no" | |
326 | fi | |
327 | AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" = "yes"]) | |
328 | AM_CONDITIONAL([INSTALL_PREBUILT_DOCS], [test "$installing_prebuilt_docs" = "yes"]) | |
329 | ||
330 | ||
331 | dnl Handle the option to build the reference documentation | |
332 | building_refdocs="no" | |
333 | AC_ARG_ENABLE([refdocs], | |
334 | AS_HELP_STRING([--enable-refdocs], | |
335 | [enable building reference documentation (default on if other documentation built).]), | |
336 | [enable_refdocs=$enableval], | |
337 | [enable_refdocs="check"]) | |
338 | if test "$building_docs" = "no" -a "$enable_refdocs" = "yes" ; then | |
339 | AC_MSG_ERROR([must use --enable-docs with --enable-refdocs]) | |
340 | fi | |
341 | if test "$enable_refdocs" != "no" -a "${building_docs}" = "yes"; then | |
342 | building_refdocs="yes" | |
343 | fi | |
344 | AM_CONDITIONAL([BUILD_REFDOCS], [test "$building_refdocs" = "yes"]) | |
345 | ||
346 | AC_CHECK_PROG(have_xmlto, xmlto, yes, no) | |
347 | AC_CHECK_PROG(have_fop, fop, yes, no) | |
348 | if test "x${have_fop}" = "xyes"; then | |
349 | # Due to rhbz505364 / 830266, we must actually test-run fop, not just | |
350 | # hope that it works. | |
351 | AC_MSG_CHECKING([to see if xmlto --with-fop actually works]) | |
352 | if xmlto --with-fop pdf ${srcdir}/doc/SystemTap_Tapset_Reference/dummy-tapsets.xml >/dev/null 2>&1; then | |
353 | AC_MSG_RESULT([yes]) | |
354 | else | |
355 | AC_MSG_RESULT([it's dead, Jim]) | |
356 | have_fop="broken" | |
357 | fi | |
358 | rm -f dummy-tapsets.pdf | |
359 | fi | |
360 | AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = "yes"]) | |
361 | AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = "yes"]) | |
362 | ||
363 | dnl Handle the option to build the html documentation | |
364 | building_htmldocs="no" | |
365 | AC_ARG_ENABLE([htmldocs], | |
366 | AS_HELP_STRING([--enable-htmldocs], | |
367 | [enable building html documentation (default off).]), | |
368 | [building_htmldocs=$enableval], | |
369 | [building_htmldocs="no"]) | |
370 | if test "$have_xmlto" = "no" -a "$building_htmldocs" = "yes"; then | |
371 | AC_MSG_ERROR([xmlto required for building html documentation]) | |
372 | fi | |
373 | ||
374 | AM_CONDITIONAL([BUILD_HTMLDOCS], [test "$building_htmldocs" = "yes"]) | |
375 | ||
376 | dnl There is a strange bug in older versions of xmlto when generating pdf. | |
377 | dnl https://bugzilla.redhat.com/show_bug.cgi?id=526273 | |
378 | dnl So make sure to have a chapter title starting with L plus an refentry. | |
379 | dnl This will make sure the xmlto pdf support test fails on buggy versions. | |
380 | cat > conftest.xml << 'EOF' | |
381 | <?xml version="1.0" encoding="UTF-8"?> | |
382 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | |
383 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | |
384 | <book lang="en"> | |
385 | <bookinfo><title>foo</title></bookinfo> | |
386 | <chapter id="logging.stp"><title>Logging Tapset</title> | |
387 | <refentry id="API-log"><refnamediv><refname>log</refname> | |
388 | <refpurpose>logging</refpurpose></refnamediv> | |
389 | <refsect1><title>Description</title> | |
390 | <para>baz</para></refsect1></refentry></chapter> | |
391 | </book> | |
392 | EOF | |
393 | ||
394 | if test "x${have_xmlto}" = "xyes"; then | |
395 | AC_MSG_CHECKING([for xmlto --stringparam support]) | |
396 | xmlto --stringparam man.authors.section.enabled=0 html-nochunks conftest.xml >/dev/null 2>&1 | |
397 | if test $? = 0; then | |
398 | have_xmlto_stringparam="yes" | |
399 | AC_MSG_RESULT([yes]) | |
400 | else | |
401 | AC_MSG_RESULT([no]) | |
402 | fi | |
403 | rm -f conftest.html | |
404 | fi | |
405 | AM_CONDITIONAL([XMLTO_STRINGPARAM], [test "$have_xmlto_stringparam" = "yes"]) | |
406 | ||
407 | rm -f conftest.xml | |
408 | ||
409 | dnl See if we have the nss/nspr headers and libraries | |
410 | AC_ARG_WITH([nss], | |
411 | AS_HELP_STRING([--without-nss], | |
412 | [Do not use NSS even if present])) | |
413 | ||
414 | AS_IF([test "x$with_nss" != "xno"], [ | |
415 | PKG_CHECK_MODULES([nss], [nss >= 3], | |
416 | [have_nss=yes | |
417 | AC_DEFINE([HAVE_NSS], [1], [Define to 1 if you have the nss libraries.]) | |
418 | ], [have_nss=no]) | |
419 | ], [have_nss=no]) | |
420 | ||
421 | AM_CONDITIONAL([HAVE_NSS], [test "${have_nss}" = "yes"]) | |
422 | ||
423 | dnl See if we have the openssl headers and libraries | |
424 | AC_ARG_WITH([openssl], | |
425 | AS_HELP_STRING([--without-openssl], | |
426 | [Do not use OPENSSL even if present])) | |
427 | ||
428 | AS_IF([test "x$with_openssl" != "xno"], [ | |
429 | PKG_CHECK_MODULES([openssl], [openssl], | |
430 | [have_openssl=yes | |
431 | AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if you have the openssl libraries.]) | |
432 | ], [have_openssl=no]) | |
433 | ], [have_openssl=no]) | |
434 | ||
435 | AM_CONDITIONAL([HAVE_OPENSSL], [test "${have_openssl}" = "yes"]) | |
436 | ||
437 | dnl Handle dracut directory configuration. Note we hard-code /usr by default, | |
438 | dnl instead of $prefix, because dracut is a system service that doesn't listen | |
439 | dnl at relocatable directories. | |
440 | AC_ARG_WITH([dracutstap], | |
441 | AS_HELP_STRING([--with-dracutstap=DIR], | |
442 | [Install dracut module files in DIR])) | |
443 | AS_IF([test "x$with_dracutstap" != "x"],[dracutstap="$with_dracutstap"], | |
444 | [dracutstap=/usr/lib/dracut/modules.d/99stap]) | |
445 | AC_MSG_NOTICE([using dracut module directory $dracutstap]) | |
446 | AC_SUBST(dracutstap) | |
447 | ||
448 | dnl PR20850 Fix the boot time probing feature for fedora too. Typical rhel | |
449 | dnl location is /sbin, typical fedora location is /usr/bin. | |
450 | AC_ARG_WITH([dracutbindir], | |
451 | AS_HELP_STRING([--with-dracutbindir=DIR], | |
452 | [Use the dracut binary located in DIR])) | |
453 | AS_IF([test "x$with_dracutbindir" != "x"],[dracutbindir="$with_dracutbindir"], | |
454 | [dracutbindir=/sbin]) | |
455 | AC_MSG_NOTICE([using dracut binary $dracutbindir]) | |
456 | AC_SUBST(dracutbindir) | |
457 | ||
458 | dnl Handle the option to build the compile server. | |
459 | AC_ARG_ENABLE([server], | |
460 | AS_HELP_STRING([--enable-server], | |
461 | [enable building of stap-server (default on if nss etc. found).]), | |
462 | [enable_server=$enableval], | |
463 | [enable_server="check"]) | |
464 | ||
465 | if test "$enable_server" != "no"; then | |
466 | dnl See if we have enough libraries and tools to build the compile server | |
467 | if test "x${have_nss}" != "xyes"; then | |
468 | AC_MSG_WARN([will not build systemtap compile server, cannot find nss headers]) | |
469 | fi | |
470 | fi | |
471 | AM_CONDITIONAL([BUILD_SERVER], [test "${have_nss}" = "yes" -a "$enable_server" != "no"]) | |
472 | ||
473 | if test "${have_nss}" != "yes"; then | |
474 | AC_MSG_WARN([compile-server client functionality will be disabled, cannot find nss development files]) | |
475 | fi | |
476 | ||
477 | dnl See if we have the avahi libraries and headers | |
478 | AC_ARG_WITH([avahi], | |
479 | AS_HELP_STRING([--without-avahi], | |
480 | [Do not use Avahi even if present])) | |
481 | ||
482 | AS_IF([test "x$with_avahi" != "xno"], [ | |
483 | PKG_CHECK_MODULES([avahi], [avahi-client], | |
484 | [have_avahi=yes | |
485 | AC_DEFINE([HAVE_AVAHI], [1], [Define to 1 if you have the avahi libraries.]) | |
486 | ], [have_avahi=no]) | |
487 | ], [have_avahi=no]) | |
488 | ||
489 | AM_CONDITIONAL([HAVE_AVAHI], [test "${have_avahi}" = "yes"]) | |
490 | ||
491 | if test "${have_avahi}" != "yes"; then | |
492 | AC_MSG_WARN([some compile-server functionality will be restricted, cannot find avahi development files]) | |
493 | fi | |
494 | ||
495 | ||
496 | dnl Look for librpm. | |
497 | AC_ARG_WITH([rpm], | |
498 | [AS_HELP_STRING([--with-rpm], | |
499 | [query rpm database for missing debuginfos])], [], [with_rpm="auto"]) | |
500 | if test "$with_rpm" != "no"; then | |
501 | AC_CHECK_LIB(rpm, rpmtsInitIterator, [ | |
502 | AC_DEFINE([HAVE_LIBRPM],[1],[have librpm]) | |
503 | stap_LIBS="$stap_LIBS -lc -lrpm" | |
504 | have_librpm="yes"], [have_librpm="no"]) | |
505 | dnl explicit -lrpmdb is a separate requirement on some older librpms | |
506 | AC_CHECK_LIB(rpmdb, rpmdbNextIterator, [ | |
507 | stap_LIBS="$stap_LIBS -lrpmdb"]) | |
508 | AC_CHECK_LIB(rpmio, rpmFreeCrypto, [ | |
509 | AC_DEFINE([HAVE_LIBRPMIO],[1],[have librpmio]) | |
510 | stap_LIBS="$stap_LIBS -lc -lrpmio" | |
511 | have_librpmio="yes"], [have_librpmio="no"]) | |
512 | if test "x$have_librpm" != "xyes" -a "$with_rpm" = "yes"; then | |
513 | AC_MSG_ERROR([cannot find librpm]) | |
514 | fi | |
515 | if test "x$have_librpmio" != "xyes" -a "$with_rpm" = "yes"; then | |
516 | AC_MSG_WARN([cannot find librpmio]) | |
517 | fi | |
518 | fi | |
519 | ||
520 | AC_CHECK_HEADERS([stdatomic.h]) | |
521 | ||
522 | dnl Look for rpmcrypto.h | |
523 | AC_CHECK_HEADERS([rpm/rpmcrypto.h], [ | |
524 | AC_DEFINE([HAVE_RPMCRYPTO_H],[1],[have rpmcrypto_h]) | |
525 | have_rpmcrypto_h=yes | |
526 | AC_MSG_NOTICE([separate rpm/rpmcrypto.h])]) | |
527 | ||
528 | dnl Look for readline. | |
529 | dnl | |
530 | dnl First save the orignal value of LIBS. | |
531 | LIBS_no_readline=$LIBS | |
532 | ||
533 | dnl Check how for readline presence and how to link with it. On some | |
534 | dnl systems you need to add a termcap compatible library. | |
535 | have_libreadline="no" | |
536 | AC_MSG_CHECKING([how to link readline libs]) | |
537 | for libtermcap in "" tinfo ncursesw ncurses curses termcap; do | |
538 | if test -z "$libtermcap"; then | |
539 | READLINE_LIBS="-lreadline" | |
540 | else | |
541 | READLINE_LIBS="-lreadline -l$libtermcap" | |
542 | fi | |
543 | LIBS="$READLINE_LIBS $LIBS_no_readline" | |
544 | AC_LINK_IFELSE( | |
545 | [AC_LANG_CALL([],[readline])], | |
546 | [have_libreadline="yes"]) | |
547 | if test "$have_libreadline" = "yes"; then | |
548 | break | |
549 | fi | |
550 | done | |
551 | if test "$have_libreadline" = "no"; then | |
552 | AC_MSG_RESULT([none]) | |
553 | READLINE_LIBS="" | |
554 | else | |
555 | AC_MSG_RESULT([$READLINE_LIBS]) | |
556 | AC_DEFINE(HAVE_LIBREADLINE, [1], | |
557 | [Define if you have the readline library (-lreadline).]) | |
558 | fi | |
559 | AC_SUBST([READLINE_LIBS]) | |
560 | AM_CONDITIONAL([HAVE_LIBREADLINE], [test "$have_libreadline" = "yes"]) | |
561 | ||
562 | dnl End of readline checks: restore LIBS | |
563 | LIBS=$LIBS_no_readline | |
564 | ||
565 | dnl Allow user to choose python3 for /usr/bin/dtrace | |
566 | AC_ARG_WITH([python3], | |
567 | AS_HELP_STRING([--with-python3],[prefer python version 3]), [], [with_python3="auto"]) | |
568 | AS_IF([test "x$with_python3" = "xyes"], | |
569 | [AS_IF([test "x$PYTHON3" = "x:"], | |
570 | [AC_MSG_ERROR([python version 3 is required])], | |
571 | [AC_SUBST(preferred_python,[$PYTHON3])])], | |
572 | [test "x$with_python3" = "xno"], | |
573 | [AS_IF([test "x$PYTHON" = "x:"], | |
574 | [AC_MSG_ERROR([python version 2 is required])], | |
575 | [AC_SUBST(preferred_python,[$PYTHON])])], | |
576 | [test "x$PYTHON3" != "x:"], | |
577 | [AC_SUBST(preferred_python,[$PYTHON3])], | |
578 | [test "x$PYTHON" != "x:"], | |
579 | [AC_SUBST(preferred_python,[$PYTHON])], | |
580 | [AC_MSG_ERROR([neither python version 2 nor 3 found])]) | |
581 | ||
582 | if test $enable_translator = yes; then | |
583 | # Need libdwfl-capable recent elfutils http://elfutils.org/ | |
584 | # On modern debian/ubuntu and modern elfutils, libebl has been | |
585 | # merged into libdw | |
586 | # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=457543 | |
587 | save_LIBS="$LIBS" | |
588 | AC_CHECK_LIB(ebl, ebl_strtabinit,[ebl_LIBS=-lebl],[ebl_LIBS=]) | |
589 | LIBS="$save_LIBS" | |
590 | ||
591 | save_LIBS="$LIBS" | |
592 | AC_CHECK_LIB(dw, dwfl_module_getsym,[],[ | |
593 | AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])], | |
594 | [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf]) | |
595 | AC_CHECK_LIB(dw, dwarf_next_unit,[],[ | |
596 | AC_MSG_ERROR([elfutils, libdw too old, need 0.148+])], | |
597 | [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf]) | |
598 | stap_LIBS="$stap_LIBS -Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf" | |
599 | LIBS="$save_LIBS" | |
600 | fi | |
601 | ||
602 | AC_SUBST(stap_LIBS) | |
603 | AC_MSG_NOTICE([stap will link $stap_LIBS]) | |
604 | ||
605 | # staprun has more modest libelf needs | |
606 | save_LIBS="$LIBS" | |
607 | dnl this will only succeed with elfutils 0.142+ | |
608 | AC_CHECK_LIB(elf,elf_getshdrstrndx,[],[ | |
609 | AC_MSG_FAILURE([libelf too old, need 0.142+])]) | |
610 | staprun_LIBS="$staprun_LIBS -lelf" | |
611 | stapbpf_LIBS="$stapbpf_LIBS -lelf" | |
612 | LIBS="$save_LIBS" | |
613 | ||
614 | AC_SUBST(staprun_LIBS) | |
615 | AC_SUBST(stapbpf_LIBS) | |
616 | AC_MSG_NOTICE([staprun will link $staprun_LIBS]) | |
617 | AC_MSG_NOTICE([stapbpf will link $stapbpf_LIBS]) | |
618 | ||
619 | # Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun | |
620 | # being compiled on 32-bit userspace but running against 64-bit kernels. | |
621 | # This is no longer necessary. | |
622 | ||
623 | AC_LANG_PUSH(C++) | |
624 | # Use boost::string_ref if available | |
625 | AC_CHECK_HEADERS([boost/utility/string_ref.hpp]) | |
626 | # add boost_system bits for stapdyn with dyninst 10+ | |
627 | saved_LIBS="$LIBS" | |
628 | LIBS="-lboost_system $LIBS" | |
629 | AC_MSG_CHECKING([need for -lboost_system library]) | |
630 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
631 | #include <boost/system/system_error.hpp> | |
632 | int main() { | |
633 | boost::system::error_condition e(); | |
634 | } | |
635 | ])],[AC_MSG_RESULT([yup]) | |
636 | BOOST_SYSTEM_LIB="-lboost_system" | |
637 | ],[AC_MSG_RESULT([nope]) | |
638 | BOOST_SYSTEM_LIB="" | |
639 | ]) | |
640 | LIBS="$saved_LIBS" | |
641 | AC_SUBST(BOOST_SYSTEM_LIB) | |
642 | ||
643 | AC_LANG_POP(C++) | |
644 | ||
645 | # Check for Dyninst headers and libraries | |
646 | AC_ARG_WITH([dyninst], | |
647 | AS_HELP_STRING([--with-dyninst=DIRECTORY], | |
648 | [find dyninst headers/libraries in DIRECTORY])) | |
649 | ||
650 | case "$with_dyninst" in | |
651 | no) ;; | |
652 | ''|yes) # Try a simple-minded distro search | |
653 | DYNINST_CXXFLAGS="-I/usr/include/dyninst" | |
654 | old_LIBS="$LIBS" | |
655 | old_LDFLAGS="$LDFLAGS" | |
656 | old_CPPFLAGS="$CPPFLAGS" | |
657 | CPPFLAGS="$CPPFLAGS $DYNINST_CXXFLAGS" | |
658 | AC_LANG_PUSH(C++) | |
659 | for location in /usr/lib64/dyninst /usr/lib/dyninst ${libdir}/dyninst; do | |
660 | LDFLAGS="-L${location}" | |
661 | LIBS="-lparseAPI ${BOOST_SYSTEM_LIB}" | |
662 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <dyninst/CodeSource.h>]], | |
663 | [[char *s; Dyninst::ParseAPI::SymtabCodeSource *sts = new Dyninst::ParseAPI::SymtabCodeSource(s);]])], | |
664 | ||
665 | [found_DYNINST_LDFLAGS=yes],[found_DYNINST_LDFLAGS=no]) | |
666 | if test "$found_DYNINST_LDFLAGS" = "yes"; then | |
667 | DYNINST_LDFLAGS="$LDFLAGS" | |
668 | break | |
669 | fi | |
670 | done | |
671 | AC_LANG_POP(C++) | |
672 | CPPFLAGS="$old_CPPFLAGS" | |
673 | LDFLAGS="$old_LDFLAGS" | |
674 | LIBS="$old_LIBS" | |
675 | ||
676 | # Add Dyninst libraries only if they are available | |
677 | if test -d "/usr/include/dyninst"; then | |
678 | save_LIBS="$LIBS" | |
679 | AC_CHECK_LIB(tbb, TBB_runtime_interface_version, [tbb_LIBS=-ltbb],[tbb_LIBS=]) | |
680 | LIBS="$save_LIBS" | |
681 | DYNINST_LIBS="-lparseAPI -lsymtabAPI -linstructionAPI $tbb_LIBS -lcommon" | |
682 | fi | |
683 | ;; | |
684 | *) # Use paths in the user-specified prefix | |
685 | DYNINST_CXXFLAGS="-I$with_dyninst/include -I$with_dyninst/include/dyninst" | |
686 | DYNINST_LDFLAGS="-L$with_dyninst/lib64/dyninst -Wl,-rpath-link,$with_dyninst/lib64/dyninst" | |
687 | # Will assume Dyninst libraries are available as the path is specified | |
688 | save_LIBS="$LIBS" | |
689 | AC_CHECK_LIB(tbb, TBB_runtime_interface_version, [tbb_LIBS=-ltbb],[tbb_LIBS=]) | |
690 | LIBS="$save_LIBS" | |
691 | DYNINST_LIBS="-lparseAPI -lsymtabAPI -linstructionAPI $tbb_LIBS -lcommon" | |
692 | ;; | |
693 | esac | |
694 | if test "$with_dyninst" != "no"; then | |
695 | AC_LANG_PUSH(C++) | |
696 | old_CPPFLAGS="$CPPFLAGS" | |
697 | CPPFLAGS="$CPPFLAGS $DYNINST_CXXFLAGS" | |
698 | AC_MSG_NOTICE([checking dyninst support]) | |
699 | AC_CHECK_HEADERS([dyninst/BPatch_object.h], [ | |
700 | AC_SUBST(DYNINST_CXXFLAGS) | |
701 | AC_SUBST(DYNINST_LDFLAGS) | |
702 | AC_SUBST(DYNINST_LIBS) | |
703 | AC_DEFINE([HAVE_DYNINST],[1],[Define to 1 if Dyninst is enabled]) | |
704 | have_dyninst=yes | |
705 | AC_MSG_NOTICE([dyninst support available])]) | |
706 | if test -n "$with_dyninst" -a "$have_dyninst" != "yes"; then | |
707 | AC_MSG_ERROR([Dyninst does not appear to be usable]) | |
708 | fi | |
709 | CPPFLAGS="$old_CPPFLAGS" | |
710 | AC_LANG_POP(C++) | |
711 | fi | |
712 | AM_CONDITIONAL([HAVE_DYNINST], [test "${have_dyninst}" = "yes"]) | |
713 | ||
714 | ||
715 | dnl Check for the libvirt and libxml2 devel packages | |
716 | ||
717 | AC_ARG_ENABLE([virt], | |
718 | AS_HELP_STRING([--enable-virt], | |
719 | [enable building of stapvirt support (default on if libvirt etc. found).]), | |
720 | [enable_virt=$enableval], | |
721 | [enable_virt="check"]) | |
722 | ||
723 | dnl We require libvirt >= 1.0.2 because stapvirt relies on the | |
724 | dnl virDomainOpenChannel function, which was implemented in 1.0.2. | |
725 | AC_ARG_ENABLE([libvirt], | |
726 | AS_HELP_STRING([--disable-libvirt], [Do not use libvirt even if present])) | |
727 | ||
728 | if test "$enable_libvirt" != no; then | |
729 | PKG_CHECK_MODULES([libvirt], [libvirt >= 1.0.2], [ | |
730 | have_libvirt=yes | |
731 | AC_DEFINE([HAVE_LIBVIRT],[1],[Define to 1 if libvirt development libraries are installed]) | |
732 | ], [have_libvirt=no]) | |
733 | fi | |
734 | AM_CONDITIONAL([HAVE_LIBVIRT], [test "${have_libvirt}" = "yes"]) | |
735 | PKG_CHECK_MODULES([libxml2], [libxml-2.0], [ | |
736 | have_libxml2=yes | |
737 | AC_DEFINE([HAVE_LIBXML2],[1],[Define to 1 if libxml2 development libraries are installed]) | |
738 | ], [have_libxml2=no]) | |
739 | AM_CONDITIONAL([HAVE_LIBXML2], [test "${have_libxml2}" = "yes"]) | |
740 | ||
741 | if test "$enable_virt" != "no"; then | |
742 | dnl See if we have enough libraries and tools to build the virt server | |
743 | if test "x${have_libvirt}" != "xyes"; then | |
744 | AC_MSG_WARN([will not build systemtap virt support, cannot find libvirt headers]) | |
745 | fi | |
746 | if test "x${have_libxml2}" != "xyes"; then | |
747 | AC_MSG_WARN([will not build systemtap virt support, cannot find xml2 headers]) | |
748 | fi | |
749 | fi | |
750 | AM_CONDITIONAL([BUILD_VIRT], [test "${have_libvirt}" = "yes" -a "${have_libxml2}" = "yes" -a "$enable_virt" != "no"]) | |
751 | ||
752 | dnl Handle the option to build python2 probe support | |
753 | AC_ARG_WITH([python2-probes], | |
754 | AS_HELP_STRING([--without-python2-probes], | |
755 | [Disable building python version 2 probe support, even if it is available])) | |
756 | have_python2_support=no | |
757 | AS_IF([test "x$with_python2_probes" != "xno"], | |
758 | [dnl First, check to make sure we have the 'python-config' script. | |
759 | AS_IF([test "x$PYTHON" != "x:"], | |
760 | [AC_PATH_PROGS([PYTHON_CONFIG], [${python_basename}-config python2-config python-config])]) | |
761 | AS_IF([test "x$PYTHON_CONFIG" != "x"], | |
762 | [dnl Use the 'python-config' script to find the python | |
763 | dnl include directories. | |
764 | PYTHON_CPPFLAGS=`$PYTHON_CONFIG --includes 2> /dev/null` | |
765 | AC_SUBST([PYTHON_CPPFLAGS], [$PYTHON_CPPFLAGS]) | |
766 | save_CPPFLAGS="$CPPFLAGS" | |
767 | CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS" | |
768 | dnl Now make sure we can find the python 2 Python.h file. We | |
769 | dnl need to clear the cached result, since this might be a | |
770 | dnl cached result from the python 3 header file (since they | |
771 | dnl share the same name). | |
772 | AS_UNSET([ac_cv_header_Python_h]) | |
773 | AC_CHECK_HEADERS([Python.h], [have_python2_support=yes]) | |
774 | CPPFLAGS="$save_CPPFLAGS"])]) | |
775 | AS_IF([test "x$have_python2_support" = "xyes"], | |
776 | [AC_DEFINE([HAVE_PYTHON2_PROBES], [1], | |
777 | [Define to 1 to enable python version 2 probe support in systemtap.])], | |
778 | [AS_IF([test "x$with_python2_probes" = "xyes"], | |
779 | [AC_MSG_ERROR([python version 2 probe support requested but not found])]) | |
780 | ]) | |
781 | AM_CONDITIONAL([HAVE_PYTHON2_PROBES], [test "x$have_python2_support" = "xyes"]) | |
782 | ||
783 | dnl Handle the option to build python3 probe support | |
784 | AC_ARG_WITH([python3-probes], | |
785 | AS_HELP_STRING([--without-python3-probes], | |
786 | [Disable building python version 3 probe support, even if it is available])) | |
787 | have_python3_support=no | |
788 | AS_IF([test "x$with_python3_probes" != "xno"], | |
789 | [dnl First, check to make sure we have the 'python3-config' script. | |
790 | AS_IF([test "x$PYTHON3" != "x:" ], | |
791 | [AC_PATH_PROG([PYTHON3_CONFIG], [${python3_basename}-config])]) | |
792 | AS_IF([test "x$PYTHON3_CONFIG" != "x"], | |
793 | [dnl Use the 'python3-config' script to find the python | |
794 | dnl include directories. | |
795 | PYTHON3_CPPFLAGS=`$PYTHON3_CONFIG --includes 2> /dev/null` | |
796 | AC_SUBST([PYTHON3_CPPFLAGS], [$PYTHON3_CPPFLAGS]) | |
797 | save_CPPFLAGS="$CPPFLAGS" | |
798 | CPPFLAGS="$PYTHON3_CPPFLAGS $CPPFLAGS" | |
799 | dnl Now make sure we can find the python 3 Python.h | |
800 | dnl file. However, we've got a problem. AC_CHECK_HEADERS | |
801 | dnl was called above for the python 2 version of | |
802 | dnl Python.h. But, autoconf doesn't really know the | |
803 | dnl difference between the two files, since they both have | |
804 | dnl the same name. So, we'll unset the cache variable. | |
805 | AS_UNSET([ac_cv_header_Python_h]) | |
806 | AC_CHECK_HEADERS([Python.h], [have_python3_support=yes]) | |
807 | CPPFLAGS="$save_CPPFLAGS"])]) | |
808 | AS_IF([test "x$have_python3_support" = "xyes"], | |
809 | [AC_DEFINE([HAVE_PYTHON3_PROBES], [1], | |
810 | [Define to 1 to enable python version 3 probe support in systemtap.])], | |
811 | [AS_IF([test "x$with_python3_probes" = "xyes"], | |
812 | [AC_MSG_ERROR([python version 3 probe support requested but not found])]) | |
813 | ]) | |
814 | AM_CONDITIONAL([HAVE_PYTHON3_PROBES], [test "x$have_python3_support" = "xyes"]) | |
815 | ||
816 | dnl We want either (or both) python probe support. | |
817 | AM_CONDITIONAL([HAVE_PYTHON_PROBES], | |
818 | [test "x$have_python2_support" = "xyes" -o "x$have_python3_support" = "xyes"]) | |
819 | ||
820 | PKG_CHECK_MODULES([jsonc], [json-c >= 0.13], [have_jsonc=yes], [have_jsonc=no]) | |
821 | PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=yes], [have_ncurses=no]) | |
822 | ||
823 | AC_ARG_ENABLE([monitor], AS_HELP_STRING([--disable-monitor],[Disable monitor])) | |
824 | if test "$enable_monitor" != "no"; then | |
825 | dnl Check for presence of json-c and ncurses for use in monitor mode | |
826 | if test "${have_jsonc}" = "yes" -a "${have_ncurses}" = yes; then | |
827 | AC_DEFINE([HAVE_MONITOR_LIBS],[1],[Define to 1 if json-c and ncurses libraries are installed]) | |
828 | fi | |
829 | fi | |
830 | AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" = "yes" -a "${have_ncurses}" = "yes" -a "$enable_monitor" != "no"]) | |
831 | if test "${have_jsonc}" = "yes"; then | |
832 | AC_DEFINE([HAVE_JSON_C],[1],[Define to 1 if the json-c library is installed]) | |
833 | fi | |
834 | AM_CONDITIONAL([HAVE_JSON_C], [test "${have_jsonc}" = "yes"]) | |
835 | ||
836 | # We require gcc >=8 since we use some more modern language features such as lambda-capture [this] and | |
837 | # initializer list constructors in class template argument deduction | |
838 | AC_MSG_CHECKING([to see if the language server is supported]) | |
839 | if { echo '#if __GNUC__ >= 8 ' | |
840 | echo ' yes ' | |
841 | echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then | |
842 | have_language_server_support=yes | |
843 | AC_MSG_RESULT([yes]) | |
844 | AC_DEFINE([HAVE_LANGUAGE_SERVER_SUPPORT], [1], | |
845 | [Define to 1 if the language server is supported]) | |
846 | else | |
847 | AC_MSG_RESULT([no]) | |
848 | fi | |
849 | AM_CONDITIONAL([HAVE_LANGUAGE_SERVER_SUPPORT], [test "x$have_language_server_support" = "xyes"]) | |
850 | ||
851 | AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [ | |
852 | old_CFLAGS="$CFLAGS" | |
853 | CFLAGS="$CFLAGS -Wa,--fatal-warnings" | |
854 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([asm(".section .note.foo,\"?\",\"note\"\n" | |
855 | ".byte 1, 2, 3\n" | |
856 | ".previous\n" | |
857 | ".section .text,\"axG\",\"progbits\",foogroup,comdat\n" | |
858 | ".byte 1\n" | |
859 | ".pushsection .note.foo,\"?\",\"note\"\n" | |
860 | ".byte 4, 5, 6\n" | |
861 | ".popsection\n" | |
862 | ".byte 2\n");])], | |
863 | stap_cv_sectionq=yes, stap_cv_sectionq=no) | |
864 | CFLAGS="$old_CFLAGS"]) | |
865 | AC_SUBST(support_section_question) | |
866 | support_section_question=0 | |
867 | if test $stap_cv_sectionq = yes; then | |
868 | support_section_question=1 | |
869 | fi | |
870 | ||
871 | ||
872 | AC_ARG_WITH([bpf], | |
873 | AS_HELP_STRING([--without-bpf],[Do not try to build BPF components])) | |
874 | ||
875 | dnl Allow --without-bpf to disable this autodetection, as some kernels | |
876 | dnl have some headers but missing some decls like __NR_bpf. Too hard | |
877 | dnl to detect all the prereqs here. | |
878 | AS_IF([test "x$with_bpf" != "xno"], [ | |
879 | AC_CHECK_DECLS([BPF_PROG_TYPE_PERF_EVENT], | |
880 | [AC_DEFINE([HAVE_BPF_DECLS], [1], [Define to 1 if you have the necessary declarations in bpf.h])], | |
881 | [], | |
882 | [#include <linux/bpf.h>]) | |
883 | ]) | |
884 | AM_CONDITIONAL(HAVE_BPF_DECLS, [test "x$ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" = "xyes"]) | |
885 | AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in]) | |
886 | ||
887 | dnl determine whether BPF raw tracepoints are available | |
888 | AC_CHECK_DECLS([BPF_PROG_TYPE_RAW_TRACEPOINT], | |
889 | [AC_DEFINE([HAVE_BPF_PROG_TYPE_RAW_TRACEPOINT], [1], [Define to 1 if you have the necessary declarations in bpf.h])], | |
890 | [], | |
891 | [#include <linux/bpf.h>]) | |
892 | ||
893 | dnl Optional libselinux support allows stapdyn to check | |
894 | dnl for booleans that would prevent Dyninst from working. | |
895 | AC_ARG_WITH([selinux], | |
896 | AS_HELP_STRING([--without-selinux], | |
897 | [Do not use libselinux even if present])) | |
898 | ||
899 | AS_IF([test "x$with_selinux" != "xno"], [ | |
900 | PKG_CHECK_MODULES([selinux], [libselinux], | |
901 | [have_selinux=yes | |
902 | AC_DEFINE([HAVE_SELINUX], [1], [Define to 1 if you have the SELinux libraries.]) | |
903 | ], [have_selinux=no]) | |
904 | ], [have_selinux=no]) | |
905 | ||
906 | AM_CONDITIONAL([HAVE_SELINUX], [test "${have_selinux}" = "yes"]) | |
907 | ||
908 | dnl Used in monitor mode. Only available on kernel versions >= 2.6.35 | |
909 | AC_CHECK_DECL([F_SETPIPE_SZ], | |
910 | [AC_DEFINE(HAVE_F_SETPIPE_SZ,[1], Define to 1 if F_SETPIPE_SZ is available.)], | |
911 | [], | |
912 | [#include <fcntl.h>]) | |
913 | ||
914 | dnl Handle java+byteman support | |
915 | AC_CHECK_PROG(have_javac, javac, yes, no) | |
916 | AC_CHECK_PROG(have_jar, jar, yes, no) | |
917 | if test "$have_javac" != no -a "$have_jar" != no; then | |
918 | echo java found, will try to configure Byteman support | |
919 | ||
920 | AC_ARG_WITH([java], | |
921 | [AS_HELP_STRING([--with-java=DIRECTORY], | |
922 | [Specify JDK directory to compile libHelperSDT.so against (default is /usr/lib/jvm/java)])], | |
923 | [], | |
924 | [with_java=/usr/lib/jvm/java]) | |
925 | dnl don't use AC_CHECK_FILE here, as that blocks cross-compiling | |
926 | if test ! -d "$with_java"; then | |
927 | AC_MSG_NOTICE([directory $with_java not found, disabling java support]) | |
928 | with_java=no | |
929 | fi | |
930 | AC_SUBST(JAVADIR, "${with_java}") # always needed to compile | |
931 | ||
932 | if test "$with_java" != "no"; then | |
933 | AC_DEFINE_UNQUOTED(HAVE_JAVA, "1", [Flag indicating that libHelperSDT.so is available (can be found in PKGLIBDIR)]) | |
934 | fi | |
935 | ||
936 | AM_CONDITIONAL([HAVE_JAVA], [test "$with_java" != "no"]) | |
937 | ||
938 | else | |
939 | AC_MSG_WARN([will not run per-method java probing, missing byteman or java requirements]) | |
940 | AM_CONDITIONAL([HAVE_JAVA],false) | |
941 | fi # java+byteman support | |
942 | ||
943 | AC_SUBST(ENABLE_NLS, "$USE_NLS") | |
944 | AC_SUBST(localedir, "$localedir") | |
945 | AC_SUBST(LOCALEDIR, "$localedir") | |
946 | ||
947 | AC_ARG_WITH([extra-version], | |
948 | AS_HELP_STRING([--with-extra-version=STRING], | |
949 | [Add STRING to stap -V version])) | |
950 | AS_IF([test "x$with_extra_version" != "xno"], [ | |
951 | stap_extra_version="$with_extra_version" | |
952 | AC_MSG_NOTICE([Adding extra version $stap_extra_version])], [ | |
953 | stap_extra_version=""]) | |
954 | AC_DEFINE_UNQUOTED(STAP_EXTRA_VERSION, "$stap_extra_version", [extra stap version code]) | |
955 | AC_SUBST(STAP_EXTRA_VERSION, "$stap_extra_version") | |
956 | ||
957 | dnl Handle the option to build httpd web compilation service | |
958 | AC_ARG_ENABLE([http], | |
959 | AS_HELP_STRING([--enable-http], | |
960 | [Enable building http web compilation service, if possible])) | |
961 | have_http_support=no | |
962 | dnl (default off) | |
963 | AS_IF([test "x$enable_http" = "xyes"], | |
964 | [dnl Do we have the microhttpd library? | |
965 | PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd > 0.9.0], [have_libmicrohttpd=true], [have_libmicrohttpd=false]) | |
966 | ||
967 | dnl Do we have the uuid library? | |
968 | PKG_CHECK_MODULES([uuid], [uuid >= 2.17.0], [have_libuuid=true], [have_libuuid=false]) | |
969 | ||
970 | dnl Do we have the curl library? | |
971 | PKG_CHECK_MODULES([libcurl], [libcurl >= 7.19.7], [have_libcurl=true], [have_libcurl=false]) | |
972 | ||
973 | dnl If we have all of the libraries, the json-c and nss libraries, | |
974 | dnl and full C++11 support, we could build the httpd web | |
975 | dnl compilation service. | |
976 | AS_IF([test "x$have_libmicrohttpd" = "xtrue" -a "x$have_libuuid" = "xtrue" -a "x$have_libcurl" = "xtrue" -a "x$have_jsonc" = "xyes" -a "x$have_nss" = "xyes" -a "x$have_openssl" = "xyes" -a "x$have_cxx0x" = "xno"], [have_http_support=yes])]) | |
977 | ||
978 | AS_IF([test "x$have_http_support" = "xyes"], | |
979 | [AC_DEFINE([HAVE_HTTP_SUPPORT], [1], | |
980 | [Define to 1 to enable http web service support in systemtap.])], | |
981 | [AS_IF([test "x$enable_http" = "xyes"], | |
982 | [AC_MSG_ERROR([http service support requested but not found])]) | |
983 | ]) | |
984 | AM_CONDITIONAL([HAVE_HTTP_SUPPORT], [test "x$have_http_support" = "xyes"]) | |
985 | ||
986 | dnl NEED_BASE_CLIENT_CODE is defined when we have either HAVE_NSS | |
987 | dnl or HAVE_HTTP_SUPPORT. | |
988 | AM_CONDITIONAL([NEED_BASE_CLIENT_CODE], | |
989 | [test "x$have_http_support" = "xyes" -o "x$have_nss" = "xyes"]) | |
990 | AS_IF([test "x$have_http_support" = "xyes" -o "x$have_nss" = "xyes"], [ | |
991 | AC_DEFINE([NEED_BASE_CLIENT_CODE], [1], | |
992 | [Define to 1 if the base client code is needed.]) | |
993 | ]) | |
994 | ||
995 | dnl This is here mainly to make sure that configure --prefix=... changes | |
996 | dnl the config.h files so files depending on it are recompiled | |
997 | dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS. | |
998 | dnl Formerly: Don't use this directly (when not given it is set to NONE). | |
999 | dnl Currently: inline autoconf's later defaulting | |
1000 | ||
1001 | stap_prefix=$prefix | |
1002 | test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix | |
1003 | AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location]) | |
1004 | AC_SUBST(STAP_PREFIX, "$stap_prefix") | |
1005 | ||
1006 | dnl compute a fully expanded $pkglibexecdir for substitution here and there | |
1007 | stap_libexecdir=$libexecdir | |
1008 | test "$stap_libexecdir" = '${exec_prefix}/libexec' && stap_libexecdir=$stap_prefix/libexec | |
1009 | AC_SUBST(pkglibexecdir, "$stap_libexecdir/$PACKAGE") | |
1010 | ||
1011 | AC_CONFIG_HEADERS([config.h:config.in]) | |
1012 | ||
1013 | dnl XXX: we'd like fully expanded path names for the @macros@ in there, | |
1014 | dnl not like exec_prefix=${prefix} | |
1015 | ||
1016 | AC_CONFIG_FILES([Makefile doc/Makefile man/Makefile man/cs/Makefile \ | |
1017 | doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \ | |
1018 | man/stap.1 man/stappaths.7 man/systemtap-service.8 \ | |
1019 | man/cs/stap.1 man/cs/stappaths.7 man/cs/systemtap.8 \ | |
1020 | initscript/config.systemtap initscript/config.stap-server \ | |
1021 | initscript/systemtap initscript/stap-server \ | |
1022 | initscript/99stap/module-setup.sh \ | |
1023 | initscript/99stap/install \ | |
1024 | initscript/99stap/check ]) | |
1025 | AC_CONFIG_SUBDIRS(testsuite) | |
1026 | if test $enable_translator = "yes"; then | |
1027 | AC_CONFIG_FILES([run-stap], [chmod +x run-stap]) | |
1028 | fi | |
1029 | AC_CONFIG_FILES([dtrace], [chmod +x dtrace]) | |
1030 | AC_CONFIG_FILES(stapdyn/Makefile) | |
1031 | AC_CONFIG_FILES(java/Makefile) | |
1032 | AC_CONFIG_FILES([java/stapbm], [chmod +x java/stapbm]) | |
1033 | AC_CONFIG_FILES(java/org/systemtap/byteman/helper/HelperSDT.java) | |
1034 | AC_CONFIG_FILES(python/Makefile) | |
1035 | AC_CONFIG_FILES(interactive-notebook/Makefile) | |
1036 | AC_CONFIG_FILES([interactive-notebook/stap-jupyter-container], [chmod +x interactive-notebook/stap-jupyter-container]) | |
1037 | AC_CONFIG_FILES([interactive-notebook/stap-jupyter-install], [chmod +x interactive-notebook/stap-jupyter-install]) | |
1038 | AC_CONFIG_FILES(staprun/Makefile) | |
1039 | AC_CONFIG_FILES(stapbpf/Makefile) | |
1040 | AC_CONFIG_FILES([httpd/Makefile httpd/docker/Makefile]) | |
1041 | AC_CONFIG_FILES([staprun/run-staprun], [chmod +x staprun/run-staprun]) | |
1042 | AC_CONFIG_FILES([staprun/guest/stapshd], [chmod +x staprun/guest/stapshd]) | |
1043 | AC_CONFIG_FILES([staprun/guest/stapsh-daemon], [chmod +x staprun/guest/stapsh-daemon]) | |
1044 | AC_CONFIG_FILES([staprun/guest/stapsh@.service]) | |
1045 | AC_CONFIG_FILES(stap-exporter/Makefile) | |
1046 | AC_CONFIG_FILES([stap-profile-annotate], [chmod +x stap-profile-annotate]) | |
1047 | ||
1048 | dnl AC_CONFIG_FILES([macros.systemtap]) | |
1049 | dnl ^^^ not that one, because we want to expand $vars etc. to fqdn's, | |
1050 | dnl so we do the mapping in the Makefile.am | |
1051 | ||
1052 | # Setup "shadow" directory doc/beginners that has the basic directories setup for | |
1053 | # xmlto in one directory (through directory links if necessary). | |
1054 | # It would be nice to use AC_CONFIG_LINKS, but automake complains when | |
1055 | # the src is a directory and not a file. | |
1056 | AC_CONFIG_COMMANDS([doc/beginners], | |
1057 | [rm -f $ac_abs_top_builddir/doc/beginners/en-US $ac_abs_top_builddir/doc/beginners/build/en-US/testsuite && mkdir -p $ac_abs_top_builddir/doc/beginners/build/en-US && ln -s $ac_abs_top_srcdir/doc/SystemTap_Beginners_Guide/en-US $ac_abs_top_builddir/doc/beginners/en-US && ln -s $ac_abs_top_srcdir/testsuite $ac_abs_top_builddir/doc/beginners/build/en-US/testsuite]) | |
1058 | ||
1059 | AC_OUTPUT | |
1060 | ||
1061 | if test "${prefix}" = "/usr/local"; then | |
1062 | AC_MSG_NOTICE([]) | |
1063 | AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend]) | |
1064 | AC_MSG_NOTICE([configuring with a prefix. For example, try]) | |
1065 | AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$]) | |
1066 | AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,]) | |
1067 | AC_MSG_NOTICE([is not supported.]) | |
1068 | fi |