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