]> sourceware.org Git - systemtap.git/blame - configure.ac
Add more http client updates and rearrange some code.
[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 253 [if test "x$enable_sqlite" != xcheck; then
572f73b5 254 AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite > 3.7 failed])
9921a199 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"
0dbac951 586 stapbpf_LIBS="$stapbpf_LIBS -lelf"
97859b9d
JS
587 LIBS="$save_LIBS"
588else
589 # We built our own and staprun_LDFLAGS points at the install.
590 staprun_LIBS="$staprun_LIBS -lelf"
0dbac951 591 stapbpf_LIBS="$stapbpf_LIBS -lelf"
97859b9d
JS
592fi
593
594AC_SUBST(staprun_LIBS)
0dbac951 595AC_SUBST(stapbpf_LIBS)
97859b9d 596AC_MSG_NOTICE([staprun will link $staprun_LIBS])
0dbac951 597AC_MSG_NOTICE([stapbpf will link $stapbpf_LIBS])
97859b9d 598
cbe7ea07 599
69c68955
FCE
600dnl Plop in the build (configure) date
601date=`date +%Y-%m-%d`
602AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
82fab474 603AC_SUBST(DATE, "$date")
69c68955 604
47f390f9
FCE
605# Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun
606# being compiled on 32-bit userspace but running against 64-bit kernels.
607# This is no longer necessary.
5566993b 608
3bf6ac45 609AC_LANG_PUSH(C++)
a85f96f9 610# Use boost::string_ref if available
3dd76f53 611AC_CHECK_HEADERS([boost/utility/string_ref.hpp])
3bf6ac45
TM
612AC_LANG_POP(C++)
613
4d9087fc 614
138bbe90 615# Check for Dyninst headers and libraries
138bbe90
JS
616AC_ARG_WITH([dyninst],
617 AS_HELP_STRING([--with-dyninst=DIRECTORY],
eab44db5
FCE
618 [find dyninst headers/libraries in DIRECTORY]))
619
138bbe90 620case "$with_dyninst" in
eab44db5
FCE
621no) ;;
622''|yes) # Try a simple-minded distro search
ffbe6348
JS
623 DYNINST_CXXFLAGS="-I/usr/include/dyninst"
624 DYNINST_LDFLAGS="-L/usr/lib64/dyninst -L/usr/lib/dyninst" # XXX both lib paths!?!
625 ;;
626*) # Use paths in the user-specified prefix
627 DYNINST_CXXFLAGS="-I$with_dyninst/include"
3aeea85c 628 DYNINST_LDFLAGS="-L$with_dyninst/lib/" # XXX need lib64 too?
138bbe90 629 ;;
ffbe6348 630esac
e0a17c00 631if test "$with_dyninst" != "no"; then
ffbe6348
JS
632 AC_LANG_PUSH(C++)
633 old_CPPFLAGS="$CPPFLAGS"
634 CPPFLAGS="$CPPFLAGS $DYNINST_CXXFLAGS"
2494675c 635 AC_MSG_NOTICE([checking dyninst support])
ffbe6348
JS
636 AC_CHECK_HEADERS([BPatch_object.h], [
637 AC_SUBST(DYNINST_CXXFLAGS)
638 AC_SUBST(DYNINST_LDFLAGS)
a3524565 639 AC_DEFINE([HAVE_DYNINST],[1],[Define to 1 if Dyninst is enabled])
ffbe6348 640 have_dyninst=yes
2494675c 641 AC_MSG_NOTICE([dyninst support available])])
e0a17c00 642 if test -n "$with_dyninst" -a "$have_dyninst" != "yes"; then
2494675c
DS
643 AC_MSG_ERROR([Dyninst does not appear to be usable])
644 fi
ffbe6348
JS
645 CPPFLAGS="$old_CPPFLAGS"
646 AC_LANG_POP(C++)
647fi
138bbe90
JS
648AM_CONDITIONAL([HAVE_DYNINST], [test "${have_dyninst}" = "yes"])
649
b0c670f4 650
64b53440
JL
651dnl Check for the libvirt and libxml2 devel packages
652
b0c670f4
FCE
653AC_ARG_ENABLE([virt],
654 AS_HELP_STRING([--enable-virt],
655 [enable building of stapvirt support (default on if libvirt etc. found).]),
656 [enable_virt=$enableval],
657 [enable_virt="check"])
658
64b53440
JL
659dnl We require libvirt >= 1.0.2 because stapvirt relies on the
660dnl virDomainOpenChannel function, which was implemented in 1.0.2.
c17539a5
JL
661PKG_CHECK_MODULES([libvirt], [libvirt >= 1.0.2], [
662 have_libvirt=yes
663 AC_DEFINE([HAVE_LIBVIRT],[1],[Define to 1 if libvirt development libraries are installed])
664 ], [have_libvirt=no])
64b53440 665AM_CONDITIONAL([HAVE_LIBVIRT], [test "${have_libvirt}" = "yes"])
c17539a5
JL
666PKG_CHECK_MODULES([libxml2], [libxml-2.0], [
667 have_libxml2=yes
668 AC_DEFINE([HAVE_LIBXML2],[1],[Define to 1 if libxml2 development libraries are installed])
669 ], [have_libxml2=no])
64b53440 670AM_CONDITIONAL([HAVE_LIBXML2], [test "${have_libxml2}" = "yes"])
138bbe90 671
b0c670f4
FCE
672if test "$enable_virt" != "no"; then
673dnl See if we have enough libraries and tools to build the virt server
674 if test "x${have_libvirt}" != "xyes"; then
675 AC_MSG_WARN([will not build systemtap virt support, cannot find libvirt headers])
676 fi
677 if test "x${have_libxml2}" != "xyes"; then
678 AC_MSG_WARN([will not build systemtap virt support, cannot find xml2 headers])
679 fi
680fi
681AM_CONDITIONAL([BUILD_VIRT], [test "${have_libvirt}" == "yes" -a "${have_libxml2}" == "yes" -a "$enable_virt" != "no"])
682
d7f07c29
DS
683dnl Handle the option to build python2 probe support
684AC_ARG_WITH([python2-probes],
685 AS_HELP_STRING([--without-python2-probes],
686 [Disable building python version 2 probe support, even if it is available]))
687have_python2_support=no
688AS_IF([test "x$with_python2_probes" != "xno"],
689 [dnl First, check to make sure we have the 'python-config' script.
690 pathless_python=$(basename "$PYTHON")
691 AC_PATH_PROG([PYTHON_CONFIG], [${pathless_python}-config], [no])
692 AS_IF([test "x$PYTHON_CONFIG" != "xno"],
693 [dnl Use the 'python-config' script to find the python
694 dnl include directories.
695 PYTHON_CPPFLAGS=`$PYTHON_CONFIG --includes 2> /dev/null`
696 AC_SUBST([PYTHON_CPPFLAGS], [$PYTHON_CPPFLAGS])
697 save_CPPFLAGS="$CPPFLAGS"
698 CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS"
699 dnl Now make sure we can find the python 2 Python.h file. We
700 dnl need to clear the cached result, since this might be a
701 dnl cached result from the python 3 header file (since they
702 dnl share the same name).
703 AS_UNSET([ac_cv_header_Python_h])
704 AC_CHECK_HEADERS([Python.h], [have_python2_support=yes])
705 CPPFLAGS="$save_CPPFLAGS"])])
effb39de 706AS_IF([test "x$have_python2_support" = "xyes"],
d7f07c29 707 [AC_DEFINE([HAVE_PYTHON2_PROBES], [1],
effb39de 708 [Define to 1 to enable python version 2 probe support in systemtap.])],
d7f07c29
DS
709 [AS_IF([test "x$with_python2_probes" = "xyes"],
710 [AC_MSG_ERROR([python version 2 probe support requested but not found])])
c16501a1 711])
d7f07c29
DS
712AM_CONDITIONAL([HAVE_PYTHON2_PROBES], [test "x$have_python2_support" = "xyes"])
713
714dnl Handle the option to build python3 probe support
715AC_ARG_WITH([python3-probes],
716 AS_HELP_STRING([--without-python3-probes],
717 [Disable building python version 3 probe support, even if it is available]))
718have_python3_support=no
719AS_IF([test "x$with_python3_probes" != "xno"],
720 [dnl First, check to make sure we have the 'python3-config' script.
721 pathless_python3=$(basename "$PYTHON3")
1d200591
DS
722 if test "x${pathless_python3}" == "x"; then
723 pathless_python3="python3"
724 fi
d7f07c29
DS
725 AC_PATH_PROG([PYTHON3_CONFIG], [${pathless_python3}-config], [no])
726 AS_IF([test "x$PYTHON3_CONFIG" != "xno"],
727 [dnl Use the 'python3-config' script to find the python
728 dnl include directories.
729 PYTHON3_CPPFLAGS=`$PYTHON3_CONFIG --includes 2> /dev/null`
730 AC_SUBST([PYTHON3_CPPFLAGS], [$PYTHON3_CPPFLAGS])
731 save_CPPFLAGS="$CPPFLAGS"
732 CPPFLAGS="$PYTHON3_CPPFLAGS $CPPFLAGS"
733 dnl Now make sure we can find the python 3 Python.h
734 dnl file. However, we've got a problem. AC_CHECK_HEADERS
735 dnl was called above for the python 2 version of
736 dnl Python.h. But, autoconf doesn't really know the
737 dnl difference between the two files, since they both have
738 dnl the same name. So, we'll unset the cache variable.
739 AS_UNSET([ac_cv_header_Python_h])
740 AC_CHECK_HEADERS([Python.h], [have_python3_support=yes])
741 CPPFLAGS="$save_CPPFLAGS"])])
742AS_IF([test "x$have_python3_support" = "xyes"],
743 [AC_DEFINE([HAVE_PYTHON3_PROBES], [1],
744 [Define to 1 to enable python version 3 probe support in systemtap.])],
745 [AS_IF([test "x$with_python3_probes" = "xyes"],
746 [AC_MSG_ERROR([python version 3 probe support requested but not found])])
747])
748AM_CONDITIONAL([HAVE_PYTHON3_PROBES], [test "x$have_python3_support" = "xyes"])
749
750dnl We want either (or both) python probe support.
751AM_CONDITIONAL([HAVE_PYTHON_PROBES],
752 [test "x$have_python2_support" = "xyes" -o "x$have_python3_support" = "xyes"])
c16501a1 753
11ea78d6 754dnl Check for presence of json-c and ncurses for use in monitor mode
863e1237 755PKG_CHECK_MODULES([jsonc], [json-c >= 0.12], [have_jsonc=yes], [have_jsonc=no])
11ea78d6
FL
756PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=yes], [have_ncurses=no])
757AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes"])
758if test "${have_jsonc}" == "yes" -a "${have_ncurses}" == yes; then
759 AC_DEFINE([HAVE_MONITOR_LIBS],[1],[Define to 1 if json-c and ncurses libraries are installed])
760fi
b0c670f4 761
f9794ee4
RM
762AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [
763old_CFLAGS="$CFLAGS"
764CFLAGS="$CFLAGS -Wa,--fatal-warnings"
5d4aa1f5 765AC_COMPILE_IFELSE([AC_LANG_SOURCE([asm(".section .note.foo,\"?\",\"note\"\n"
f9794ee4
RM
766 ".byte 1, 2, 3\n"
767 ".previous\n"
768 ".section .text,\"axG\",\"progbits\",foogroup,comdat\n"
769 ".byte 1\n"
770 ".pushsection .note.foo,\"?\",\"note\"\n"
771 ".byte 4, 5, 6\n"
772 ".popsection\n"
5d4aa1f5 773 ".byte 2\n");])],
f9794ee4 774 stap_cv_sectionq=yes, stap_cv_sectionq=no)
a530cfe0 775CFLAGS="$old_CFLAGS"])
f9794ee4
RM
776AC_SUBST(support_section_question)
777support_section_question=0
778if test $stap_cv_sectionq = yes; then
779 support_section_question=1
780fi
0dbac951
RH
781
782dnl Check if we have <linux/bpf.h> for bpf backend.
783AC_CHECK_HEADERS(linux/bpf.h)
784AM_CONDITIONAL(HAVE_LINUX_BPF_H, [test "x$ac_cv_header_linux_bpf_h" = "xyes"])
785
8f223b3e 786AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in])
f9794ee4 787
efa6ba96 788if test $build_elfutils = yes -a $enable_translator = yes; then
d2bd25ac 789 here=`pwd`
4d9087fc
RM
790 case "$with_elfutils" in
791 /*) elfutils_srcdir="$with_elfutils" ;;
d2bd25ac 792 *) elfutils_srcdir="${here}/$with_elfutils" ;;
4d9087fc 793 esac
d2bd25ac
MW
794
795 if ! test -f ${elfutils_srcdir}/configure; then
796 AC_MSG_ERROR([No ${elfutils_srcdir}/configure, forgot to run autoreconf -i?])
797 fi
4d9087fc 798 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
29b694a7
DS
799
800 save_CFLAGS="$CFLAGS"
801 save_CXXFLAGS="$CXXFLAGS"
802 CXXFLAGS="$CXXFLAGS -fgnu89-inline"
803 CFLAGS="$CFLAGS -fgnu89-inline"
804 gnu89_inline_flag=""
5d4aa1f5 805 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
29b694a7
DS
806 AC_MSG_NOTICE([Compiling elfutils with gcc -fgnu89-inline])
807 gnu89_inline_flag="-fgnu89-inline"],[
808 AC_MSG_NOTICE([Compiler does not support -fgnu89-inline])])
809 CFLAGS="$save_CFLAGS"
810 CXXFLAGS="$save_CXXFLAGS"
811
b7165f65
RM
812 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
813 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
fa1d05cd
RM
814 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
815 # So we must make sure to pass those settings to elfutils configure.
b7165f65 816 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
33ee059c
MW
817 # Check whether this is a source release, or a source checkout.
818 # We need --enable-maintainer-mode if it isn't a source release.
819 # elfutils.spec is only distributed in source releases.
820 if test -f ${elfutils_srcdir}/elfutils.spec; then
821 need_maintainer_option=""
822 else
823 need_maintainer_option="--enable-maintainer-mode"
824 fi
4d9087fc 825 (mkdir -p build-elfutils && cd build-elfutils &&
412e1bf7 826 bash ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
4d9087fc 827 --includedir="${here}/include-elfutils" \
b7165f65 828 --libdir="${here}/lib-elfutils" \
fa1d05cd
RM
829 --exec-prefix="$exec_prefix" \
830 --prefix="$prefix" \
90491495 831 --enable-dwz \
33ee059c 832 ${need_maintainer_option} \
c2444a96 833 CFLAGS="${CFLAGS/-Wall/} $gnu89_inline_flag -fexceptions" \
e016a49a 834 LDFLAGS="$LDFLAGS $elfutils_rpath" &&
e3633556 835 if test -f ${elfutils_srcdir}/config/version.h.in; then
e050d62f
MW
836 echo Found elfutils/version.h header...
837 else
838 echo elfutils/version.h header not found, need elfutils 0.142+...
839 exit -1
e3633556 840 fi
4d9087fc 841 )
e050d62f 842 if test $? != 0; then exit -1; fi
4d9087fc 843fi
5566993b 844
51030d84
JS
845dnl Optional libselinux support allows stapdyn to check
846dnl for booleans that would prevent Dyninst from working.
847AC_ARG_WITH([selinux],
848 AS_HELP_STRING([--without-selinux],
849 [Do not use libselinux even if present]))
850
851AS_IF([test "x$with_selinux" != "xno"], [
852 PKG_CHECK_MODULES([selinux], [libselinux],
853 [have_selinux=yes
854 AC_DEFINE([HAVE_SELINUX], [1], [Define to 1 if you have the SELinux libraries.])
855 ], [have_selinux=no])
856], [have_selinux=no])
857
858AM_CONDITIONAL([HAVE_SELINUX], [test "${have_selinux}" = "yes"])
859
0820bd9a
FL
860dnl Used in monitor mode. Only available on kernel versions >= 2.6.35
861AC_CHECK_DECL([F_SETPIPE_SZ],
862 [AC_DEFINE(HAVE_F_SETPIPE_SZ,[1], Define to 1 if F_SETPIPE_SZ is available.)],
863 [],
864 [#include <fcntl.h>])
865
95835e2c 866dnl Handle java+byteman support
e9b0aba1
SM
867AC_CHECK_PROG(have_javac, javac, yes, no)
868AC_CHECK_PROG(have_jar, jar, yes, no)
869if test "$have_javac" != no -a "$have_jar" != no; then
870echo java found, will try to configure Byteman support
95835e2c 871
26703c63
SM
872AC_ARG_WITH([java],
873 [AS_HELP_STRING([--with-java=DIRECTORY],
874 [Specify JDK directory to compile libHelperSDT.so against (default is /usr/lib/jvm/java)])],
93933baa 875 [],
26703c63 876 [with_java=/usr/lib/jvm/java])
ef50e368 877dnl don't use AC_CHECK_FILE here, as that blocks cross-compiling
a71e842d 878if test ! -d "$with_java"; then
ef50e368
FCE
879 with_java=no
880fi
26703c63 881AC_SUBST(JAVADIR, "${with_java}") # always needed to compile
95835e2c 882
26703c63
SM
883if test "$with_java" != "no"; then
884AC_DEFINE_UNQUOTED(HAVE_JAVA, "1", [Flag indicating that libHelperSDT.so is available (can be found in PKGLIBDIR)])
13c19b49 885fi
275cd71a 886
26703c63 887AM_CONDITIONAL([HAVE_JAVA], [test "$with_java" != "no"])
7fe06356 888
95835e2c
SM
889else
890AC_MSG_WARN([will not run per-method java probing, missing byteman or java requirements])
26703c63 891AM_CONDITIONAL([HAVE_JAVA],false)
93933baa 892fi # java+byteman support
7fe06356 893
62c8a962
FCE
894AC_SUBST(ENABLE_NLS, "$USE_NLS")
895AC_SUBST(localedir, "$localedir")
896AC_SUBST(LOCALEDIR, "$localedir")
897
85b62eab
FCE
898AC_ARG_WITH([extra-version],
899 AS_HELP_STRING([--with-extra-version=STRING],
900 [Add STRING to stap -V version]))
901AS_IF([test "x$with_extra_version" != "xno"], [
902 stap_extra_version="$with_extra_version"
903 AC_MSG_NOTICE([Adding extra version $stap_extra_version])], [
904 stap_extra_version=""])
905AC_DEFINE_UNQUOTED(STAP_EXTRA_VERSION, "$stap_extra_version", [extra stap version code])
906AC_SUBST(STAP_EXTRA_VERSION, "$stap_extra_version")
907
fb299101 908dnl Handle the option to build httpd web compilation service
5c5a0bf2
DS
909AC_ARG_ENABLE([http],
910 AS_HELP_STRING([--disable-http],
911 [Disable building http web compilation service, even if we could]))
912have_http_support=no
913AS_IF([test "x$enable_http" != "xno"],
914 [dnl Do we have the microhttpd library?
915 PKG_CHECK_MODULES([libmicrohttpd], [libmicrohttpd > 0.9.0], [have_libmicrohttpd=true], [have_libmicrohttpd=false])
916
917 dnl Do we have the uuid library?
bccff213 918 PKG_CHECK_MODULES([uuid], [uuid >= 2.17.0], [have_libuuid=true], [have_libuuid=false])
5c5a0bf2 919
fb299101 920 dnl Do we have the curl library?
b3d1c4ec 921 PKG_CHECK_MODULES([libcurl], [libcurl >= 7.19.7], [have_libcurl=true], [have_libcurl=false])
fb299101
SC
922
923 dnl If we have all of the libraries (and the json-c library), we could
924 dnl build the httpd web compilation service.
925 AS_IF([test "x$have_libmicrohttpd" == "xtrue" -a "x$have_libuuid" == "xtrue" -a "x$have_libcurl" == "xtrue" -a "x$have_jsonc" == "xyes"], [have_http_support=yes])])
5c5a0bf2
DS
926
927AS_IF([test "x$have_http_support" = "xyes"],
928 [AC_DEFINE([HAVE_HTTP_SUPPORT], [1],
929 [Define to 1 to enable http web service support in systemtap.])],
930 [AS_IF([test "x$enable_http" = "xyes"],
931 [AC_MSG_ERROR([http service support requested but not found])])
932])
933AM_CONDITIONAL([HAVE_HTTP_SUPPORT], [test "x$have_http_support" = "xyes"])
934
01fb72a0
DS
935dnl NEED_BASE_CLIENT_CODE is defined when we have either HAVE_NSS
936dnl or HAVE_HTTP_SUPPORT.
937AM_CONDITIONAL([NEED_BASE_CLIENT_CODE],
938 [test "x$have_http_support" = "xyes" -o "x$have_nss" = "xyes"])
939AS_IF([test "x$have_http_support" = "xyes" -o "x$have_nss" = "xyes"], [
940 AC_DEFINE([NEED_BASE_CLIENT_CODE], [1],
941 [Define to 1 if the base client code is needed.])
942])
943
50431f30
MW
944dnl This is here mainly to make sure that configure --prefix=... changes
945dnl the config.h files so files depending on it are recompiled
946dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS.
2a1c9b5d
FCE
947dnl Formerly: Don't use this directly (when not given it is set to NONE).
948dnl Currently: inline autoconf's later defaulting
802cd104 949
2a1c9b5d
FCE
950stap_prefix=$prefix
951test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix
952AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location])
62c8a962 953AC_SUBST(STAP_PREFIX, "$stap_prefix")
50431f30 954
e016a49a 955AC_CONFIG_HEADERS([config.h:config.in])
d679d193 956AC_CONFIG_FILES([Makefile doc/Makefile man/Makefile man/cs/Makefile \
c24a9d9a 957doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \
0b03204e 958man/stap.1 man/stappaths.7 man/systemtap.8 \
24ef0e88 959man/cs/stap.1 man/cs/stappaths.7 man/cs/systemtap.8 \
29fe12e4 960initscript/config.systemtap initscript/config.stap-server \
e6c842d9 961initscript/systemtap initscript/stap-server \
b8d6168f
MC
962initscript/99stap/module-setup.sh \
963initscript/99stap/install \
964initscript/99stap/check ])
97859b9d 965AC_CONFIG_SUBDIRS(testsuite)
6d14a4a9
EB
966if test $enable_translator == "yes"; then
967 AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
968fi
e4aaabda 969AC_CONFIG_FILES([dtrace], [chmod +x dtrace])
66c3c633 970AC_CONFIG_FILES(stapdyn/Makefile)
7fe06356 971AC_CONFIG_FILES(java/Makefile)
d885563b 972AC_CONFIG_FILES([java/stapbm], [chmod +x java/stapbm])
cf8a58fc 973AC_CONFIG_FILES(python/Makefile)
97859b9d 974AC_CONFIG_FILES(staprun/Makefile)
0dbac951 975AC_CONFIG_FILES(stapbpf/Makefile)
5c5a0bf2 976AC_CONFIG_FILES(httpd/Makefile)
97859b9d 977AC_CONFIG_FILES([staprun/run-staprun], [chmod +x staprun/run-staprun])
bf61ca10
JL
978AC_CONFIG_FILES([staprun/guest/stapshd], [chmod +x staprun/guest/stapshd])
979AC_CONFIG_FILES([staprun/guest/stapsh-daemon], [chmod +x staprun/guest/stapsh-daemon])
980AC_CONFIG_FILES([staprun/guest/stapsh@.service])
53ade4da 981
a98010af
AJ
982# Setup "shadow" directory doc/beginners that has the basic directories setup for
983# xmlto in one directory (through directory links if necessary).
53ade4da
MW
984# It would be nice to use AC_CONFIG_LINKS, but automake complains when
985# the src is a directory and not a file.
53ade4da 986AC_CONFIG_COMMANDS([doc/beginners],
d9c42357 987 [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 988
e016a49a
FCE
989AC_OUTPUT
990
af29024d
FCE
991if test "${prefix}" = "/usr/local"; then
992 AC_MSG_NOTICE([])
993 AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend])
994 AC_MSG_NOTICE([configuring with a prefix. For example, try])
995 AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$])
996 AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,])
997 AC_MSG_NOTICE([is not supported.])
998fi
This page took 0.300601 seconds and 5 git commands to generate.