]>
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 | ||
94d406fc | 4 | AC_INIT([systemtap], 1.7, systemtap@sourceware.org, systemtap) |
579d69c3 JS |
5 | dnl ^^^ see also NEWS, systemtap.spec, testsuite/configure.ac, |
6 | dnl runtime/staprun/configure.ac | |
e872ae09 | 7 | |
2f1a1aea | 8 | AC_PREREQ(2.59) |
675c6934 | 9 | AM_INIT_AUTOMAKE([no-dist foreign]) |
2f1a1aea FCE |
10 | AM_MAINTAINER_MODE |
11 | ||
618a8a63 JS |
12 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) |
13 | ||
8f223b3e | 14 | AC_USE_SYSTEM_EXTENSIONS |
87cb1275 | 15 | AM_PROG_MKDIR_P |
7fbd9d09 | 16 | AC_SUBST(MKDIR_P) |
2f1a1aea FCE |
17 | AC_PROG_LN_S |
18 | AC_PROG_CC | |
19 | AC_PROG_CXX | |
20 | AC_PROG_CPP | |
21 | AM_PROG_CC_STDC | |
8ae7a94a | 22 | AM_PROG_CC_C_O |
2f1a1aea | 23 | AM_C_PROTOTYPES |
2f1a1aea FCE |
24 | AC_PROG_RANLIB |
25 | AC_OBJEXT | |
26 | AC_EXEEXT | |
27 | AC_PROG_INSTALL | |
28 | AC_PROG_MAKE_SET | |
29 | AC_SUBST(CFLAGS) | |
30 | AC_SUBST(CXXFLAGS) | |
8f223b3e | 31 | AM_GNU_GETTEXT(external) |
7316ced8 | 32 | AM_GNU_GETTEXT_VERSION |
e04a4b41 | 33 | AC_CHECK_FUNCS(ppoll) |
2f1a1aea | 34 | |
e8f3c2c2 DS |
35 | dnl Handle the prologues option. |
36 | dnl | |
70d28673 DS |
37 | dnl If the user didn't specify --enable-prologues/--disable-prologues |
38 | dnl and the x86 system has a version of gcc less than version 4, | |
39 | dnl automatically enable prologues. | |
40 | if 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 | |
50 | fi | |
e8f3c2c2 DS |
51 | AC_ARG_ENABLE([prologues], |
52 | AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]), | |
53 | [ | |
70d28673 DS |
54 | if test "$enable_prologues" = yes; then |
55 | AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default]) | |
56 | fi]) | |
57 | ||
e1bfefdc SC |
58 | dnl Handle the disable-sdt-probes option. |
59 | dnl | |
60 | dnl Default to --disable-sdt-probes if --enable-sdt-probes/--disable-prologues | |
61 | dnl was not specified and the gcc version is less than version 4, | |
62 | ||
63 | if 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 | |
73 | fi | |
0f5d597d JS |
74 | AC_ARG_ENABLE([sdt-probes], |
75 | [AS_HELP_STRING([--disable-sdt-probes], | |
76 | [disable process.mark probes in stap, staprun, stapio])]) | |
77 | AS_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 | 82 | AC_ARG_ENABLE([ssp], |
bbfd8c1a FCE |
83 | [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])]) |
84 | AS_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 | |
98 | dnl Link with gold if possible | |
99 | dnl but: https://bugzilla.redhat.com/show_bug.cgi?id=636603 | |
100 | dnl | |
101 | dnl AC_PATH_PROG(GOLD, [ld.gold], [no]) | |
102 | dnl if test "x$GOLD" != "xno" | |
103 | dnl then | |
104 | dnl mkdir -p Bdir | |
105 | dnl ln -sf $GOLD Bdir/ld | |
106 | dnl LDFLAGS="$LDFLAGS -B`pwd`/Bdir/" | |
107 | dnl AC_MSG_NOTICE([using ld.gold to link]) | |
108 | dnl fi | |
109 | ||
110 | ||
e1e3ba36 | 111 | # Compiling without fPIE by default (see PR 9922) |
8730f377 | 112 | AC_ARG_ENABLE([pie], |
882ddac1 | 113 | [AS_HELP_STRING([--enable-pie], [enable position-independent-executable])]) |
e1e3ba36 | 114 | AS_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"])]) | |
139 | AC_SUBST(PIELDFLAGS) | |
5574ef2c MW |
140 | AC_SUBST(PIECFLAGS) |
141 | AC_SUBST(PIECXXFLAGS) | |
8730f377 | 142 | |
9921a199 DS |
143 | dnl Handle optional sqlite support. If enabled/disabled by the user, |
144 | dnl do the right thing. If not specified by the user, use it if | |
145 | dnl present. | |
146 | AC_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 |
150 | sqlite3_LIBS= |
151 | AS_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 |
159 | dnl Handle the option to only build runtime |
160 | AC_ARG_ENABLE([translator], | |
161 | AS_HELP_STRING([--disable-translator], [build only runtime utilities]), | |
162 | [], | |
163 | [enable_translator="yes"]) | |
164 | AM_CONDITIONAL([BUILD_TRANSLATOR], [test "$enable_translator" == "yes"]) | |
165 | ||
564eb0a8 DS |
166 | dnl Handle the option to build the crash extension |
167 | AC_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"]) | |
188 | AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"]) | |
e6c086bb | 189 | |
465e8fbf | 190 | dnl Handle the option to build the documentation |
92aff3c7 | 191 | building_docs="no" |
465e8fbf FCE |
192 | AC_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"]) | |
197 | AC_CHECK_PROG(have_latex, latex, yes, no) | |
198 | AC_CHECK_PROG(have_dvips, dvips, yes, no) | |
199 | AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no) | |
308525e3 EM |
200 | AC_CHECK_PROG(have_latex2html, latex2html, yes, no) |
201 | if 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 | 208 | fi |
308525e3 | 209 | if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"; then |
92aff3c7 WC |
210 | building_docs="yes" |
211 | fi | |
212 | AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" == "yes"]) | |
213 | ||
53ade4da MW |
214 | dnl Handle the options to build the publican options |
215 | building_publican="no" | |
216 | AC_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"]) | |
221 | if test "$building_docs" == "no" -a "$enable_publican" == "yes" ; then | |
222 | AC_MSG_ERROR([must use --enable-docs with --enable-publican]) | |
223 | fi | |
224 | AC_CHECK_PROG(have_publican, publican, yes, no) | |
225 | if 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 | |
229 | fi | |
230 | if test "x${have_publican}" == "xyes" -a "$enable_publican" != "no" -a "${building_docs}" == "yes"; then | |
231 | building_publican="yes" | |
232 | fi | |
233 | AM_CONDITIONAL([BUILD_PUBLICAN], [test "$building_publican" == "yes"]) | |
89bc1a6a | 234 | publican_brand="common" |
53ade4da MW |
235 | AC_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 |
240 | PUBLICAN_BRAND=$publican_brand |
241 | AC_SUBST(PUBLICAN_BRAND) | |
242 | ||
92aff3c7 WC |
243 | dnl Handle the option to build the reference documentation |
244 | building_refdocs="no" | |
245 | AC_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"]) | |
250 | if test "$building_docs" == "no" -a "$enable_refdocs" == "yes" ; then | |
251 | AC_MSG_ERROR([must use --enable-docs with --enable-refdocs]) | |
252 | fi | |
253 | AC_CHECK_PROG(have_xmlto, xmlto, yes, no) | |
023337aa EM |
254 | if 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 | |
258 | fi | |
259 | if test "x${have_xmlto}" == "xyes" -a "$enable_refdocs" != "no" -a "${building_docs}" == "yes"; then | |
260 | building_refdocs="yes" | |
261 | fi | |
262 | AM_CONDITIONAL([BUILD_REFDOCS], [test "$building_refdocs" == "yes"]) | |
263 | ||
a8fcf687 MW |
264 | dnl There is a strange bug in older versions of xmlto when generating pdf. |
265 | dnl https://bugzilla.redhat.com/show_bug.cgi?id=526273 | |
266 | dnl So make sure to have a chapter title starting with L plus an refentry. | |
267 | dnl This will make sure the xmlto pdf support test fails on buggy versions. | |
468abaf4 | 268 | cat > 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> |
280 | EOF | |
468abaf4 FCE |
281 | |
282 | if test "x${have_xmlto}" == "xyes"; then | |
283 | AC_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 |
292 | fi |
293 | AM_CONDITIONAL([XMLTO_STRINGPARAM], [test "$have_xmlto_stringparam" == "yes"]) | |
294 | ||
295 | if test "x${building_refdocs}" == "xyes"; then | |
296 | AC_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 | 306 | fi |
a8fcf687 | 307 | AM_CONDITIONAL([BUILD_PDFREFDOCS], [test "$have_xmlto_pdf" == "yes"]) |
465e8fbf | 308 | |
468abaf4 FCE |
309 | rm -f conftest.xml |
310 | ||
a0e2728a DB |
311 | dnl See if we have the nss/nspr headers and libraries |
312 | AC_CHECK_FILE([/usr/include/nss3], nssdir=nss3, [ | |
313 | AC_CHECK_FILE([/usr/include/nss], nssdir=nss) | |
314 | ]) | |
315 | AC_CHECK_FILE([/usr/include/nspr4], nsprdir=nspr4, [ | |
316 | AC_CHECK_FILE([/usr/include/nspr], nsprdir=nspr) | |
317 | ]) | |
318 | if 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 | |
329 | fi | |
330 | AC_CHECK_LIB(nspr4, PR_Connect, [ | |
331 | AC_CHECK_LIB(ssl3, SSL_ReHandshake, have_nss_libs=yes) | |
332 | ]) | |
333 | if 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.]) | |
335 | fi | |
336 | AM_CONDITIONAL([HAVE_NSS], [test "x${have_nss_includes}${have_nss_libs}" == "xyesyes"]) | |
468abaf4 | 337 | |
a0e2728a | 338 | dnl Handle the option to build the compile server. |
19a0d4b6 | 339 | AC_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 | 345 | if test "$enable_server" != "no"; then |
a0e2728a DB |
346 | dnl 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 |
353 | fi | |
aeb9cc10 | 354 | AM_CONDITIONAL([BUILD_SERVER], [test "x${have_nss_includes}${have_nss_libs}" == "xyesyes" -a "$enable_server" != "no"]) |
a0e2728a DB |
355 | |
356 | if test "x${have_nss_includes}" != "xyes"; then | |
357 | AC_MSG_WARN([some compile server client functionality will be restricted, cannot find nss/nspr headers]) | |
358 | fi | |
359 | if test "x${have_nss_libs}" != "xyes"; then | |
360 | AC_MSG_WARN([some compile server client functionality will be restricted, cannot find nss/nspr libraries]) | |
361 | fi | |
362 | ||
363 | dnl See if we have the avahi libraries and headers | |
364 | AC_CHECK_FILE([/usr/include/avahi-client], avahi_clientdir=avahi-client) | |
365 | AC_CHECK_FILE([/usr/include/avahi-common], avahi_commondir=avahi-common) | |
366 | if 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 | |
370 | fi | |
371 | AC_CHECK_LIB(avahi-client, avahi_client_new, | |
372 | AC_CHECK_LIB(avahi-common, avahi_strerror, have_avahi_libs=yes)) | |
373 | if 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 |
375 | fi |
376 | if 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 |
378 | fi |
379 | if 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.]) | |
381 | fi | |
382 | AM_CONDITIONAL([HAVE_AVAHI], [test "x${have_avahi_includes}${have_avahi_libs}" == "xyesyes"]) | |
43498922 | 383 | |
1087b83f TM |
384 | dnl Handle the optional grapher |
385 | AC_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 | 390 | dnl If the user didn't disable the grapher, check the grapher's requirements. |
c3f070d9 | 391 | AS_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 | 422 | dnl If the user explicitly said to enable the grapher, but we can't |
f8a49389 DS |
423 | dnl (since one or more of its requirements aren't installed), error. |
424 | AS_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)])) | |
426 | dnl If the user didn't say to disable the grapher, and all the | |
427 | dnl requirements are installed, enable the grapher. | |
428 | AM_CONDITIONAL([BUILD_GRAPHER], [test "x${have_grapher_reqs}" == "xyes" -a x"$enable_grapher" != "xno"]) | |
1087b83f | 429 | |
bcfa72ed | 430 | dnl Look for librpm. |
2ed04863 WC |
431 | AC_ARG_WITH([rpm], |
432 | [AS_HELP_STRING([--with-rpm], | |
bcfa72ed FCE |
433 | [query rpm database for missing debuginfos])], [], [with_rpm="auto"]) |
434 | if 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 |
449 | fi |
450 | ||
451 | ||
e8f3c2c2 DS |
452 | dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used |
453 | dnl the system's elfutils. | |
4d9087fc RM |
454 | build_elfutils=no |
455 | AC_ARG_WITH([elfutils], | |
e8f3c2c2 DS |
456 | AS_HELP_STRING([--with-elfutils=DIRECTORY], |
457 | [find elfutils source code in DIRECTORY]), | |
458 | [ | |
4d9087fc RM |
459 | case "$with_elfutils" in |
460 | yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;; | |
461 | ''|no) ;; | |
462 | *) build_elfutils=yes ;; | |
463 | esac]) | |
464 | AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes) | |
fa1d05cd RM |
465 | AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes], |
466 | [cd $with_elfutils && pwd])`) | |
467 | ||
efa6ba96 PP |
468 | if 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 | 491 | fi |
a74dd276 | 492 | |
6b1a0274 WC |
493 | AC_SUBST(stap_LIBS) |
494 | AC_MSG_NOTICE([stap will link $stap_LIBS]) | |
c3a3c0c9 | 495 | |
cbe7ea07 | 496 | |
69c68955 FCE |
497 | dnl Plop in the build (configure) date |
498 | date=`date +%Y-%m-%d` | |
499 | AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date]) | |
82fab474 | 500 | AC_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 |
507 | AC_LANG_PUSH(C++) | |
508 | AC_CHECK_HEADERS([tr1/unordered_map]) | |
469c1a1b FCE |
509 | AC_CHECK_HEADERS([tr1/memory]) |
510 | AC_CHECK_HEADERS([boost/shared_ptr.hpp]) | |
3bf6ac45 TM |
511 | AC_LANG_POP(C++) |
512 | ||
4d9087fc | 513 | |
f9794ee4 RM |
514 | AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [ |
515 | old_CFLAGS="$CFLAGS" | |
516 | CFLAGS="$CFLAGS -Wa,--fatal-warnings" | |
5d4aa1f5 | 517 | AC_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 | 527 | CFLAGS="$old_CFLAGS"]) |
f9794ee4 RM |
528 | AC_SUBST(support_section_question) |
529 | support_section_question=0 | |
530 | if test $stap_cv_sectionq = yes; then | |
531 | support_section_question=1 | |
532 | fi | |
8f223b3e | 533 | AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in]) |
f9794ee4 | 534 | |
efa6ba96 | 535 | if 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 | 576 | fi |
5566993b | 577 | |
62c8a962 FCE |
578 | AC_SUBST(ENABLE_NLS, "$USE_NLS") |
579 | AC_SUBST(localedir, "$localedir") | |
580 | AC_SUBST(LOCALEDIR, "$localedir") | |
581 | ||
50431f30 MW |
582 | dnl This is here mainly to make sure that configure --prefix=... changes |
583 | dnl the config.h files so files depending on it are recompiled | |
584 | dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS. | |
2a1c9b5d FCE |
585 | dnl Formerly: Don't use this directly (when not given it is set to NONE). |
586 | dnl Currently: inline autoconf's later defaulting | |
802cd104 | 587 | |
2a1c9b5d FCE |
588 | stap_prefix=$prefix |
589 | test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix | |
590 | AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location]) | |
62c8a962 | 591 | AC_SUBST(STAP_PREFIX, "$stap_prefix") |
50431f30 | 592 | |
e016a49a | 593 | AC_CONFIG_HEADERS([config.h:config.in]) |
c24a9d9a WC |
594 | AC_CONFIG_FILES([Makefile doc/Makefile \ |
595 | doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \ | |
596 | grapher/Makefile \ | |
ec1a2239 LB |
597 | grapher/stapgraph.1 \ |
598 | stappaths.7 \ | |
599 | initscript/systemtap initscript/stap-server ]) | |
1bb80d04 | 600 | AC_CONFIG_SUBDIRS(testsuite runtime/staprun) |
6d14a4a9 EB |
601 | if test $enable_translator == "yes"; then |
602 | AC_CONFIG_FILES([run-stap], [chmod +x run-stap]) | |
603 | fi | |
e4aaabda | 604 | AC_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. | |
610 | AC_CONFIG_FILES([doc/beginners/publican.cfg:doc/SystemTap_Beginners_Guide/publican.cfg.in]) | |
611 | AC_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 |
614 | AC_OUTPUT |
615 | ||
af29024d FCE |
616 | if 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.]) | |
623 | fi |