]>
Commit | Line | Data |
---|---|---|
2f1a1aea FCE |
1 | dnl configure.ac --- autoconf input file for systemtap |
2 | dnl Process this file with autoconf to produce a configure script. | |
3 | ||
762e53a4 | 4 | AC_INIT([systemtap], 2.2, systemtap@sourceware.org, systemtap) |
97859b9d | 5 | dnl ^^^ see also NEWS, systemtap.spec, testsuite/configure.ac |
4c4adc41 | 6 | dnl doc/SystemTap_Beginners_Guide/en-US/Book_Info.xml |
e872ae09 | 7 | |
2689a171 SM |
8 | dnl Get the target arch for libHelperSDT.so |
9 | AC_CANONICAL_TARGET | |
10 | ||
97859b9d JS |
11 | AC_PREREQ(2.63) |
12 | dnl We don't maintain a ChangeLog, which makes us non-GNU -> foreign. | |
675c6934 | 13 | AM_INIT_AUTOMAKE([no-dist foreign]) |
2f1a1aea FCE |
14 | AM_MAINTAINER_MODE |
15 | ||
618a8a63 JS |
16 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) |
17 | ||
8f223b3e | 18 | AC_USE_SYSTEM_EXTENSIONS |
87cb1275 | 19 | AM_PROG_MKDIR_P |
7fbd9d09 | 20 | AC_SUBST(MKDIR_P) |
2f1a1aea FCE |
21 | AC_PROG_LN_S |
22 | AC_PROG_CC | |
23 | AC_PROG_CXX | |
24 | AC_PROG_CPP | |
25 | AM_PROG_CC_STDC | |
8ae7a94a | 26 | AM_PROG_CC_C_O |
2f1a1aea FCE |
27 | AC_PROG_RANLIB |
28 | AC_OBJEXT | |
29 | AC_EXEEXT | |
30 | AC_PROG_INSTALL | |
31 | AC_PROG_MAKE_SET | |
32 | AC_SUBST(CFLAGS) | |
33 | AC_SUBST(CXXFLAGS) | |
97859b9d | 34 | AC_SYS_LARGEFILE |
8f223b3e | 35 | AM_GNU_GETTEXT(external) |
e281908f | 36 | AM_GNU_GETTEXT_VERSION(0.17) |
e04a4b41 | 37 | AC_CHECK_FUNCS(ppoll) |
56629dde | 38 | AC_CHECK_FUNCS(openat) |
2f1a1aea | 39 | |
e8f3c2c2 DS |
40 | dnl Handle the prologues option. |
41 | dnl | |
70d28673 DS |
42 | dnl If the user didn't specify --enable-prologues/--disable-prologues |
43 | dnl and the x86 system has a version of gcc less than version 4, | |
44 | dnl automatically enable prologues. | |
45 | if 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 | |
55 | fi | |
e8f3c2c2 DS |
56 | AC_ARG_ENABLE([prologues], |
57 | AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]), | |
58 | [ | |
70d28673 DS |
59 | if test "$enable_prologues" = yes; then |
60 | AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default]) | |
61 | fi]) | |
62 | ||
e1bfefdc SC |
63 | dnl Handle the disable-sdt-probes option. |
64 | dnl | |
65 | dnl Default to --disable-sdt-probes if --enable-sdt-probes/--disable-prologues | |
66 | dnl was not specified and the gcc version is less than version 4, | |
67 | ||
68 | if 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 | |
78 | fi | |
0f5d597d JS |
79 | AC_ARG_ENABLE([sdt-probes], |
80 | [AS_HELP_STRING([--disable-sdt-probes], | |
81 | [disable process.mark probes in stap, staprun, stapio])]) | |
82 | AS_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 | 87 | AC_ARG_ENABLE([ssp], |
bbfd8c1a FCE |
88 | [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])]) |
89 | AS_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 | |
103 | dnl Link with gold if possible | |
104 | dnl but: https://bugzilla.redhat.com/show_bug.cgi?id=636603 | |
105 | dnl | |
106 | dnl AC_PATH_PROG(GOLD, [ld.gold], [no]) | |
107 | dnl if test "x$GOLD" != "xno" | |
108 | dnl then | |
109 | dnl mkdir -p Bdir | |
110 | dnl ln -sf $GOLD Bdir/ld | |
111 | dnl LDFLAGS="$LDFLAGS -B`pwd`/Bdir/" | |
112 | dnl AC_MSG_NOTICE([using ld.gold to link]) | |
113 | dnl fi | |
114 | ||
115 | ||
e1e3ba36 | 116 | # Compiling without fPIE by default (see PR 9922) |
8730f377 | 117 | AC_ARG_ENABLE([pie], |
882ddac1 | 118 | [AS_HELP_STRING([--enable-pie], [enable position-independent-executable])]) |
e1e3ba36 | 119 | AS_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 | 141 | AC_SUBST(PIELDFLAGS) |
5574ef2c MW |
142 | AC_SUBST(PIECFLAGS) |
143 | AC_SUBST(PIECXXFLAGS) | |
8730f377 | 144 | |
9921a199 DS |
145 | dnl Handle optional sqlite support. If enabled/disabled by the user, |
146 | dnl do the right thing. If not specified by the user, use it if | |
147 | dnl present. | |
148 | AC_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 |
152 | sqlite3_LIBS= |
153 | AS_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 |
161 | dnl Handle the option to only build runtime |
162 | AC_ARG_ENABLE([translator], | |
163 | AS_HELP_STRING([--disable-translator], [build only runtime utilities]), | |
164 | [], | |
165 | [enable_translator="yes"]) | |
166 | AM_CONDITIONAL([BUILD_TRANSLATOR], [test "$enable_translator" == "yes"]) | |
167 | ||
564eb0a8 DS |
168 | dnl Handle the option to build the crash extension |
169 | AC_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"]) | |
190 | AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"]) | |
e6c086bb | 191 | |
465e8fbf | 192 | dnl Handle the option to build the documentation |
92aff3c7 | 193 | building_docs="no" |
465e8fbf FCE |
194 | AC_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"]) | |
199 | AC_CHECK_PROG(have_latex, latex, yes, no) | |
200 | AC_CHECK_PROG(have_dvips, dvips, yes, no) | |
201 | AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no) | |
308525e3 EM |
202 | AC_CHECK_PROG(have_latex2html, latex2html, yes, no) |
203 | if 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 | 210 | fi |
308525e3 | 211 | if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"; then |
92aff3c7 WC |
212 | building_docs="yes" |
213 | fi | |
214 | AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" == "yes"]) | |
215 | ||
53ade4da MW |
216 | dnl Handle the options to build the publican options |
217 | building_publican="no" | |
218 | AC_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"]) | |
223 | if test "$building_docs" == "no" -a "$enable_publican" == "yes" ; then | |
224 | AC_MSG_ERROR([must use --enable-docs with --enable-publican]) | |
225 | fi | |
226 | AC_CHECK_PROG(have_publican, publican, yes, no) | |
227 | if 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 | |
231 | fi | |
232 | if test "x${have_publican}" == "xyes" -a "$enable_publican" != "no" -a "${building_docs}" == "yes"; then | |
233 | building_publican="yes" | |
234 | fi | |
235 | AM_CONDITIONAL([BUILD_PUBLICAN], [test "$building_publican" == "yes"]) | |
89bc1a6a | 236 | publican_brand="common" |
53ade4da MW |
237 | AC_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 |
242 | PUBLICAN_BRAND=$publican_brand |
243 | AC_SUBST(PUBLICAN_BRAND) | |
244 | ||
92aff3c7 WC |
245 | dnl Handle the option to build the reference documentation |
246 | building_refdocs="no" | |
247 | AC_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"]) | |
252 | if test "$building_docs" == "no" -a "$enable_refdocs" == "yes" ; then | |
253 | AC_MSG_ERROR([must use --enable-docs with --enable-refdocs]) | |
254 | fi | |
255 | AC_CHECK_PROG(have_xmlto, xmlto, yes, no) | |
023337aa EM |
256 | if 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 | |
260 | fi | |
261 | if test "x${have_xmlto}" == "xyes" -a "$enable_refdocs" != "no" -a "${building_docs}" == "yes"; then | |
262 | building_refdocs="yes" | |
263 | fi | |
264 | AM_CONDITIONAL([BUILD_REFDOCS], [test "$building_refdocs" == "yes"]) | |
265 | ||
327a760e | 266 | AC_CHECK_PROG(have_fop, fop, yes, no) |
61598deb FCE |
267 | if 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 | 278 | fi |
327a760e FCE |
279 | AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" == "yes"]) |
280 | ||
a8fcf687 MW |
281 | dnl There is a strange bug in older versions of xmlto when generating pdf. |
282 | dnl https://bugzilla.redhat.com/show_bug.cgi?id=526273 | |
283 | dnl So make sure to have a chapter title starting with L plus an refentry. | |
284 | dnl This will make sure the xmlto pdf support test fails on buggy versions. | |
468abaf4 | 285 | cat > 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> |
297 | EOF | |
468abaf4 FCE |
298 | |
299 | if test "x${have_xmlto}" == "xyes"; then | |
300 | AC_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 |
309 | fi |
310 | AM_CONDITIONAL([XMLTO_STRINGPARAM], [test "$have_xmlto_stringparam" == "yes"]) | |
311 | ||
312 | if test "x${building_refdocs}" == "xyes"; then | |
313 | AC_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 | 331 | fi |
a8fcf687 | 332 | AM_CONDITIONAL([BUILD_PDFREFDOCS], [test "$have_xmlto_pdf" == "yes"]) |
465e8fbf | 333 | |
468abaf4 FCE |
334 | rm -f conftest.xml |
335 | ||
a0e2728a | 336 | dnl See if we have the nss/nspr headers and libraries |
28f121c3 DEP |
337 | AC_ARG_WITH([nss], |
338 | AS_HELP_STRING([--without-nss], | |
339 | [Do not use NSS even if present])) | |
340 | ||
341 | AS_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 | 348 | AM_CONDITIONAL([HAVE_NSS], [test "${have_nss}" = "yes"]) |
468abaf4 | 349 | |
a0e2728a | 350 | dnl Handle the option to build the compile server. |
19a0d4b6 | 351 | AC_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 | 357 | if test "$enable_server" != "no"; then |
a0e2728a | 358 | dnl 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 | 362 | fi |
f5a118c0 | 363 | AM_CONDITIONAL([BUILD_SERVER], [test "${have_nss}" == "yes" -a "$enable_server" != "no"]) |
a0e2728a | 364 | |
f5a118c0 | 365 | if test "${have_nss}" != "yes"; then |
c4fd15b4 | 366 | AC_MSG_WARN([compile-server client functionality will be disabled, cannot find nss development files]) |
a0e2728a | 367 | fi |
a0e2728a DB |
368 | |
369 | dnl See if we have the avahi libraries and headers | |
28f121c3 DEP |
370 | AC_ARG_WITH([avahi], |
371 | AS_HELP_STRING([--without-avahi], | |
372 | [Do not use Avahi even if present])) | |
373 | ||
374 | AS_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 |
381 | AM_CONDITIONAL([HAVE_AVAHI], [test "${have_avahi}" = "yes"]) |
382 | ||
383 | if test "${have_avahi}" != "yes"; then | |
384 | AC_MSG_WARN([some compile-server functionality will be restricted, cannot find avahi development files]) | |
a0e2728a | 385 | fi |
43498922 | 386 | |
1087b83f | 387 | |
bcfa72ed | 388 | dnl Look for librpm. |
2ed04863 WC |
389 | AC_ARG_WITH([rpm], |
390 | [AS_HELP_STRING([--with-rpm], | |
bcfa72ed FCE |
391 | [query rpm database for missing debuginfos])], [], [with_rpm="auto"]) |
392 | if 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 |
407 | fi |
408 | ||
409 | ||
e8f3c2c2 DS |
410 | dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used |
411 | dnl the system's elfutils. | |
4d9087fc RM |
412 | build_elfutils=no |
413 | AC_ARG_WITH([elfutils], | |
e8f3c2c2 DS |
414 | AS_HELP_STRING([--with-elfutils=DIRECTORY], |
415 | [find elfutils source code in DIRECTORY]), | |
416 | [ | |
4d9087fc RM |
417 | case "$with_elfutils" in |
418 | yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;; | |
419 | ''|no) ;; | |
420 | *) build_elfutils=yes ;; | |
421 | esac]) | |
422 | AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes) | |
fa1d05cd RM |
423 | AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes], |
424 | [cd $with_elfutils && pwd])`) | |
425 | ||
efa6ba96 PP |
426 | if 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 | 449 | fi |
a74dd276 | 450 | |
6b1a0274 WC |
451 | AC_SUBST(stap_LIBS) |
452 | AC_MSG_NOTICE([stap will link $stap_LIBS]) | |
c3a3c0c9 | 453 | |
97859b9d JS |
454 | # staprun has more modest libelf needs |
455 | if 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" | |
465 | else | |
466 | # We built our own and staprun_LDFLAGS points at the install. | |
467 | staprun_LIBS="$staprun_LIBS -lelf" | |
468 | fi | |
469 | ||
470 | AC_SUBST(staprun_LIBS) | |
471 | AC_MSG_NOTICE([staprun will link $staprun_LIBS]) | |
472 | ||
cbe7ea07 | 473 | |
69c68955 FCE |
474 | dnl Plop in the build (configure) date |
475 | date=`date +%Y-%m-%d` | |
476 | AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date]) | |
82fab474 | 477 | AC_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 |
484 | AC_LANG_PUSH(C++) | |
485 | AC_CHECK_HEADERS([tr1/unordered_map]) | |
469c1a1b FCE |
486 | AC_CHECK_HEADERS([tr1/memory]) |
487 | AC_CHECK_HEADERS([boost/shared_ptr.hpp]) | |
3bf6ac45 TM |
488 | AC_LANG_POP(C++) |
489 | ||
4d9087fc | 490 | |
138bbe90 | 491 | # Check for Dyninst headers and libraries |
138bbe90 JS |
492 | AC_ARG_WITH([dyninst], |
493 | AS_HELP_STRING([--with-dyninst=DIRECTORY], | |
eab44db5 FCE |
494 | [find dyninst headers/libraries in DIRECTORY])) |
495 | ||
138bbe90 | 496 | case "$with_dyninst" in |
eab44db5 FCE |
497 | no) ;; |
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 | 506 | esac |
e0a17c00 | 507 | if 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++) | |
523 | fi | |
138bbe90 JS |
524 | AM_CONDITIONAL([HAVE_DYNINST], [test "${have_dyninst}" = "yes"]) |
525 | ||
526 | ||
f9794ee4 RM |
527 | AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [ |
528 | old_CFLAGS="$CFLAGS" | |
529 | CFLAGS="$CFLAGS -Wa,--fatal-warnings" | |
5d4aa1f5 | 530 | AC_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 | 540 | CFLAGS="$old_CFLAGS"]) |
f9794ee4 RM |
541 | AC_SUBST(support_section_question) |
542 | support_section_question=0 | |
543 | if test $stap_cv_sectionq = yes; then | |
544 | support_section_question=1 | |
545 | fi | |
8f223b3e | 546 | AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in]) |
f9794ee4 | 547 | |
efa6ba96 | 548 | if 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 | 598 | fi |
5566993b | 599 | |
51030d84 JS |
600 | dnl Optional libselinux support allows stapdyn to check |
601 | dnl for booleans that would prevent Dyninst from working. | |
602 | AC_ARG_WITH([selinux], | |
603 | AS_HELP_STRING([--without-selinux], | |
604 | [Do not use libselinux even if present])) | |
605 | ||
606 | AS_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 | ||
613 | AM_CONDITIONAL([HAVE_SELINUX], [test "${have_selinux}" = "yes"]) | |
614 | ||
95835e2c | 615 | dnl Handle java+byteman support |
e9b0aba1 SM |
616 | AC_CHECK_PROG(have_javac, javac, yes, no) |
617 | AC_CHECK_PROG(have_jar, jar, yes, no) | |
618 | if test "$have_javac" != no -a "$have_jar" != no; then | |
619 | echo java found, will try to configure Byteman support | |
95835e2c | 620 | |
26703c63 SM |
621 | AC_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]) |
626 | AC_CHECK_FILE([$with_java],[],[with_java=no]) | |
627 | AC_SUBST(JAVADIR, "${with_java}") # always needed to compile | |
95835e2c | 628 | |
26703c63 SM |
629 | if test "$with_java" != "no"; then |
630 | AC_DEFINE_UNQUOTED(HAVE_JAVA, "1", [Flag indicating that libHelperSDT.so is available (can be found in PKGLIBDIR)]) | |
13c19b49 | 631 | fi |
275cd71a | 632 | |
26703c63 | 633 | AM_CONDITIONAL([HAVE_JAVA], [test "$with_java" != "no"]) |
7fe06356 | 634 | |
95835e2c SM |
635 | else |
636 | AC_MSG_WARN([will not run per-method java probing, missing byteman or java requirements]) | |
26703c63 | 637 | AM_CONDITIONAL([HAVE_JAVA],false) |
93933baa | 638 | fi # java+byteman support |
7fe06356 | 639 | |
62c8a962 FCE |
640 | AC_SUBST(ENABLE_NLS, "$USE_NLS") |
641 | AC_SUBST(localedir, "$localedir") | |
642 | AC_SUBST(LOCALEDIR, "$localedir") | |
643 | ||
85b62eab FCE |
644 | AC_ARG_WITH([extra-version], |
645 | AS_HELP_STRING([--with-extra-version=STRING], | |
646 | [Add STRING to stap -V version])) | |
647 | AS_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=""]) | |
651 | AC_DEFINE_UNQUOTED(STAP_EXTRA_VERSION, "$stap_extra_version", [extra stap version code]) | |
652 | AC_SUBST(STAP_EXTRA_VERSION, "$stap_extra_version") | |
653 | ||
50431f30 MW |
654 | dnl This is here mainly to make sure that configure --prefix=... changes |
655 | dnl the config.h files so files depending on it are recompiled | |
656 | dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS. | |
2a1c9b5d FCE |
657 | dnl Formerly: Don't use this directly (when not given it is set to NONE). |
658 | dnl Currently: inline autoconf's later defaulting | |
802cd104 | 659 | |
2a1c9b5d FCE |
660 | stap_prefix=$prefix |
661 | test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix | |
662 | AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location]) | |
62c8a962 | 663 | AC_SUBST(STAP_PREFIX, "$stap_prefix") |
50431f30 | 664 | |
e016a49a | 665 | AC_CONFIG_HEADERS([config.h:config.in]) |
a6e785fa | 666 | AC_CONFIG_FILES([Makefile doc/Makefile man/Makefile \ |
c24a9d9a | 667 | doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \ |
a6e785fa | 668 | man/stappaths.7 \ |
29fe12e4 | 669 | initscript/config.systemtap initscript/config.stap-server \ |
ec1a2239 | 670 | initscript/systemtap initscript/stap-server ]) |
97859b9d | 671 | AC_CONFIG_SUBDIRS(testsuite) |
6d14a4a9 EB |
672 | if test $enable_translator == "yes"; then |
673 | AC_CONFIG_FILES([run-stap], [chmod +x run-stap]) | |
674 | fi | |
e4aaabda | 675 | AC_CONFIG_FILES([dtrace], [chmod +x dtrace]) |
66c3c633 | 676 | AC_CONFIG_FILES(stapdyn/Makefile) |
7fe06356 | 677 | AC_CONFIG_FILES(java/Makefile) |
97859b9d JS |
678 | AC_CONFIG_FILES(staprun/Makefile) |
679 | AC_CONFIG_FILES([staprun/run-staprun], [chmod +x staprun/run-staprun]) | |
be87f53a | 680 | AC_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. | |
686 | AC_CONFIG_FILES([doc/beginners/publican.cfg:doc/SystemTap_Beginners_Guide/publican.cfg.in]) | |
687 | AC_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 |
690 | AC_OUTPUT |
691 | ||
af29024d FCE |
692 | if 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.]) | |
699 | fi |