]> sourceware.org Git - systemtap.git/blame - configure.ac
PR13102 nfs tapsets should have structured comments
[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
DB
311dnl See if we have the nss/nspr headers and libraries
312AC_CHECK_FILE([/usr/include/nss3], nssdir=nss3, [
313 AC_CHECK_FILE([/usr/include/nss], nssdir=nss)
314])
315AC_CHECK_FILE([/usr/include/nspr4], nsprdir=nspr4, [
316 AC_CHECK_FILE([/usr/include/nspr], nsprdir=nspr)
317])
318if test "x$nssdir" != "x" -a "x$nsprdir" != "x"; then
319 nss_CFLAGS="-I/usr/include/$nssdir"
320 nspr_CFLAGS="-I/usr/include/$nsprdir"
321 AC_SUBST(nss_CFLAGS)
322 AC_SUBST(nspr_CFLAGS)
323 save_CPPFLAGS="$CPPFLAGS"
324 CPPFLAGS="$CFLAGS $nss_CFLAGS $nspr_CFLAGS"
325 have_nss_includes=yes
326 AC_CHECK_HEADERS(["$nsprdir/nspr.h" "$nsprdir/plgetopt.h" "$nsprdir/prerror.h" "$nssdir/ssl.h" "$nssdir/nss.h" "$nssdir/pk11func.h" "$nssdir/secerr.h"], [], have_nss_includes=no)
327 CPPFLAGS="$save_CPPFLAGS"
328 have_nss_libs=no
329fi
330AC_CHECK_LIB(nspr4, PR_Connect, [
331 AC_CHECK_LIB(ssl3, SSL_ReHandshake, have_nss_libs=yes)
332])
333if test "x${have_nss_includes}${have_nss_libs}" = "xyesyes"; then
334 AC_DEFINE([HAVE_NSS], [1], [Define to 1 if you have the nss libraries.])
335fi
336AM_CONDITIONAL([HAVE_NSS], [test "x${have_nss_includes}${have_nss_libs}" == "xyesyes"])
468abaf4 337
a0e2728a 338dnl Handle the option to build the compile server.
19a0d4b6 339AC_ARG_ENABLE([server],
6275c8d7 340 AS_HELP_STRING([--enable-server],
a0e2728a 341 [enable building of stap-server (default on if nss etc. found).]),
19a0d4b6
MW
342 [enable_server=$enableval],
343 [enable_server="check"])
a0e2728a 344
161f9ed6 345if test "$enable_server" != "no"; then
a0e2728a
DB
346dnl See if we have enough libraries and tools to build the compile server
347 if test "x${have_nss_includes}" != "xyes"; then
348 AC_MSG_WARN([will not build systemtap compile server, cannot find nss/nspr headers])
349 fi
350 if test "x${have_nss_libs}" != "xyes"; then
351 AC_MSG_WARN([will not build systemtap compile server, cannot find nss/nspr libraries])
19a0d4b6
MW
352 fi
353fi
aeb9cc10 354AM_CONDITIONAL([BUILD_SERVER], [test "x${have_nss_includes}${have_nss_libs}" == "xyesyes" -a "$enable_server" != "no"])
a0e2728a
DB
355
356if test "x${have_nss_includes}" != "xyes"; then
357 AC_MSG_WARN([some compile server client functionality will be restricted, cannot find nss/nspr headers])
358fi
359if test "x${have_nss_libs}" != "xyes"; then
360 AC_MSG_WARN([some compile server client functionality will be restricted, cannot find nss/nspr libraries])
361fi
362
363dnl See if we have the avahi libraries and headers
364AC_CHECK_FILE([/usr/include/avahi-client], avahi_clientdir=avahi-client)
365AC_CHECK_FILE([/usr/include/avahi-common], avahi_commondir=avahi-common)
366if test "x$avahi_clientdir" != "x" -a "x$avahi_commondir" != "x"; then
367 have_avahi_includes=yes
368 AC_CHECK_HEADERS(["$avahi_clientdir/client.h" "$avahi_clientdir/lookup.h" "$avahi_commondir/simple-watch.h" "$avahi_commondir/malloc.h" "$avahi_commondir/error.h"], [], have_avahi_includes=no)
369 have_avahi_libs=no
370fi
371AC_CHECK_LIB(avahi-client, avahi_client_new,
372 AC_CHECK_LIB(avahi-common, avahi_strerror, have_avahi_libs=yes))
373if test "x${have_avahi_includes}" != "xyes"; then
fd14bd8f 374 AC_MSG_WARN([some compile-server functionality will be restricted, cannot find avahi headers])
a0e2728a
DB
375fi
376if test "x${have_avahi_libs}" != "xyes"; then
fd14bd8f 377 AC_MSG_WARN([some compile-server functionality will be restricted, cannot find avahi libraries])
a0e2728a
DB
378fi
379if test "x${have_avahi_includes}${have_avahi_libs}" = "xyesyes"; then
380 AC_DEFINE([HAVE_AVAHI], [1], [Define to 1 if you have the avahi libraries.])
381fi
382AM_CONDITIONAL([HAVE_AVAHI], [test "x${have_avahi_includes}${have_avahi_libs}" == "xyesyes"])
43498922 383
1087b83f
TM
384dnl Handle the optional grapher
385AC_ARG_ENABLE([grapher],
386 AS_HELP_STRING([--enable-grapher],
f8a49389 387 [enable building of grapher (default on if needed requirements are found).]),
c3f070d9
DS
388 [], dnl ACTION-IF-GIVEN
389 [enable_grapher="check"]) dnl ACTION-IF-NOT-GIVEN
f8a49389 390dnl If the user didn't disable the grapher, check the grapher's requirements.
c3f070d9 391AS_IF([test "x$enable_grapher" != xno],
f8a49389
DS
392 [
393 dnl Check for gtkmm. Strictly speaking, this isn't necessary,
394 dnl since the libglademm24-devel rpm requires the gtkmm24-devel
395 dnl rpm. But, this could be a non-rpm system. This check will
396 dnl give the user a better idea about how to fix missing
397 dnl requirements.
398 PKG_CHECK_MODULES([gtkmm], [gtkmm-2.4 >= 2.8.0],
399 have_gtkmm="yes", have_gtkmm="no")
400 AS_IF([test "x${have_gtkmm}" == "xno" -a x"$enable_grapher" == "xyes"],
f9794ee4 401 AC_MSG_WARN([systemtap cannot find required gtkmm libs (gtkmm24-devel version 2.8.0 or higher may need to be installed)]))
f8a49389
DS
402
403 dnl Check for libglade
404 PKG_CHECK_MODULES([libglade], [libglademm-2.4 >= 2.6.7],
405 have_libglade="yes", have_libglade="no")
406 AS_IF([test "x${have_libglade}" == "xno" -a x"$enable_grapher" == "xyes"],
f9794ee4 407 AC_MSG_WARN([systemtap cannot find required libglade libs (libglademm24-devel version 2.6.7 or higher may need to be installed)]))
f8a49389
DS
408
409 dnl Check for needed boost headers
410 have_boost_headers="yes"
411 AC_LANG_PUSH(C++)
412 AC_CHECK_HEADERS([boost/algorithm/string.hpp boost/range.hpp],
413 [], have_boost_headers="no")
414 AC_LANG_POP(C++)
415 AS_IF([test "x${have_boost_headers}" == "xno" -a x"$enable_grapher" == "xyes"],
416 AC_MSG_WARN([cannot find required boost headers (boost-devel may need to be installed)]))
417
418 dnl Bundle up all the grapher requirements into 1 variable.
419 AS_IF([test "x${have_gtkmm}${have_libglade}${have_boost_headers}" == "xyesyesyes"],
420 have_grapher_reqs="yes", have_grapher_reqs="no")
421 ])
c3f070d9 422dnl If the user explicitly said to enable the grapher, but we can't
f8a49389
DS
423dnl (since one or more of its requirements aren't installed), error.
424AS_IF([test "x${have_grapher_reqs}" == "xno" -a x"$enable_grapher" == "xyes"],
425 AC_MSG_ERROR([systemtap cannot find grapher build requirements (gtkmm, libglade, and boost headers)]))
426dnl If the user didn't say to disable the grapher, and all the
427dnl requirements are installed, enable the grapher.
428AM_CONDITIONAL([BUILD_GRAPHER], [test "x${have_grapher_reqs}" == "xyes" -a x"$enable_grapher" != "xno"])
1087b83f 429
bcfa72ed 430dnl Look for librpm.
2ed04863
WC
431AC_ARG_WITH([rpm],
432 [AS_HELP_STRING([--with-rpm],
bcfa72ed
FCE
433 [query rpm database for missing debuginfos])], [], [with_rpm="auto"])
434if test "$with_rpm" != "no"; then
12c1a007
FCE
435 AC_CHECK_LIB(rpm, rpmtsInitIterator, [
436 AC_DEFINE([HAVE_LIBRPM],[1],[have librpm])
437 stap_LIBS="$stap_LIBS -lrpm"
438 have_librpm="yes"], [have_librpm="no"])
44edbcd6
JS
439 AC_CHECK_LIB(rpmio, rpmFreeCrypto, [
440 AC_DEFINE([HAVE_LIBRPMIO],[1],[have librpmio])
441 stap_LIBS="$stap_LIBS -lrpmio"
442 have_librpmio="yes"], [have_librpmio="no"])
bcfa72ed
FCE
443 if test "x$have_librpm" != "xyes" -a "$with_rpm" == "yes"; then
444 AC_MSG_ERROR([cannot find librpm])
2ed04863 445 fi
44edbcd6
JS
446 if test "x$have_librpmio" != "xyes" -a "$with_rpm" == "yes"; then
447 AC_MSG_WARN([cannot find librpmio])
448 fi
2ed04863
WC
449fi
450
451
e8f3c2c2
DS
452dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
453dnl the system's elfutils.
4d9087fc
RM
454build_elfutils=no
455AC_ARG_WITH([elfutils],
e8f3c2c2
DS
456 AS_HELP_STRING([--with-elfutils=DIRECTORY],
457 [find elfutils source code in DIRECTORY]),
458 [
4d9087fc
RM
459case "$with_elfutils" in
460yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
461''|no) ;;
462*) build_elfutils=yes ;;
463esac])
464AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
fa1d05cd
RM
465AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
466 [cd $with_elfutils && pwd])`)
467
efa6ba96
PP
468if test $enable_translator = yes; then
469 if test $build_elfutils = no; then
470 # Need libdwfl-capable recent elfutils http://elfutils.fedorahosted.org/
c14263d8
FCE
471
472 # On modern debian/ubuntu, libebl has been merged into libdw
473 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=457543
474 save_LIBS="$LIBS"
475 AC_CHECK_LIB(ebl, ebl_get_elfmachine,[ebl_LIBS=-lebl],[ebl_LIBS=])
476 LIBS="$save_LIBS"
477
efa6ba96
PP
478 save_LIBS="$LIBS"
479 AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
480 AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])],
c14263d8 481 [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf])
e050d62f
MW
482 AC_CHECK_LIB(dw, dwarf_getcfi_elf,[],[
483 AC_MSG_ERROR([elfutils, libdw too old, need 0.142+])],
c14263d8
FCE
484 [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf])
485 stap_LIBS="$stap_LIBS -Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf"
efa6ba96
PP
486 LIBS="$save_LIBS"
487 else
488 # We built our own and stap_LDFLAGS points at the install.
12c1a007 489 stap_LIBS="$stap_LIBS -Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
efa6ba96 490 fi
4d9087fc 491fi
a74dd276 492
6b1a0274
WC
493AC_SUBST(stap_LIBS)
494AC_MSG_NOTICE([stap will link $stap_LIBS])
c3a3c0c9 495
cbe7ea07 496
69c68955
FCE
497dnl Plop in the build (configure) date
498date=`date +%Y-%m-%d`
499AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
82fab474 500AC_SUBST(DATE, "$date")
69c68955 501
47f390f9
FCE
502# Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun
503# being compiled on 32-bit userspace but running against 64-bit kernels.
504# This is no longer necessary.
5566993b 505
3bf6ac45
TM
506# Use tr1/unordered_map if available
507AC_LANG_PUSH(C++)
508AC_CHECK_HEADERS([tr1/unordered_map])
469c1a1b
FCE
509AC_CHECK_HEADERS([tr1/memory])
510AC_CHECK_HEADERS([boost/shared_ptr.hpp])
3bf6ac45
TM
511AC_LANG_POP(C++)
512
4d9087fc 513
f9794ee4
RM
514AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [
515old_CFLAGS="$CFLAGS"
516CFLAGS="$CFLAGS -Wa,--fatal-warnings"
5d4aa1f5 517AC_COMPILE_IFELSE([AC_LANG_SOURCE([asm(".section .note.foo,\"?\",\"note\"\n"
f9794ee4
RM
518 ".byte 1, 2, 3\n"
519 ".previous\n"
520 ".section .text,\"axG\",\"progbits\",foogroup,comdat\n"
521 ".byte 1\n"
522 ".pushsection .note.foo,\"?\",\"note\"\n"
523 ".byte 4, 5, 6\n"
524 ".popsection\n"
5d4aa1f5 525 ".byte 2\n");])],
f9794ee4 526 stap_cv_sectionq=yes, stap_cv_sectionq=no)
a530cfe0 527CFLAGS="$old_CFLAGS"])
f9794ee4
RM
528AC_SUBST(support_section_question)
529support_section_question=0
530if test $stap_cv_sectionq = yes; then
531 support_section_question=1
532fi
8f223b3e 533AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in])
f9794ee4 534
efa6ba96 535if test $build_elfutils = yes -a $enable_translator = yes; then
4d9087fc
RM
536 case "$with_elfutils" in
537 /*) elfutils_srcdir="$with_elfutils" ;;
538 *) elfutils_srcdir="../$with_elfutils" ;;
539 esac
540 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
29b694a7
DS
541
542 save_CFLAGS="$CFLAGS"
543 save_CXXFLAGS="$CXXFLAGS"
544 CXXFLAGS="$CXXFLAGS -fgnu89-inline"
545 CFLAGS="$CFLAGS -fgnu89-inline"
546 gnu89_inline_flag=""
5d4aa1f5 547 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
29b694a7
DS
548 AC_MSG_NOTICE([Compiling elfutils with gcc -fgnu89-inline])
549 gnu89_inline_flag="-fgnu89-inline"],[
550 AC_MSG_NOTICE([Compiler does not support -fgnu89-inline])])
551 CFLAGS="$save_CFLAGS"
552 CXXFLAGS="$save_CXXFLAGS"
553
b7165f65
RM
554 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
555 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
fa1d05cd
RM
556 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
557 # So we must make sure to pass those settings to elfutils configure.
b7165f65 558 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
4d9087fc
RM
559 here=`pwd`
560 (mkdir -p build-elfutils && cd build-elfutils &&
412e1bf7 561 bash ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
4d9087fc 562 --includedir="${here}/include-elfutils" \
b7165f65 563 --libdir="${here}/lib-elfutils" \
fa1d05cd
RM
564 --exec-prefix="$exec_prefix" \
565 --prefix="$prefix" \
29b694a7 566 CFLAGS="${CFLAGS/-Wall/} $gnu89_inline_flag" \
e016a49a 567 LDFLAGS="$LDFLAGS $elfutils_rpath" &&
e3633556 568 if test -f ${elfutils_srcdir}/config/version.h.in; then
e050d62f
MW
569 echo Found elfutils/version.h header...
570 else
571 echo elfutils/version.h header not found, need elfutils 0.142+...
572 exit -1
e3633556 573 fi
4d9087fc 574 )
e050d62f 575 if test $? != 0; then exit -1; fi
4d9087fc 576fi
5566993b 577
62c8a962
FCE
578AC_SUBST(ENABLE_NLS, "$USE_NLS")
579AC_SUBST(localedir, "$localedir")
580AC_SUBST(LOCALEDIR, "$localedir")
581
50431f30
MW
582dnl This is here mainly to make sure that configure --prefix=... changes
583dnl the config.h files so files depending on it are recompiled
584dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS.
2a1c9b5d
FCE
585dnl Formerly: Don't use this directly (when not given it is set to NONE).
586dnl Currently: inline autoconf's later defaulting
802cd104 587
2a1c9b5d
FCE
588stap_prefix=$prefix
589test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix
590AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location])
62c8a962 591AC_SUBST(STAP_PREFIX, "$stap_prefix")
50431f30 592
e016a49a 593AC_CONFIG_HEADERS([config.h:config.in])
c24a9d9a
WC
594AC_CONFIG_FILES([Makefile doc/Makefile \
595doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \
596grapher/Makefile \
ec1a2239
LB
597grapher/stapgraph.1 \
598stappaths.7 \
599initscript/systemtap initscript/stap-server ])
1bb80d04 600AC_CONFIG_SUBDIRS(testsuite runtime/staprun)
6d14a4a9
EB
601if test $enable_translator == "yes"; then
602 AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
603fi
e4aaabda 604AC_CONFIG_FILES([dtrace], [chmod +x dtrace])
53ade4da
MW
605
606# Setup "shadow" directory doc/beginners that has everything setup for
607# publican in one directory (through directory links if necessary).
608# It would be nice to use AC_CONFIG_LINKS, but automake complains when
609# the src is a directory and not a file.
610AC_CONFIG_FILES([doc/beginners/publican.cfg:doc/SystemTap_Beginners_Guide/publican.cfg.in])
611AC_CONFIG_COMMANDS([doc/beginners],
612 [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])
613
e016a49a
FCE
614AC_OUTPUT
615
af29024d
FCE
616if test "${prefix}" = "/usr/local"; then
617 AC_MSG_NOTICE([])
618 AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend])
619 AC_MSG_NOTICE([configuring with a prefix. For example, try])
620 AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$])
621 AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,])
622 AC_MSG_NOTICE([is not supported.])
623fi
This page took 0.177518 seconds and 5 git commands to generate.