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