]> sourceware.org Git - systemtap.git/blame - configure.ac
Rename CONTEXT regflags to probe_flags. Now simply indicates user mode.
[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
94d406fc 4AC_INIT([systemtap], 1.7, systemtap@sourceware.org, systemtap)
579d69c3
JS
5dnl ^^^ see also NEWS, systemtap.spec, testsuite/configure.ac,
6dnl runtime/staprun/configure.ac
e872ae09 7
2f1a1aea 8AC_PREREQ(2.59)
675c6934 9AM_INIT_AUTOMAKE([no-dist foreign])
2f1a1aea
FCE
10AM_MAINTAINER_MODE
11
618a8a63
JS
12m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
13
8f223b3e 14AC_USE_SYSTEM_EXTENSIONS
87cb1275 15AM_PROG_MKDIR_P
7fbd9d09 16AC_SUBST(MKDIR_P)
2f1a1aea
FCE
17AC_PROG_LN_S
18AC_PROG_CC
19AC_PROG_CXX
20AC_PROG_CPP
21AM_PROG_CC_STDC
8ae7a94a 22AM_PROG_CC_C_O
2f1a1aea 23AM_C_PROTOTYPES
2f1a1aea
FCE
24AC_PROG_RANLIB
25AC_OBJEXT
26AC_EXEEXT
27AC_PROG_INSTALL
28AC_PROG_MAKE_SET
29AC_SUBST(CFLAGS)
30AC_SUBST(CXXFLAGS)
8f223b3e 31AM_GNU_GETTEXT(external)
7316ced8 32AM_GNU_GETTEXT_VERSION
e04a4b41 33AC_CHECK_FUNCS(ppoll)
2f1a1aea 34
e8f3c2c2
DS
35dnl Handle the prologues option.
36dnl
70d28673
DS
37dnl If the user didn't specify --enable-prologues/--disable-prologues
38dnl and the x86 system has a version of gcc less than version 4,
39dnl automatically enable prologues.
40if test "${enable_prologues+set}" != set; then
41 AC_MSG_CHECKING([to see if prologue searching should be the default])
42 if { echo '#if __i386__ == 1 && __GNUC__ < 4'
43 echo ' yes '
44 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
45 enable_prologues=yes
46 AC_MSG_RESULT([yes])
47 else
48 AC_MSG_RESULT([no])
49 fi
50fi
e8f3c2c2
DS
51AC_ARG_ENABLE([prologues],
52 AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]),
53 [
70d28673
DS
54if test "$enable_prologues" = yes; then
55 AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default])
56fi])
57
e1bfefdc
SC
58dnl Handle the disable-sdt-probes option.
59dnl
60dnl Default to --disable-sdt-probes if --enable-sdt-probes/--disable-prologues
61dnl was not specified and the gcc version is less than version 4,
62
63if test "${enable_sdt_probes+set}" != set; then
64 AC_MSG_CHECKING([to see if sdt probes should be the default])
65 if { echo '#if __GNUC__ < 4'
66 echo ' yes '
67 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
68 enable_prologues=no
69 AC_MSG_RESULT([no])
70 else
71 AC_MSG_RESULT([yes])
72 fi
73fi
0f5d597d
JS
74AC_ARG_ENABLE([sdt-probes],
75 [AS_HELP_STRING([--disable-sdt-probes],
76 [disable process.mark probes in stap, staprun, stapio])])
77AS_IF([test "x$enable_sdt_probes" != xno], [
78 AC_DEFINE([ENABLE_SDT_PROBES], [1],
79 [Define to 1 to enable process.mark probes in stap, staprun, stapio.])
80])
81
9921a199 82AC_ARG_ENABLE([ssp],
bbfd8c1a
FCE
83 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
84AS_IF([test "x$enable_ssp" != xno],[
85 save_CFLAGS="$CFLAGS"
86 save_CXXFLAGS="$CXXFLAGS"
f0510eaa
FCE
87 CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
88 CFLAGS="$CFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
5d4aa1f5 89 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
f0510eaa
FCE
90 AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.])
91 CFLAGS="$save_CFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"
a530cfe0 92 CXXFLAGS="$save_CXXFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"],[
bbfd8c1a
FCE
93 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
94 CFLAGS="$save_CFLAGS"
95 CXXFLAGS="$save_CXXFLAGS"])])
70d28673 96
cbe7ea07
FCE
97
98dnl Link with gold if possible
99dnl but: https://bugzilla.redhat.com/show_bug.cgi?id=636603
100dnl
101dnl AC_PATH_PROG(GOLD, [ld.gold], [no])
102dnl if test "x$GOLD" != "xno"
103dnl then
104dnl mkdir -p Bdir
105dnl ln -sf $GOLD Bdir/ld
106dnl LDFLAGS="$LDFLAGS -B`pwd`/Bdir/"
107dnl AC_MSG_NOTICE([using ld.gold to link])
108dnl fi
109
110
e1e3ba36 111# Compiling without fPIE by default (see PR 9922)
8730f377 112AC_ARG_ENABLE([pie],
882ddac1 113 [AS_HELP_STRING([--enable-pie], [enable position-independent-executable])])
e1e3ba36 114AS_IF([test "x$enable_pie" == xyes],[
8730f377
FCE
115 save_CFLAGS="$CFLAGS"
116 save_CXXFLAGS="$CXXFLAGS"
117 save_LDFLAGS="$LDFLAGS"
7b53a460
SD
118 CFLAGS="$CFLAGS -fPIE"
119 CXXFLAGS="$CXXFLAGS -fPIE"
8730f377 120 LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now"
5d4aa1f5 121 AC_LINK_IFELSE([AC_LANG_SOURCE([void main () {}])], [
8730f377
FCE
122 AC_MSG_NOTICE([Compiling with gcc pie et al.])
123 # LDFLAGS is special since it may be passed down to bundled-elfutils,
124 # and interfere with the .so's built therein
5574ef2c 125 PIELDFLAGS="$LDFLAGS"
8730f377 126 LDFLAGS="$save_LDFLAGS"
5574ef2c
MW
127 PIECFLAGS="$CFLAGS"
128 CFLAGS="$save_CFLAGS"
129 PIECXXFLAGS="$CXXFLAGS"
130 CXXFLAGS="$save_CXXFLAGS"
8730f377
FCE
131 ],[
132 AC_MSG_NOTICE([Compiler does not support -pie et al.])
5574ef2c 133 PIECFLAGS=""
8730f377 134 CFLAGS="$save_CFLAGS"
5574ef2c 135 PIECXXFLAGS=""
8730f377
FCE
136 CXXFLAGS="$save_CXXFLAGS"
137 PIELDFLAGS=""
138 LDFLAGS="$save_LDFLAGS"])])
139AC_SUBST(PIELDFLAGS)
5574ef2c
MW
140AC_SUBST(PIECFLAGS)
141AC_SUBST(PIECXXFLAGS)
8730f377 142
9921a199
DS
143dnl Handle optional sqlite support. If enabled/disabled by the user,
144dnl do the right thing. If not specified by the user, use it if
145dnl present.
146AC_ARG_ENABLE([sqlite],
e8f3c2c2
DS
147 AS_HELP_STRING([--enable-sqlite], [build with sqlite support]),
148 [], dnl ACTION-IF-GIVEN
149 [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN
9921a199
DS
150sqlite3_LIBS=
151AS_IF([test "x$enable_sqlite" != xno],
152 [AC_CHECK_LIB([sqlite3], [sqlite3_open],
07606685 153 [AC_SUBST([sqlite3_LIBS], [-lsqlite3])
0d563e60 154 AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the `sqlite3' library (-lsqlite3).])],
9921a199
DS
155 [if test "x$enable_sqlite" != xcheck; then
156 AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite failed])
157 fi])])
e6c086bb 158
6d14a4a9
EB
159dnl Handle the option to only build runtime
160AC_ARG_ENABLE([translator],
161 AS_HELP_STRING([--disable-translator], [build only runtime utilities]),
162 [],
163 [enable_translator="yes"])
164AM_CONDITIONAL([BUILD_TRANSLATOR], [test "$enable_translator" == "yes"])
165
564eb0a8
DS
166dnl Handle the option to build the crash extension
167AC_ARG_ENABLE([crash],
168 AS_HELP_STRING([--enable-crash@<:@=DIRECTORY@:>@],
169 [enable crash extension (default is disabled). Optional DIRECTORY
170 is the path to the crash header file (needed if installed in a
171 non-standard location).]),
172 [if test "$enable_crash" != "no"; then
173 dnl Handle custom install dir (if needed)
174 save_CPPFLAGS="$CPPFLAGS"
175 if test "$enable_crash" != "yes"; then
176 staplog_CPPFLAGS=-I$enable_crash
177 CPPFLAGS="${staplog_CPPFLAGS} $CPPFLAGS"
178 AC_SUBST([staplog_CPPFLAGS])
179 fi
180 AC_CHECK_HEADERS([crash/defs.h], [],
181 [AC_MSG_ERROR([cannot find required crash header (crash-devel may need to be installed)])],
182 [
e8f3c2c2 183#define NR_CPUS 256
564eb0a8
DS
184 ])
185 CPPFLAGS="$save_CPPFLAGS"
186 fi],
187 [enable_crash="no"])
188AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"])
e6c086bb 189
465e8fbf 190dnl Handle the option to build the documentation
92aff3c7 191building_docs="no"
465e8fbf
FCE
192AC_ARG_ENABLE([docs],
193 AS_HELP_STRING([--enable-docs],
194 [enable building documentation (default on if latex etc. found).]),
195 [enable_docs=$enableval],
196 [enable_docs="check"])
197AC_CHECK_PROG(have_latex, latex, yes, no)
198AC_CHECK_PROG(have_dvips, dvips, yes, no)
199AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no)
308525e3
EM
200AC_CHECK_PROG(have_latex2html, latex2html, yes, no)
201if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" != "xyesyesyesyes"; then
2d4b8ddf 202 if test "$enable_docs" == "yes"; then
465e8fbf
FCE
203 AC_MSG_ERROR([cannot find all tools for building documentation])
204 fi
2d4b8ddf
MW
205 if test "$enable_docs" == "check"; then
206 AC_MSG_WARN([will not build documentation, cannot find all tools])
207 fi
465e8fbf 208fi
308525e3 209if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"; then
92aff3c7
WC
210 building_docs="yes"
211fi
212AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" == "yes"])
213
53ade4da
MW
214dnl Handle the options to build the publican options
215building_publican="no"
216AC_ARG_ENABLE([publican],
217 AS_HELP_STRING([--enable-publican],
218 [enable building publican documentation guides (default on if publican found and other documentation built).]),
219 [enable_publican=$enableval],
220 [enable_publican="check"])
221if test "$building_docs" == "no" -a "$enable_publican" == "yes" ; then
222 AC_MSG_ERROR([must use --enable-docs with --enable-publican])
223fi
224AC_CHECK_PROG(have_publican, publican, yes, no)
225if test "$enable_publican" == "yes"; then
226 if test "x${have_publican}" != "xyes"; then
227 AC_MSG_ERROR([cannot find publican for building publican guides])
228 fi
229fi
230if test "x${have_publican}" == "xyes" -a "$enable_publican" != "no" -a "${building_docs}" == "yes"; then
231 building_publican="yes"
232fi
233AM_CONDITIONAL([BUILD_PUBLICAN], [test "$building_publican" == "yes"])
89bc1a6a 234publican_brand="common"
53ade4da
MW
235AC_ARG_WITH([publican-brand],
236 AS_HELP_STRING([--with-publican-brand=BRAND],
89bc1a6a 237 [building publican documentation guides using given brand (defaults to "common").]),
53ade4da 238 [publican_brand=$withval],
89bc1a6a 239 [publican_brand="common"])
53ade4da
MW
240PUBLICAN_BRAND=$publican_brand
241AC_SUBST(PUBLICAN_BRAND)
242
92aff3c7
WC
243dnl Handle the option to build the reference documentation
244building_refdocs="no"
245AC_ARG_ENABLE([refdocs],
246 AS_HELP_STRING([--enable-refdocs],
247 [enable building reference documentation (default on if xmlto etc. found and other documentation built).]),
248 [enable_refdocs=$enableval],
249 [enable_refdocs="check"])
250if test "$building_docs" == "no" -a "$enable_refdocs" == "yes" ; then
251 AC_MSG_ERROR([must use --enable-docs with --enable-refdocs])
252fi
253AC_CHECK_PROG(have_xmlto, xmlto, yes, no)
023337aa
EM
254if test "$enable_refdocs" == "yes"; then
255 if test "x${have_xmlto}" != "xyes"; then
256 AC_MSG_ERROR([cannot find xmlto for building reference documentation])
257 fi
258fi
259if test "x${have_xmlto}" == "xyes" -a "$enable_refdocs" != "no" -a "${building_docs}" == "yes"; then
260 building_refdocs="yes"
261fi
262AM_CONDITIONAL([BUILD_REFDOCS], [test "$building_refdocs" == "yes"])
263
a8fcf687
MW
264dnl There is a strange bug in older versions of xmlto when generating pdf.
265dnl https://bugzilla.redhat.com/show_bug.cgi?id=526273
266dnl So make sure to have a chapter title starting with L plus an refentry.
267dnl This will make sure the xmlto pdf support test fails on buggy versions.
468abaf4 268cat > conftest.xml << 'EOF'
aa5951be
WC
269<?xml version="1.0" encoding="UTF-8"?>
270<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
271"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
468abaf4
FCE
272 <book lang="en">
273 <bookinfo><title>foo</title></bookinfo>
a8fcf687
MW
274 <chapter id="logging.stp"><title>Logging Tapset</title>
275 <refentry id="API-log"><refnamediv><refname>log</refname>
276 <refpurpose>logging</refpurpose></refnamediv>
277 <refsect1><title>Description</title>
278 <para>baz</para></refsect1></refentry></chapter>
aa5951be
WC
279 </book>
280EOF
468abaf4
FCE
281
282if test "x${have_xmlto}" == "xyes"; then
283AC_MSG_CHECKING([for xmlto --stringparam support])
b653135b 284 xmlto --stringparam man.authors.section.enabled=0 html-nochunks conftest.xml >/dev/null 2>&1
468abaf4
FCE
285 if test $? == 0; then
286 have_xmlto_stringparam="yes"
287 AC_MSG_RESULT([yes])
288 else
289 AC_MSG_RESULT([no])
290 fi
b653135b 291 rm -f conftest.html
468abaf4
FCE
292fi
293AM_CONDITIONAL([XMLTO_STRINGPARAM], [test "$have_xmlto_stringparam" == "yes"])
294
295if test "x${building_refdocs}" == "xyes"; then
296AC_MSG_CHECKING([for xmlto pdf support])
297 xmlto pdf conftest.xml >& /dev/null
aa5951be
WC
298 if test $? == 0; then
299 have_xmlto_pdf="yes"
300 AC_MSG_RESULT([yes])
301 else
302 AC_MSG_RESULT([no])
023337aa 303 AC_MSG_WARN([Not building reference documentation in PDF format])
aa5951be 304 fi
468abaf4 305 rm -f conftest.pdf
aa5951be 306fi
a8fcf687 307AM_CONDITIONAL([BUILD_PDFREFDOCS], [test "$have_xmlto_pdf" == "yes"])
465e8fbf 308
468abaf4
FCE
309rm -f conftest.xml
310
a0e2728a 311dnl See if we have the nss/nspr headers and libraries
28f121c3
DEP
312AC_ARG_WITH([nss],
313 AS_HELP_STRING([--without-nss],
314 [Do not use NSS even if present]))
315
316AS_IF([test "x$with_nss" != "xno"], [
317 PKG_CHECK_MODULES([nss], [nss >= 3],
318 [have_nss=yes
319 AC_DEFINE([HAVE_NSS], [1], [Define to 1 if you have the nss libraries.])
320 ], [have_nss=no])
321], [have_nss=no])
322
f5a118c0 323AM_CONDITIONAL([HAVE_NSS], [test "${have_nss}" = "yes"])
468abaf4 324
a0e2728a 325dnl Handle the option to build the compile server.
19a0d4b6 326AC_ARG_ENABLE([server],
6275c8d7 327 AS_HELP_STRING([--enable-server],
a0e2728a 328 [enable building of stap-server (default on if nss etc. found).]),
19a0d4b6
MW
329 [enable_server=$enableval],
330 [enable_server="check"])
a0e2728a 331
161f9ed6 332if test "$enable_server" != "no"; then
a0e2728a 333dnl See if we have enough libraries and tools to build the compile server
f5a118c0
DEP
334 if test "x${have_nss}" != "xyes"; then
335 AC_MSG_WARN([will not build systemtap compile server, cannot find nss headers])
a0e2728a 336 fi
19a0d4b6 337fi
f5a118c0 338AM_CONDITIONAL([BUILD_SERVER], [test "${have_nss}" == "yes" -a "$enable_server" != "no"])
a0e2728a 339
f5a118c0
DEP
340if test "${have_nss}" != "yes"; then
341 AC_MSG_WARN([some compile server client functionality will be restricted, cannot find nss development files])
a0e2728a 342fi
a0e2728a
DB
343
344dnl See if we have the avahi libraries and headers
28f121c3
DEP
345AC_ARG_WITH([avahi],
346 AS_HELP_STRING([--without-avahi],
347 [Do not use Avahi even if present]))
348
349AS_IF([test "x$with_avahi" != "xno"], [
350 PKG_CHECK_MODULES([avahi], [avahi-client],
351 [have_avahi=yes
352 AC_DEFINE([HAVE_AVAHI], [1], [Define to 1 if you have the avahi libraries.])
353 ], [have_avahi=no])
354], [have_avahi=no])
355
f5a118c0
DEP
356AM_CONDITIONAL([HAVE_AVAHI], [test "${have_avahi}" = "yes"])
357
358if test "${have_avahi}" != "yes"; then
359 AC_MSG_WARN([some compile-server functionality will be restricted, cannot find avahi development files])
a0e2728a 360fi
43498922 361
1087b83f
TM
362dnl Handle the optional grapher
363AC_ARG_ENABLE([grapher],
364 AS_HELP_STRING([--enable-grapher],
f8a49389 365 [enable building of grapher (default on if needed requirements are found).]),
c3f070d9
DS
366 [], dnl ACTION-IF-GIVEN
367 [enable_grapher="check"]) dnl ACTION-IF-NOT-GIVEN
f8a49389 368dnl If the user didn't disable the grapher, check the grapher's requirements.
c3f070d9 369AS_IF([test "x$enable_grapher" != xno],
f8a49389
DS
370 [
371 dnl Check for gtkmm. Strictly speaking, this isn't necessary,
372 dnl since the libglademm24-devel rpm requires the gtkmm24-devel
373 dnl rpm. But, this could be a non-rpm system. This check will
374 dnl give the user a better idea about how to fix missing
375 dnl requirements.
376 PKG_CHECK_MODULES([gtkmm], [gtkmm-2.4 >= 2.8.0],
377 have_gtkmm="yes", have_gtkmm="no")
378 AS_IF([test "x${have_gtkmm}" == "xno" -a x"$enable_grapher" == "xyes"],
f9794ee4 379 AC_MSG_WARN([systemtap cannot find required gtkmm libs (gtkmm24-devel version 2.8.0 or higher may need to be installed)]))
f8a49389
DS
380
381 dnl Check for libglade
382 PKG_CHECK_MODULES([libglade], [libglademm-2.4 >= 2.6.7],
383 have_libglade="yes", have_libglade="no")
384 AS_IF([test "x${have_libglade}" == "xno" -a x"$enable_grapher" == "xyes"],
f9794ee4 385 AC_MSG_WARN([systemtap cannot find required libglade libs (libglademm24-devel version 2.6.7 or higher may need to be installed)]))
f8a49389
DS
386
387 dnl Check for needed boost headers
388 have_boost_headers="yes"
389 AC_LANG_PUSH(C++)
390 AC_CHECK_HEADERS([boost/algorithm/string.hpp boost/range.hpp],
391 [], have_boost_headers="no")
392 AC_LANG_POP(C++)
393 AS_IF([test "x${have_boost_headers}" == "xno" -a x"$enable_grapher" == "xyes"],
394 AC_MSG_WARN([cannot find required boost headers (boost-devel may need to be installed)]))
395
396 dnl Bundle up all the grapher requirements into 1 variable.
397 AS_IF([test "x${have_gtkmm}${have_libglade}${have_boost_headers}" == "xyesyesyes"],
398 have_grapher_reqs="yes", have_grapher_reqs="no")
399 ])
c3f070d9 400dnl If the user explicitly said to enable the grapher, but we can't
f8a49389
DS
401dnl (since one or more of its requirements aren't installed), error.
402AS_IF([test "x${have_grapher_reqs}" == "xno" -a x"$enable_grapher" == "xyes"],
403 AC_MSG_ERROR([systemtap cannot find grapher build requirements (gtkmm, libglade, and boost headers)]))
404dnl If the user didn't say to disable the grapher, and all the
405dnl requirements are installed, enable the grapher.
406AM_CONDITIONAL([BUILD_GRAPHER], [test "x${have_grapher_reqs}" == "xyes" -a x"$enable_grapher" != "xno"])
1087b83f 407
bcfa72ed 408dnl Look for librpm.
2ed04863
WC
409AC_ARG_WITH([rpm],
410 [AS_HELP_STRING([--with-rpm],
bcfa72ed
FCE
411 [query rpm database for missing debuginfos])], [], [with_rpm="auto"])
412if test "$with_rpm" != "no"; then
12c1a007
FCE
413 AC_CHECK_LIB(rpm, rpmtsInitIterator, [
414 AC_DEFINE([HAVE_LIBRPM],[1],[have librpm])
415 stap_LIBS="$stap_LIBS -lrpm"
416 have_librpm="yes"], [have_librpm="no"])
44edbcd6
JS
417 AC_CHECK_LIB(rpmio, rpmFreeCrypto, [
418 AC_DEFINE([HAVE_LIBRPMIO],[1],[have librpmio])
419 stap_LIBS="$stap_LIBS -lrpmio"
420 have_librpmio="yes"], [have_librpmio="no"])
bcfa72ed
FCE
421 if test "x$have_librpm" != "xyes" -a "$with_rpm" == "yes"; then
422 AC_MSG_ERROR([cannot find librpm])
2ed04863 423 fi
44edbcd6
JS
424 if test "x$have_librpmio" != "xyes" -a "$with_rpm" == "yes"; then
425 AC_MSG_WARN([cannot find librpmio])
426 fi
2ed04863
WC
427fi
428
429
e8f3c2c2
DS
430dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
431dnl the system's elfutils.
4d9087fc
RM
432build_elfutils=no
433AC_ARG_WITH([elfutils],
e8f3c2c2
DS
434 AS_HELP_STRING([--with-elfutils=DIRECTORY],
435 [find elfutils source code in DIRECTORY]),
436 [
4d9087fc
RM
437case "$with_elfutils" in
438yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
439''|no) ;;
440*) build_elfutils=yes ;;
441esac])
442AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
fa1d05cd
RM
443AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
444 [cd $with_elfutils && pwd])`)
445
efa6ba96
PP
446if test $enable_translator = yes; then
447 if test $build_elfutils = no; then
448 # Need libdwfl-capable recent elfutils http://elfutils.fedorahosted.org/
c14263d8
FCE
449
450 # On modern debian/ubuntu, libebl has been merged into libdw
451 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=457543
452 save_LIBS="$LIBS"
453 AC_CHECK_LIB(ebl, ebl_get_elfmachine,[ebl_LIBS=-lebl],[ebl_LIBS=])
454 LIBS="$save_LIBS"
455
efa6ba96
PP
456 save_LIBS="$LIBS"
457 AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
458 AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])],
c14263d8 459 [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf])
e050d62f
MW
460 AC_CHECK_LIB(dw, dwarf_getcfi_elf,[],[
461 AC_MSG_ERROR([elfutils, libdw too old, need 0.142+])],
c14263d8
FCE
462 [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf])
463 stap_LIBS="$stap_LIBS -Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf"
efa6ba96
PP
464 LIBS="$save_LIBS"
465 else
466 # We built our own and stap_LDFLAGS points at the install.
12c1a007 467 stap_LIBS="$stap_LIBS -Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
efa6ba96 468 fi
4d9087fc 469fi
a74dd276 470
6b1a0274
WC
471AC_SUBST(stap_LIBS)
472AC_MSG_NOTICE([stap will link $stap_LIBS])
c3a3c0c9 473
cbe7ea07 474
69c68955
FCE
475dnl Plop in the build (configure) date
476date=`date +%Y-%m-%d`
477AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
82fab474 478AC_SUBST(DATE, "$date")
69c68955 479
47f390f9
FCE
480# Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun
481# being compiled on 32-bit userspace but running against 64-bit kernels.
482# This is no longer necessary.
5566993b 483
3bf6ac45
TM
484# Use tr1/unordered_map if available
485AC_LANG_PUSH(C++)
486AC_CHECK_HEADERS([tr1/unordered_map])
469c1a1b
FCE
487AC_CHECK_HEADERS([tr1/memory])
488AC_CHECK_HEADERS([boost/shared_ptr.hpp])
3bf6ac45
TM
489AC_LANG_POP(C++)
490
4d9087fc 491
f9794ee4
RM
492AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [
493old_CFLAGS="$CFLAGS"
494CFLAGS="$CFLAGS -Wa,--fatal-warnings"
5d4aa1f5 495AC_COMPILE_IFELSE([AC_LANG_SOURCE([asm(".section .note.foo,\"?\",\"note\"\n"
f9794ee4
RM
496 ".byte 1, 2, 3\n"
497 ".previous\n"
498 ".section .text,\"axG\",\"progbits\",foogroup,comdat\n"
499 ".byte 1\n"
500 ".pushsection .note.foo,\"?\",\"note\"\n"
501 ".byte 4, 5, 6\n"
502 ".popsection\n"
5d4aa1f5 503 ".byte 2\n");])],
f9794ee4 504 stap_cv_sectionq=yes, stap_cv_sectionq=no)
a530cfe0 505CFLAGS="$old_CFLAGS"])
f9794ee4
RM
506AC_SUBST(support_section_question)
507support_section_question=0
508if test $stap_cv_sectionq = yes; then
509 support_section_question=1
510fi
8f223b3e 511AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in])
f9794ee4 512
efa6ba96 513if test $build_elfutils = yes -a $enable_translator = yes; then
4d9087fc
RM
514 case "$with_elfutils" in
515 /*) elfutils_srcdir="$with_elfutils" ;;
516 *) elfutils_srcdir="../$with_elfutils" ;;
517 esac
518 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
29b694a7
DS
519
520 save_CFLAGS="$CFLAGS"
521 save_CXXFLAGS="$CXXFLAGS"
522 CXXFLAGS="$CXXFLAGS -fgnu89-inline"
523 CFLAGS="$CFLAGS -fgnu89-inline"
524 gnu89_inline_flag=""
5d4aa1f5 525 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
29b694a7
DS
526 AC_MSG_NOTICE([Compiling elfutils with gcc -fgnu89-inline])
527 gnu89_inline_flag="-fgnu89-inline"],[
528 AC_MSG_NOTICE([Compiler does not support -fgnu89-inline])])
529 CFLAGS="$save_CFLAGS"
530 CXXFLAGS="$save_CXXFLAGS"
531
b7165f65
RM
532 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
533 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
fa1d05cd
RM
534 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
535 # So we must make sure to pass those settings to elfutils configure.
b7165f65 536 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
4d9087fc
RM
537 here=`pwd`
538 (mkdir -p build-elfutils && cd build-elfutils &&
412e1bf7 539 bash ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
4d9087fc 540 --includedir="${here}/include-elfutils" \
b7165f65 541 --libdir="${here}/lib-elfutils" \
fa1d05cd
RM
542 --exec-prefix="$exec_prefix" \
543 --prefix="$prefix" \
29b694a7 544 CFLAGS="${CFLAGS/-Wall/} $gnu89_inline_flag" \
e016a49a 545 LDFLAGS="$LDFLAGS $elfutils_rpath" &&
e3633556 546 if test -f ${elfutils_srcdir}/config/version.h.in; then
e050d62f
MW
547 echo Found elfutils/version.h header...
548 else
549 echo elfutils/version.h header not found, need elfutils 0.142+...
550 exit -1
e3633556 551 fi
4d9087fc 552 )
e050d62f 553 if test $? != 0; then exit -1; fi
4d9087fc 554fi
5566993b 555
62c8a962
FCE
556AC_SUBST(ENABLE_NLS, "$USE_NLS")
557AC_SUBST(localedir, "$localedir")
558AC_SUBST(LOCALEDIR, "$localedir")
559
50431f30
MW
560dnl This is here mainly to make sure that configure --prefix=... changes
561dnl the config.h files so files depending on it are recompiled
562dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS.
2a1c9b5d
FCE
563dnl Formerly: Don't use this directly (when not given it is set to NONE).
564dnl Currently: inline autoconf's later defaulting
802cd104 565
2a1c9b5d
FCE
566stap_prefix=$prefix
567test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix
568AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location])
62c8a962 569AC_SUBST(STAP_PREFIX, "$stap_prefix")
50431f30 570
e016a49a 571AC_CONFIG_HEADERS([config.h:config.in])
c24a9d9a
WC
572AC_CONFIG_FILES([Makefile doc/Makefile \
573doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \
574grapher/Makefile \
ec1a2239
LB
575grapher/stapgraph.1 \
576stappaths.7 \
577initscript/systemtap initscript/stap-server ])
1bb80d04 578AC_CONFIG_SUBDIRS(testsuite runtime/staprun)
6d14a4a9
EB
579if test $enable_translator == "yes"; then
580 AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
581fi
e4aaabda 582AC_CONFIG_FILES([dtrace], [chmod +x dtrace])
53ade4da
MW
583
584# Setup "shadow" directory doc/beginners that has everything setup for
585# publican in one directory (through directory links if necessary).
586# It would be nice to use AC_CONFIG_LINKS, but automake complains when
587# the src is a directory and not a file.
588AC_CONFIG_FILES([doc/beginners/publican.cfg:doc/SystemTap_Beginners_Guide/publican.cfg.in])
589AC_CONFIG_COMMANDS([doc/beginners],
590 [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])
591
e016a49a
FCE
592AC_OUTPUT
593
af29024d
FCE
594if test "${prefix}" = "/usr/local"; then
595 AC_MSG_NOTICE([])
596 AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend])
597 AC_MSG_NOTICE([configuring with a prefix. For example, try])
598 AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$])
599 AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,])
600 AC_MSG_NOTICE([is not supported.])
601fi
This page took 0.165337 seconds and 5 git commands to generate.