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