]> sourceware.org Git - systemtap.git/blame - configure.ac
Ensure use of the function argument values from function entry in lwtools
[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
1254cb0c 4AC_INIT([systemtap], 3.0, 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
25AM_PROG_CC_STDC
8ae7a94a 26AM_PROG_CC_C_O
2f1a1aea
FCE
27AC_PROG_RANLIB
28AC_OBJEXT
29AC_EXEEXT
30AC_PROG_INSTALL
31AC_PROG_MAKE_SET
32AC_SUBST(CFLAGS)
33AC_SUBST(CXXFLAGS)
97859b9d 34AC_SYS_LARGEFILE
e04a4b41 35AC_CHECK_FUNCS(ppoll)
56629dde 36AC_CHECK_FUNCS(openat)
3477519f 37AM_GNU_GETTEXT(external)
42973bd2 38AM_GNU_GETTEXT_VERSION([0.19.4])
3477519f
FCE
39
40if test "x$GMSGFMT" = "x:"; then
41 AC_MSG_ERROR([missing gnu /usr/bin/msgfmt])
42fi
2f1a1aea 43
e8f3c2c2
DS
44dnl Handle the prologues option.
45dnl
70d28673
DS
46dnl If the user didn't specify --enable-prologues/--disable-prologues
47dnl and the x86 system has a version of gcc less than version 4,
48dnl automatically enable prologues.
49if test "${enable_prologues+set}" != set; then
50 AC_MSG_CHECKING([to see if prologue searching should be the default])
51 if { echo '#if __i386__ == 1 && __GNUC__ < 4'
52 echo ' yes '
53 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
54 enable_prologues=yes
55 AC_MSG_RESULT([yes])
56 else
57 AC_MSG_RESULT([no])
58 fi
59fi
e8f3c2c2
DS
60AC_ARG_ENABLE([prologues],
61 AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]),
62 [
70d28673
DS
63if test "$enable_prologues" = yes; then
64 AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default])
65fi])
66
e1bfefdc
SC
67dnl Handle the disable-sdt-probes option.
68dnl
69dnl Default to --disable-sdt-probes if --enable-sdt-probes/--disable-prologues
70dnl was not specified and the gcc version is less than version 4,
71
72if test "${enable_sdt_probes+set}" != set; then
73 AC_MSG_CHECKING([to see if sdt probes should be the default])
74 if { echo '#if __GNUC__ < 4'
75 echo ' yes '
76 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
8b714d4b 77 enable_sdt_probes=no
e1bfefdc
SC
78 AC_MSG_RESULT([no])
79 else
80 AC_MSG_RESULT([yes])
81 fi
82fi
0f5d597d
JS
83AC_ARG_ENABLE([sdt-probes],
84 [AS_HELP_STRING([--disable-sdt-probes],
85 [disable process.mark probes in stap, staprun, stapio])])
86AS_IF([test "x$enable_sdt_probes" != xno], [
87 AC_DEFINE([ENABLE_SDT_PROBES], [1],
88 [Define to 1 to enable process.mark probes in stap, staprun, stapio.])
89])
90
9921a199 91AC_ARG_ENABLE([ssp],
bbfd8c1a
FCE
92 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
93AS_IF([test "x$enable_ssp" != xno],[
94 save_CFLAGS="$CFLAGS"
95 save_CXXFLAGS="$CXXFLAGS"
f0510eaa
FCE
96 CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
97 CFLAGS="$CFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
5d4aa1f5 98 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
f0510eaa
FCE
99 AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.])
100 CFLAGS="$save_CFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"
a530cfe0 101 CXXFLAGS="$save_CXXFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"],[
bbfd8c1a
FCE
102 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
103 CFLAGS="$save_CFLAGS"
104 CXXFLAGS="$save_CXXFLAGS"])])
70d28673 105
cbe7ea07
FCE
106
107dnl Link with gold if possible
108dnl but: https://bugzilla.redhat.com/show_bug.cgi?id=636603
109dnl
110dnl AC_PATH_PROG(GOLD, [ld.gold], [no])
111dnl if test "x$GOLD" != "xno"
112dnl then
113dnl mkdir -p Bdir
114dnl ln -sf $GOLD Bdir/ld
115dnl LDFLAGS="$LDFLAGS -B`pwd`/Bdir/"
116dnl AC_MSG_NOTICE([using ld.gold to link])
117dnl fi
118
119
e1e3ba36 120# Compiling without fPIE by default (see PR 9922)
8730f377 121AC_ARG_ENABLE([pie],
882ddac1 122 [AS_HELP_STRING([--enable-pie], [enable position-independent-executable])])
e1e3ba36 123AS_IF([test "x$enable_pie" == xyes],[
97859b9d
JS
124 PIECFLAGS='-fPIE'
125 PIECXXFLAGS='-fPIE'
126 PIELDFLAGS='-pie -Wl,-z,relro -Wl,-z,now'
8730f377
FCE
127 save_CFLAGS="$CFLAGS"
128 save_CXXFLAGS="$CXXFLAGS"
129 save_LDFLAGS="$LDFLAGS"
97859b9d
JS
130 CFLAGS="$CFLAGS $PIECFLAGS"
131 CXXFLAGS="$CXXFLAGS $PIECXXFLAGS"
132 LDFLAGS="$LDFLAGS $PIELDFLAGS"
5d4aa1f5 133 AC_LINK_IFELSE([AC_LANG_SOURCE([void main () {}])], [
8730f377 134 AC_MSG_NOTICE([Compiling with gcc pie et al.])
97859b9d 135 ], [
8730f377 136 AC_MSG_NOTICE([Compiler does not support -pie et al.])
5574ef2c 137 PIECFLAGS=""
5574ef2c 138 PIECXXFLAGS=""
8730f377 139 PIELDFLAGS=""
97859b9d
JS
140 ])
141 CFLAGS="$save_CFLAGS"
142 CXXFLAGS="$save_CXXFLAGS"
143 LDFLAGS="$save_LDFLAGS"
144])
8730f377 145AC_SUBST(PIELDFLAGS)
5574ef2c
MW
146AC_SUBST(PIECFLAGS)
147AC_SUBST(PIECXXFLAGS)
8730f377 148
9921a199
DS
149dnl Handle optional sqlite support. If enabled/disabled by the user,
150dnl do the right thing. If not specified by the user, use it if
151dnl present.
152AC_ARG_ENABLE([sqlite],
e8f3c2c2
DS
153 AS_HELP_STRING([--enable-sqlite], [build with sqlite support]),
154 [], dnl ACTION-IF-GIVEN
155 [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN
9921a199
DS
156sqlite3_LIBS=
157AS_IF([test "x$enable_sqlite" != xno],
158 [AC_CHECK_LIB([sqlite3], [sqlite3_open],
07606685 159 [AC_SUBST([sqlite3_LIBS], [-lsqlite3])
76227acd 160 AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the 'sqlite3' library (-lsqlite3).])],
9921a199
DS
161 [if test "x$enable_sqlite" != xcheck; then
162 AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite failed])
163 fi])])
e6c086bb 164
6d14a4a9
EB
165dnl Handle the option to only build runtime
166AC_ARG_ENABLE([translator],
167 AS_HELP_STRING([--disable-translator], [build only runtime utilities]),
168 [],
169 [enable_translator="yes"])
170AM_CONDITIONAL([BUILD_TRANSLATOR], [test "$enable_translator" == "yes"])
171
564eb0a8
DS
172dnl Handle the option to build the crash extension
173AC_ARG_ENABLE([crash],
174 AS_HELP_STRING([--enable-crash@<:@=DIRECTORY@:>@],
175 [enable crash extension (default is disabled). Optional DIRECTORY
176 is the path to the crash header file (needed if installed in a
177 non-standard location).]),
178 [if test "$enable_crash" != "no"; then
179 dnl Handle custom install dir (if needed)
180 save_CPPFLAGS="$CPPFLAGS"
181 if test "$enable_crash" != "yes"; then
182 staplog_CPPFLAGS=-I$enable_crash
183 CPPFLAGS="${staplog_CPPFLAGS} $CPPFLAGS"
184 AC_SUBST([staplog_CPPFLAGS])
185 fi
186 AC_CHECK_HEADERS([crash/defs.h], [],
187 [AC_MSG_ERROR([cannot find required crash header (crash-devel may need to be installed)])],
188 [
e8f3c2c2 189#define NR_CPUS 256
564eb0a8
DS
190 ])
191 CPPFLAGS="$save_CPPFLAGS"
192 fi],
193 [enable_crash="no"])
194AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"])
e6c086bb 195
465e8fbf 196dnl Handle the option to build the documentation
92aff3c7 197building_docs="no"
465e8fbf
FCE
198AC_ARG_ENABLE([docs],
199 AS_HELP_STRING([--enable-docs],
200 [enable building documentation (default on if latex etc. found).]),
201 [enable_docs=$enableval],
202 [enable_docs="check"])
203AC_CHECK_PROG(have_latex, latex, yes, no)
204AC_CHECK_PROG(have_dvips, dvips, yes, no)
205AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no)
7012fdd5 206if test "x${have_latex}${have_dvips}${have_ps2pdf}" != "xyesyesyes"; then
2d4b8ddf 207 if test "$enable_docs" == "yes"; then
465e8fbf
FCE
208 AC_MSG_ERROR([cannot find all tools for building documentation])
209 fi
2d4b8ddf
MW
210 if test "$enable_docs" == "check"; then
211 AC_MSG_WARN([will not build documentation, cannot find all tools])
212 fi
465e8fbf 213fi
7012fdd5 214if test "x${have_latex}${have_dvips}${have_ps2pdf}" == "xyesyesyes" -a "$enable_docs" != "no"; then
92aff3c7
WC
215 building_docs="yes"
216fi
217AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" == "yes"])
218
53ade4da 219
92aff3c7
WC
220dnl Handle the option to build the reference documentation
221building_refdocs="no"
222AC_ARG_ENABLE([refdocs],
223 AS_HELP_STRING([--enable-refdocs],
224 [enable building reference documentation (default on if xmlto etc. found and other documentation built).]),
225 [enable_refdocs=$enableval],
226 [enable_refdocs="check"])
227if test "$building_docs" == "no" -a "$enable_refdocs" == "yes" ; then
228 AC_MSG_ERROR([must use --enable-docs with --enable-refdocs])
229fi
230AC_CHECK_PROG(have_xmlto, xmlto, yes, no)
023337aa
EM
231if test "$enable_refdocs" == "yes"; then
232 if test "x${have_xmlto}" != "xyes"; then
233 AC_MSG_ERROR([cannot find xmlto for building reference documentation])
234 fi
235fi
236if test "x${have_xmlto}" == "xyes" -a "$enable_refdocs" != "no" -a "${building_docs}" == "yes"; then
237 building_refdocs="yes"
238fi
239AM_CONDITIONAL([BUILD_REFDOCS], [test "$building_refdocs" == "yes"])
240
327a760e 241AC_CHECK_PROG(have_fop, fop, yes, no)
61598deb
FCE
242if test "x${have_fop}" == "xyes"; then
243 # Due to rhbz505364 / 830266, we must actually test-run fop, not just
244 # hope that it works.
434e049c 245 AC_MSG_CHECKING([to see if xmlto --with-fop actually works])
61598deb 246 if xmlto --with-fop pdf ${srcdir}/doc/SystemTap_Tapset_Reference/dummy-tapsets.xml >/dev/null 2>&1; then
434e049c 247 AC_MSG_RESULT([yes])
61598deb 248 else
434e049c 249 AC_MSG_RESULT([it's dead, Jim])
61598deb
FCE
250 have_fop="broken"
251 fi
72862170 252 rm -f dummy-tapsets.pdf
61598deb 253fi
327a760e 254AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" == "yes"])
a98010af 255AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" == "yes"])
327a760e 256
a8fcf687
MW
257dnl There is a strange bug in older versions of xmlto when generating pdf.
258dnl https://bugzilla.redhat.com/show_bug.cgi?id=526273
259dnl So make sure to have a chapter title starting with L plus an refentry.
260dnl This will make sure the xmlto pdf support test fails on buggy versions.
468abaf4 261cat > conftest.xml << 'EOF'
aa5951be
WC
262<?xml version="1.0" encoding="UTF-8"?>
263<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
264"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
468abaf4
FCE
265 <book lang="en">
266 <bookinfo><title>foo</title></bookinfo>
a8fcf687
MW
267 <chapter id="logging.stp"><title>Logging Tapset</title>
268 <refentry id="API-log"><refnamediv><refname>log</refname>
269 <refpurpose>logging</refpurpose></refnamediv>
270 <refsect1><title>Description</title>
271 <para>baz</para></refsect1></refentry></chapter>
aa5951be
WC
272 </book>
273EOF
468abaf4
FCE
274
275if test "x${have_xmlto}" == "xyes"; then
276AC_MSG_CHECKING([for xmlto --stringparam support])
b653135b 277 xmlto --stringparam man.authors.section.enabled=0 html-nochunks conftest.xml >/dev/null 2>&1
468abaf4
FCE
278 if test $? == 0; then
279 have_xmlto_stringparam="yes"
280 AC_MSG_RESULT([yes])
281 else
282 AC_MSG_RESULT([no])
283 fi
b653135b 284 rm -f conftest.html
468abaf4
FCE
285fi
286AM_CONDITIONAL([XMLTO_STRINGPARAM], [test "$have_xmlto_stringparam" == "yes"])
287
288if test "x${building_refdocs}" == "xyes"; then
289AC_MSG_CHECKING([for xmlto pdf support])
c639b14d
FCE
290 # xmlto pdf may work *only* with --with-fop
291 # XXX: To an extent this test is redundant in that the --with-fop test
292 # already ran xmlto --with-fop pdf ....
293 if test "x$have_fop" == "xyes"; then
294 XMLTOPDF_FOP=--with-fop
295 else
296 XMLTOPDF_FOP=
297 fi
298 xmlto $XMLTOPDF_FOP pdf conftest.xml >& /dev/null
aa5951be
WC
299 if test $? == 0; then
300 have_xmlto_pdf="yes"
301 AC_MSG_RESULT([yes])
302 else
303 AC_MSG_RESULT([no])
023337aa 304 AC_MSG_WARN([Not building reference documentation in PDF format])
aa5951be 305 fi
468abaf4 306 rm -f conftest.pdf
aa5951be 307fi
a8fcf687 308AM_CONDITIONAL([BUILD_PDFREFDOCS], [test "$have_xmlto_pdf" == "yes"])
465e8fbf 309
468abaf4
FCE
310rm -f conftest.xml
311
a0e2728a 312dnl See if we have the nss/nspr headers and libraries
28f121c3
DEP
313AC_ARG_WITH([nss],
314 AS_HELP_STRING([--without-nss],
315 [Do not use NSS even if present]))
316
317AS_IF([test "x$with_nss" != "xno"], [
318 PKG_CHECK_MODULES([nss], [nss >= 3],
319 [have_nss=yes
320 AC_DEFINE([HAVE_NSS], [1], [Define to 1 if you have the nss libraries.])
321 ], [have_nss=no])
322], [have_nss=no])
323
f5a118c0 324AM_CONDITIONAL([HAVE_NSS], [test "${have_nss}" = "yes"])
468abaf4 325
2323b028
FCE
326dnl Handle dracut directory configuration. Note we hard-code /usr by default,
327dnl instead of $prefix, because dracut is a system service that doesn't listen
328dnl at relocatable directories.
329AC_ARG_WITH([dracutstap],
330 AS_HELP_STRING([--with-dracutstap=DIR],
331 [Install dracut module files in DIR]))
332AS_IF([test "x$with_dracutstap" != "x"],[dracutstap="$with_dracutstap"],
333 [dracutstap=/usr/lib/dracut/modules.d/99stap])
334AC_MSG_NOTICE([using dracut module directory $dracutstap])
335AC_SUBST(dracutstap)
336
a0e2728a 337dnl Handle the option to build the compile server.
19a0d4b6 338AC_ARG_ENABLE([server],
6275c8d7 339 AS_HELP_STRING([--enable-server],
a0e2728a 340 [enable building of stap-server (default on if nss etc. found).]),
19a0d4b6
MW
341 [enable_server=$enableval],
342 [enable_server="check"])
a0e2728a 343
161f9ed6 344if test "$enable_server" != "no"; then
a0e2728a 345dnl See if we have enough libraries and tools to build the compile server
f5a118c0
DEP
346 if test "x${have_nss}" != "xyes"; then
347 AC_MSG_WARN([will not build systemtap compile server, cannot find nss headers])
a0e2728a 348 fi
19a0d4b6 349fi
f5a118c0 350AM_CONDITIONAL([BUILD_SERVER], [test "${have_nss}" == "yes" -a "$enable_server" != "no"])
a0e2728a 351
f5a118c0 352if test "${have_nss}" != "yes"; then
c4fd15b4 353 AC_MSG_WARN([compile-server client functionality will be disabled, cannot find nss development files])
a0e2728a 354fi
a0e2728a
DB
355
356dnl See if we have the avahi libraries and headers
28f121c3
DEP
357AC_ARG_WITH([avahi],
358 AS_HELP_STRING([--without-avahi],
359 [Do not use Avahi even if present]))
360
361AS_IF([test "x$with_avahi" != "xno"], [
362 PKG_CHECK_MODULES([avahi], [avahi-client],
363 [have_avahi=yes
364 AC_DEFINE([HAVE_AVAHI], [1], [Define to 1 if you have the avahi libraries.])
365 ], [have_avahi=no])
366], [have_avahi=no])
367
f5a118c0
DEP
368AM_CONDITIONAL([HAVE_AVAHI], [test "${have_avahi}" = "yes"])
369
370if test "${have_avahi}" != "yes"; then
371 AC_MSG_WARN([some compile-server functionality will be restricted, cannot find avahi development files])
a0e2728a 372fi
43498922 373
1087b83f 374
bcfa72ed 375dnl Look for librpm.
2ed04863
WC
376AC_ARG_WITH([rpm],
377 [AS_HELP_STRING([--with-rpm],
bcfa72ed
FCE
378 [query rpm database for missing debuginfos])], [], [with_rpm="auto"])
379if test "$with_rpm" != "no"; then
12c1a007
FCE
380 AC_CHECK_LIB(rpm, rpmtsInitIterator, [
381 AC_DEFINE([HAVE_LIBRPM],[1],[have librpm])
f02c2e47 382 stap_LIBS="$stap_LIBS -lc -lrpm"
12c1a007 383 have_librpm="yes"], [have_librpm="no"])
44edbcd6
JS
384 AC_CHECK_LIB(rpmio, rpmFreeCrypto, [
385 AC_DEFINE([HAVE_LIBRPMIO],[1],[have librpmio])
f02c2e47 386 stap_LIBS="$stap_LIBS -lc -lrpmio"
44edbcd6 387 have_librpmio="yes"], [have_librpmio="no"])
bcfa72ed
FCE
388 if test "x$have_librpm" != "xyes" -a "$with_rpm" == "yes"; then
389 AC_MSG_ERROR([cannot find librpm])
2ed04863 390 fi
44edbcd6
JS
391 if test "x$have_librpmio" != "xyes" -a "$with_rpm" == "yes"; then
392 AC_MSG_WARN([cannot find librpmio])
393 fi
2ed04863
WC
394fi
395
396
0a742545
FCE
397dnl Allow user to choose python3 for /usr/bin/dtrace
398AC_ARG_WITH([python3],
399 AS_HELP_STRING([--with-python3],[prefer /usr/bin/python3]))
400AS_IF([test "x$with_python3" = "xyes"],
401 [AC_SUBST(python,[python3])],
402 [AC_SUBST(python,[python])])
403
e8f3c2c2
DS
404dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
405dnl the system's elfutils.
4d9087fc
RM
406build_elfutils=no
407AC_ARG_WITH([elfutils],
e8f3c2c2
DS
408 AS_HELP_STRING([--with-elfutils=DIRECTORY],
409 [find elfutils source code in DIRECTORY]),
410 [
4d9087fc
RM
411case "$with_elfutils" in
412yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
413''|no) ;;
414*) build_elfutils=yes ;;
415esac])
416AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
fa1d05cd
RM
417AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
418 [cd $with_elfutils && pwd])`)
419
efa6ba96
PP
420if test $enable_translator = yes; then
421 if test $build_elfutils = no; then
422 # Need libdwfl-capable recent elfutils http://elfutils.fedorahosted.org/
c14263d8
FCE
423
424 # On modern debian/ubuntu, libebl has been merged into libdw
425 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=457543
426 save_LIBS="$LIBS"
427 AC_CHECK_LIB(ebl, ebl_get_elfmachine,[ebl_LIBS=-lebl],[ebl_LIBS=])
428 LIBS="$save_LIBS"
429
efa6ba96
PP
430 save_LIBS="$LIBS"
431 AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
432 AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])],
c14263d8 433 [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf])
2a885a4a
MW
434 AC_CHECK_LIB(dw, dwarf_next_unit,[],[
435 AC_MSG_ERROR([elfutils, libdw too old, need 0.148+])],
c14263d8
FCE
436 [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf])
437 stap_LIBS="$stap_LIBS -Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf"
efa6ba96
PP
438 LIBS="$save_LIBS"
439 else
440 # We built our own and stap_LDFLAGS points at the install.
12c1a007 441 stap_LIBS="$stap_LIBS -Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
efa6ba96 442 fi
4d9087fc 443fi
a74dd276 444
6b1a0274
WC
445AC_SUBST(stap_LIBS)
446AC_MSG_NOTICE([stap will link $stap_LIBS])
c3a3c0c9 447
97859b9d
JS
448# staprun has more modest libelf needs
449if test $build_elfutils = no; then
97859b9d
JS
450 save_LIBS="$LIBS"
451 dnl this will only succeed with elfutils 0.142+
94eb87d1
DS
452 AC_CHECK_LIB(elf,elf_getshdrstrndx,[],[
453 AC_MSG_FAILURE([libelf too old, need 0.142+])])
454 staprun_LIBS="$staprun_LIBS -lelf"
97859b9d
JS
455 LIBS="$save_LIBS"
456else
457 # We built our own and staprun_LDFLAGS points at the install.
458 staprun_LIBS="$staprun_LIBS -lelf"
459fi
460
461AC_SUBST(staprun_LIBS)
462AC_MSG_NOTICE([staprun will link $staprun_LIBS])
463
cbe7ea07 464
69c68955
FCE
465dnl Plop in the build (configure) date
466date=`date +%Y-%m-%d`
467AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
82fab474 468AC_SUBST(DATE, "$date")
69c68955 469
47f390f9
FCE
470# Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun
471# being compiled on 32-bit userspace but running against 64-bit kernels.
472# This is no longer necessary.
5566993b 473
3bf6ac45
TM
474# Use tr1/unordered_map if available
475AC_LANG_PUSH(C++)
476AC_CHECK_HEADERS([tr1/unordered_map])
469c1a1b
FCE
477AC_CHECK_HEADERS([tr1/memory])
478AC_CHECK_HEADERS([boost/shared_ptr.hpp])
3dd76f53 479AC_CHECK_HEADERS([boost/utility/string_ref.hpp])
3bf6ac45
TM
480AC_LANG_POP(C++)
481
4d9087fc 482
138bbe90 483# Check for Dyninst headers and libraries
138bbe90
JS
484AC_ARG_WITH([dyninst],
485 AS_HELP_STRING([--with-dyninst=DIRECTORY],
eab44db5
FCE
486 [find dyninst headers/libraries in DIRECTORY]))
487
138bbe90 488case "$with_dyninst" in
eab44db5
FCE
489no) ;;
490''|yes) # Try a simple-minded distro search
ffbe6348
JS
491 DYNINST_CXXFLAGS="-I/usr/include/dyninst"
492 DYNINST_LDFLAGS="-L/usr/lib64/dyninst -L/usr/lib/dyninst" # XXX both lib paths!?!
493 ;;
494*) # Use paths in the user-specified prefix
495 DYNINST_CXXFLAGS="-I$with_dyninst/include"
3aeea85c 496 DYNINST_LDFLAGS="-L$with_dyninst/lib/" # XXX need lib64 too?
138bbe90 497 ;;
ffbe6348 498esac
e0a17c00 499if test "$with_dyninst" != "no"; then
ffbe6348
JS
500 AC_LANG_PUSH(C++)
501 old_CPPFLAGS="$CPPFLAGS"
502 CPPFLAGS="$CPPFLAGS $DYNINST_CXXFLAGS"
2494675c 503 AC_MSG_NOTICE([checking dyninst support])
ffbe6348
JS
504 AC_CHECK_HEADERS([BPatch_object.h], [
505 AC_SUBST(DYNINST_CXXFLAGS)
506 AC_SUBST(DYNINST_LDFLAGS)
a3524565 507 AC_DEFINE([HAVE_DYNINST],[1],[Define to 1 if Dyninst is enabled])
ffbe6348 508 have_dyninst=yes
2494675c 509 AC_MSG_NOTICE([dyninst support available])])
e0a17c00 510 if test -n "$with_dyninst" -a "$have_dyninst" != "yes"; then
2494675c
DS
511 AC_MSG_ERROR([Dyninst does not appear to be usable])
512 fi
ffbe6348
JS
513 CPPFLAGS="$old_CPPFLAGS"
514 AC_LANG_POP(C++)
515fi
138bbe90
JS
516AM_CONDITIONAL([HAVE_DYNINST], [test "${have_dyninst}" = "yes"])
517
b0c670f4 518
64b53440
JL
519dnl Check for the libvirt and libxml2 devel packages
520
b0c670f4
FCE
521AC_ARG_ENABLE([virt],
522 AS_HELP_STRING([--enable-virt],
523 [enable building of stapvirt support (default on if libvirt etc. found).]),
524 [enable_virt=$enableval],
525 [enable_virt="check"])
526
64b53440
JL
527dnl We require libvirt >= 1.0.2 because stapvirt relies on the
528dnl virDomainOpenChannel function, which was implemented in 1.0.2.
c17539a5
JL
529PKG_CHECK_MODULES([libvirt], [libvirt >= 1.0.2], [
530 have_libvirt=yes
531 AC_DEFINE([HAVE_LIBVIRT],[1],[Define to 1 if libvirt development libraries are installed])
532 ], [have_libvirt=no])
64b53440 533AM_CONDITIONAL([HAVE_LIBVIRT], [test "${have_libvirt}" = "yes"])
c17539a5
JL
534PKG_CHECK_MODULES([libxml2], [libxml-2.0], [
535 have_libxml2=yes
536 AC_DEFINE([HAVE_LIBXML2],[1],[Define to 1 if libxml2 development libraries are installed])
537 ], [have_libxml2=no])
64b53440 538AM_CONDITIONAL([HAVE_LIBXML2], [test "${have_libxml2}" = "yes"])
138bbe90 539
b0c670f4
FCE
540if test "$enable_virt" != "no"; then
541dnl See if we have enough libraries and tools to build the virt server
542 if test "x${have_libvirt}" != "xyes"; then
543 AC_MSG_WARN([will not build systemtap virt support, cannot find libvirt headers])
544 fi
545 if test "x${have_libxml2}" != "xyes"; then
546 AC_MSG_WARN([will not build systemtap virt support, cannot find xml2 headers])
547 fi
548fi
549AM_CONDITIONAL([BUILD_VIRT], [test "${have_libvirt}" == "yes" -a "${have_libxml2}" == "yes" -a "$enable_virt" != "no"])
550
11ea78d6
FL
551dnl Check for presence of json-c and ncurses for use in monitor mode
552PKG_CHECK_MODULES([jsonc], [json-c], [have_jsonc=yes], [have_jsonc=no])
553PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=yes], [have_ncurses=no])
554AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes"])
555if test "${have_jsonc}" == "yes" -a "${have_ncurses}" == yes; then
556 AC_DEFINE([HAVE_MONITOR_LIBS],[1],[Define to 1 if json-c and ncurses libraries are installed])
557fi
b0c670f4 558
f9794ee4
RM
559AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [
560old_CFLAGS="$CFLAGS"
561CFLAGS="$CFLAGS -Wa,--fatal-warnings"
5d4aa1f5 562AC_COMPILE_IFELSE([AC_LANG_SOURCE([asm(".section .note.foo,\"?\",\"note\"\n"
f9794ee4
RM
563 ".byte 1, 2, 3\n"
564 ".previous\n"
565 ".section .text,\"axG\",\"progbits\",foogroup,comdat\n"
566 ".byte 1\n"
567 ".pushsection .note.foo,\"?\",\"note\"\n"
568 ".byte 4, 5, 6\n"
569 ".popsection\n"
5d4aa1f5 570 ".byte 2\n");])],
f9794ee4 571 stap_cv_sectionq=yes, stap_cv_sectionq=no)
a530cfe0 572CFLAGS="$old_CFLAGS"])
f9794ee4
RM
573AC_SUBST(support_section_question)
574support_section_question=0
575if test $stap_cv_sectionq = yes; then
576 support_section_question=1
577fi
8f223b3e 578AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in])
f9794ee4 579
efa6ba96 580if test $build_elfutils = yes -a $enable_translator = yes; then
d2bd25ac 581 here=`pwd`
4d9087fc
RM
582 case "$with_elfutils" in
583 /*) elfutils_srcdir="$with_elfutils" ;;
d2bd25ac 584 *) elfutils_srcdir="${here}/$with_elfutils" ;;
4d9087fc 585 esac
d2bd25ac
MW
586
587 if ! test -f ${elfutils_srcdir}/configure; then
588 AC_MSG_ERROR([No ${elfutils_srcdir}/configure, forgot to run autoreconf -i?])
589 fi
4d9087fc 590 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
29b694a7
DS
591
592 save_CFLAGS="$CFLAGS"
593 save_CXXFLAGS="$CXXFLAGS"
594 CXXFLAGS="$CXXFLAGS -fgnu89-inline"
595 CFLAGS="$CFLAGS -fgnu89-inline"
596 gnu89_inline_flag=""
5d4aa1f5 597 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
29b694a7
DS
598 AC_MSG_NOTICE([Compiling elfutils with gcc -fgnu89-inline])
599 gnu89_inline_flag="-fgnu89-inline"],[
600 AC_MSG_NOTICE([Compiler does not support -fgnu89-inline])])
601 CFLAGS="$save_CFLAGS"
602 CXXFLAGS="$save_CXXFLAGS"
603
b7165f65
RM
604 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
605 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
fa1d05cd
RM
606 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
607 # So we must make sure to pass those settings to elfutils configure.
b7165f65 608 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
33ee059c
MW
609 # Check whether this is a source release, or a source checkout.
610 # We need --enable-maintainer-mode if it isn't a source release.
611 # elfutils.spec is only distributed in source releases.
612 if test -f ${elfutils_srcdir}/elfutils.spec; then
613 need_maintainer_option=""
614 else
615 need_maintainer_option="--enable-maintainer-mode"
616 fi
4d9087fc 617 (mkdir -p build-elfutils && cd build-elfutils &&
412e1bf7 618 bash ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
4d9087fc 619 --includedir="${here}/include-elfutils" \
b7165f65 620 --libdir="${here}/lib-elfutils" \
fa1d05cd
RM
621 --exec-prefix="$exec_prefix" \
622 --prefix="$prefix" \
90491495 623 --enable-dwz \
33ee059c 624 ${need_maintainer_option} \
c2444a96 625 CFLAGS="${CFLAGS/-Wall/} $gnu89_inline_flag -fexceptions" \
e016a49a 626 LDFLAGS="$LDFLAGS $elfutils_rpath" &&
e3633556 627 if test -f ${elfutils_srcdir}/config/version.h.in; then
e050d62f
MW
628 echo Found elfutils/version.h header...
629 else
630 echo elfutils/version.h header not found, need elfutils 0.142+...
631 exit -1
e3633556 632 fi
4d9087fc 633 )
e050d62f 634 if test $? != 0; then exit -1; fi
4d9087fc 635fi
5566993b 636
51030d84
JS
637dnl Optional libselinux support allows stapdyn to check
638dnl for booleans that would prevent Dyninst from working.
639AC_ARG_WITH([selinux],
640 AS_HELP_STRING([--without-selinux],
641 [Do not use libselinux even if present]))
642
643AS_IF([test "x$with_selinux" != "xno"], [
644 PKG_CHECK_MODULES([selinux], [libselinux],
645 [have_selinux=yes
646 AC_DEFINE([HAVE_SELINUX], [1], [Define to 1 if you have the SELinux libraries.])
647 ], [have_selinux=no])
648], [have_selinux=no])
649
650AM_CONDITIONAL([HAVE_SELINUX], [test "${have_selinux}" = "yes"])
651
95835e2c 652dnl Handle java+byteman support
e9b0aba1
SM
653AC_CHECK_PROG(have_javac, javac, yes, no)
654AC_CHECK_PROG(have_jar, jar, yes, no)
655if test "$have_javac" != no -a "$have_jar" != no; then
656echo java found, will try to configure Byteman support
95835e2c 657
26703c63
SM
658AC_ARG_WITH([java],
659 [AS_HELP_STRING([--with-java=DIRECTORY],
660 [Specify JDK directory to compile libHelperSDT.so against (default is /usr/lib/jvm/java)])],
93933baa 661 [],
26703c63 662 [with_java=/usr/lib/jvm/java])
ef50e368 663dnl don't use AC_CHECK_FILE here, as that blocks cross-compiling
a71e842d 664if test ! -d "$with_java"; then
ef50e368
FCE
665 with_java=no
666fi
26703c63 667AC_SUBST(JAVADIR, "${with_java}") # always needed to compile
95835e2c 668
26703c63
SM
669if test "$with_java" != "no"; then
670AC_DEFINE_UNQUOTED(HAVE_JAVA, "1", [Flag indicating that libHelperSDT.so is available (can be found in PKGLIBDIR)])
13c19b49 671fi
275cd71a 672
26703c63 673AM_CONDITIONAL([HAVE_JAVA], [test "$with_java" != "no"])
7fe06356 674
95835e2c
SM
675else
676AC_MSG_WARN([will not run per-method java probing, missing byteman or java requirements])
26703c63 677AM_CONDITIONAL([HAVE_JAVA],false)
93933baa 678fi # java+byteman support
7fe06356 679
62c8a962
FCE
680AC_SUBST(ENABLE_NLS, "$USE_NLS")
681AC_SUBST(localedir, "$localedir")
682AC_SUBST(LOCALEDIR, "$localedir")
683
85b62eab
FCE
684AC_ARG_WITH([extra-version],
685 AS_HELP_STRING([--with-extra-version=STRING],
686 [Add STRING to stap -V version]))
687AS_IF([test "x$with_extra_version" != "xno"], [
688 stap_extra_version="$with_extra_version"
689 AC_MSG_NOTICE([Adding extra version $stap_extra_version])], [
690 stap_extra_version=""])
691AC_DEFINE_UNQUOTED(STAP_EXTRA_VERSION, "$stap_extra_version", [extra stap version code])
692AC_SUBST(STAP_EXTRA_VERSION, "$stap_extra_version")
693
0de35d9e
FCE
694dnl The stap translator stringtable benefits performance-wise from c++11 constructs.
695AX_CHECK_COMPILE_FLAG([-std=c++11],[cxx11="-std=c++11"],[cxx11=""])
696AS_IF([test "x$cxx11" != "x"],[
697 AC_MSG_NOTICE([Compiling parts of systemtap with -std=c++11])])
698AC_SUBST(cxx11)
699
50431f30
MW
700dnl This is here mainly to make sure that configure --prefix=... changes
701dnl the config.h files so files depending on it are recompiled
702dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS.
2a1c9b5d
FCE
703dnl Formerly: Don't use this directly (when not given it is set to NONE).
704dnl Currently: inline autoconf's later defaulting
802cd104 705
2a1c9b5d
FCE
706stap_prefix=$prefix
707test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix
708AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location])
62c8a962 709AC_SUBST(STAP_PREFIX, "$stap_prefix")
50431f30 710
e016a49a 711AC_CONFIG_HEADERS([config.h:config.in])
a6e785fa 712AC_CONFIG_FILES([Makefile doc/Makefile man/Makefile \
c24a9d9a 713doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \
f19a1ef4 714man/stappaths.7 man/systemtap.8 \
29fe12e4 715initscript/config.systemtap initscript/config.stap-server \
e6c842d9
JL
716initscript/systemtap initscript/stap-server \
717initscript/99stap/module-setup.sh ])
97859b9d 718AC_CONFIG_SUBDIRS(testsuite)
6d14a4a9
EB
719if test $enable_translator == "yes"; then
720 AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
721fi
e4aaabda 722AC_CONFIG_FILES([dtrace], [chmod +x dtrace])
66c3c633 723AC_CONFIG_FILES(stapdyn/Makefile)
7fe06356 724AC_CONFIG_FILES(java/Makefile)
d885563b 725AC_CONFIG_FILES([java/stapbm], [chmod +x java/stapbm])
97859b9d
JS
726AC_CONFIG_FILES(staprun/Makefile)
727AC_CONFIG_FILES([staprun/run-staprun], [chmod +x staprun/run-staprun])
bf61ca10
JL
728AC_CONFIG_FILES([staprun/guest/stapshd], [chmod +x staprun/guest/stapshd])
729AC_CONFIG_FILES([staprun/guest/stapsh-daemon], [chmod +x staprun/guest/stapsh-daemon])
730AC_CONFIG_FILES([staprun/guest/stapsh@.service])
53ade4da 731
a98010af
AJ
732# Setup "shadow" directory doc/beginners that has the basic directories setup for
733# xmlto in one directory (through directory links if necessary).
53ade4da
MW
734# It would be nice to use AC_CONFIG_LINKS, but automake complains when
735# the src is a directory and not a file.
53ade4da
MW
736AC_CONFIG_COMMANDS([doc/beginners],
737 [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])
738
e016a49a
FCE
739AC_OUTPUT
740
af29024d
FCE
741if test "${prefix}" = "/usr/local"; then
742 AC_MSG_NOTICE([])
743 AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend])
744 AC_MSG_NOTICE([configuring with a prefix. For example, try])
745 AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$])
746 AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,])
747 AC_MSG_NOTICE([is not supported.])
748fi
This page took 0.257125 seconds and 5 git commands to generate.