]>
Commit | Line | Data |
---|---|---|
1 | dnl configure.ac --- autoconf input file for systemtap | |
2 | dnl Process this file with autoconf to produce a configure script. | |
3 | ||
4 | AC_INIT([systemtap], 1.7, systemtap@sourceware.org, systemtap) | |
5 | dnl ^^^ see also NEWS, systemtap.spec, testsuite/configure.ac, | |
6 | dnl runtime/staprun/configure.ac | |
7 | ||
8 | AC_PREREQ(2.59) | |
9 | AM_INIT_AUTOMAKE([no-dist foreign]) | |
10 | AM_MAINTAINER_MODE | |
11 | ||
12 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) | |
13 | ||
14 | AC_USE_SYSTEM_EXTENSIONS | |
15 | AM_PROG_MKDIR_P | |
16 | AC_SUBST(MKDIR_P) | |
17 | AC_PROG_LN_S | |
18 | AC_PROG_CC | |
19 | AC_PROG_CXX | |
20 | AC_PROG_CPP | |
21 | AM_PROG_CC_STDC | |
22 | AM_PROG_CC_C_O | |
23 | AM_C_PROTOTYPES | |
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) | |
31 | AM_GNU_GETTEXT(external) | |
32 | AM_GNU_GETTEXT_VERSION | |
33 | AC_CHECK_FUNCS(ppoll) | |
34 | ||
35 | dnl Handle the prologues option. | |
36 | dnl | |
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 | |
51 | AC_ARG_ENABLE([prologues], | |
52 | AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]), | |
53 | [ | |
54 | if test "$enable_prologues" = yes; then | |
55 | AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default]) | |
56 | fi]) | |
57 | ||
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 | |
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 | ||
82 | AC_ARG_ENABLE([ssp], | |
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" | |
87 | CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2" | |
88 | CFLAGS="$CFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2" | |
89 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [ | |
90 | AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.]) | |
91 | CFLAGS="$save_CFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2" | |
92 | CXXFLAGS="$save_CXXFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"],[ | |
93 | AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.]) | |
94 | CFLAGS="$save_CFLAGS" | |
95 | CXXFLAGS="$save_CXXFLAGS"])]) | |
96 | ||
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 | ||
111 | # Compiling without fPIE by default (see PR 9922) | |
112 | AC_ARG_ENABLE([pie], | |
113 | [AS_HELP_STRING([--enable-pie], [enable position-independent-executable])]) | |
114 | AS_IF([test "x$enable_pie" == xyes],[ | |
115 | save_CFLAGS="$CFLAGS" | |
116 | save_CXXFLAGS="$CXXFLAGS" | |
117 | save_LDFLAGS="$LDFLAGS" | |
118 | CFLAGS="$CFLAGS -fPIE" | |
119 | CXXFLAGS="$CXXFLAGS -fPIE" | |
120 | LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now" | |
121 | AC_LINK_IFELSE([AC_LANG_SOURCE([void main () {}])], [ | |
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 | |
125 | PIELDFLAGS="$LDFLAGS" | |
126 | LDFLAGS="$save_LDFLAGS" | |
127 | PIECFLAGS="$CFLAGS" | |
128 | CFLAGS="$save_CFLAGS" | |
129 | PIECXXFLAGS="$CXXFLAGS" | |
130 | CXXFLAGS="$save_CXXFLAGS" | |
131 | ],[ | |
132 | AC_MSG_NOTICE([Compiler does not support -pie et al.]) | |
133 | PIECFLAGS="" | |
134 | CFLAGS="$save_CFLAGS" | |
135 | PIECXXFLAGS="" | |
136 | CXXFLAGS="$save_CXXFLAGS" | |
137 | PIELDFLAGS="" | |
138 | LDFLAGS="$save_LDFLAGS"])]) | |
139 | AC_SUBST(PIELDFLAGS) | |
140 | AC_SUBST(PIECFLAGS) | |
141 | AC_SUBST(PIECXXFLAGS) | |
142 | ||
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], | |
147 | AS_HELP_STRING([--enable-sqlite], [build with sqlite support]), | |
148 | [], dnl ACTION-IF-GIVEN | |
149 | [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN | |
150 | sqlite3_LIBS= | |
151 | AS_IF([test "x$enable_sqlite" != xno], | |
152 | [AC_CHECK_LIB([sqlite3], [sqlite3_open], | |
153 | [AC_SUBST([sqlite3_LIBS], [-lsqlite3]) | |
154 | AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the `sqlite3' library (-lsqlite3).])], | |
155 | [if test "x$enable_sqlite" != xcheck; then | |
156 | AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite failed]) | |
157 | fi])]) | |
158 | ||
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 | ||
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 | [ | |
183 | #define NR_CPUS 256 | |
184 | ]) | |
185 | CPPFLAGS="$save_CPPFLAGS" | |
186 | fi], | |
187 | [enable_crash="no"]) | |
188 | AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"]) | |
189 | ||
190 | dnl Handle the option to build the documentation | |
191 | building_docs="no" | |
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) | |
200 | AC_CHECK_PROG(have_latex2html, latex2html, yes, no) | |
201 | if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" != "xyesyesyesyes"; then | |
202 | if test "$enable_docs" == "yes"; then | |
203 | AC_MSG_ERROR([cannot find all tools for building documentation]) | |
204 | fi | |
205 | if test "$enable_docs" == "check"; then | |
206 | AC_MSG_WARN([will not build documentation, cannot find all tools]) | |
207 | fi | |
208 | fi | |
209 | if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"; then | |
210 | building_docs="yes" | |
211 | fi | |
212 | AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" == "yes"]) | |
213 | ||
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"]) | |
234 | publican_brand="common" | |
235 | AC_ARG_WITH([publican-brand], | |
236 | AS_HELP_STRING([--with-publican-brand=BRAND], | |
237 | [building publican documentation guides using given brand (defaults to "common").]), | |
238 | [publican_brand=$withval], | |
239 | [publican_brand="common"]) | |
240 | PUBLICAN_BRAND=$publican_brand | |
241 | AC_SUBST(PUBLICAN_BRAND) | |
242 | ||
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) | |
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 | ||
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. | |
268 | cat > conftest.xml << 'EOF' | |
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" []> | |
272 | <book lang="en"> | |
273 | <bookinfo><title>foo</title></bookinfo> | |
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> | |
279 | </book> | |
280 | EOF | |
281 | ||
282 | if test "x${have_xmlto}" == "xyes"; then | |
283 | AC_MSG_CHECKING([for xmlto --stringparam support]) | |
284 | xmlto --stringparam man.authors.section.enabled=0 html-nochunks conftest.xml >/dev/null 2>&1 | |
285 | if test $? == 0; then | |
286 | have_xmlto_stringparam="yes" | |
287 | AC_MSG_RESULT([yes]) | |
288 | else | |
289 | AC_MSG_RESULT([no]) | |
290 | fi | |
291 | rm -f conftest.html | |
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 | |
298 | if test $? == 0; then | |
299 | have_xmlto_pdf="yes" | |
300 | AC_MSG_RESULT([yes]) | |
301 | else | |
302 | AC_MSG_RESULT([no]) | |
303 | AC_MSG_WARN([Not building reference documentation in PDF format]) | |
304 | fi | |
305 | rm -f conftest.pdf | |
306 | fi | |
307 | AM_CONDITIONAL([BUILD_PDFREFDOCS], [test "$have_xmlto_pdf" == "yes"]) | |
308 | ||
309 | rm -f conftest.xml | |
310 | ||
311 | dnl See if we have the nss/nspr headers and libraries | |
312 | AC_ARG_WITH([nss], | |
313 | AS_HELP_STRING([--without-nss], | |
314 | [Do not use NSS even if present])) | |
315 | ||
316 | AS_IF([test "x$with_nss" != "xno"], [ | |
317 | PKG_CHECK_MODULES([nss], [nss >= 3], | |
318 | [have_nss=yes | |
319 | AC_DEFINE([HAVE_NSS], [1], [Define to 1 if you have the nss libraries.]) | |
320 | ], [have_nss=no]) | |
321 | ], [have_nss=no]) | |
322 | ||
323 | AM_CONDITIONAL([HAVE_NSS], [test "${have_nss}" = "yes"]) | |
324 | ||
325 | dnl Handle the option to build the compile server. | |
326 | AC_ARG_ENABLE([server], | |
327 | AS_HELP_STRING([--enable-server], | |
328 | [enable building of stap-server (default on if nss etc. found).]), | |
329 | [enable_server=$enableval], | |
330 | [enable_server="check"]) | |
331 | ||
332 | if test "$enable_server" != "no"; then | |
333 | dnl See if we have enough libraries and tools to build the compile server | |
334 | if test "x${have_nss}" != "xyes"; then | |
335 | AC_MSG_WARN([will not build systemtap compile server, cannot find nss headers]) | |
336 | fi | |
337 | fi | |
338 | AM_CONDITIONAL([BUILD_SERVER], [test "${have_nss}" == "yes" -a "$enable_server" != "no"]) | |
339 | ||
340 | if test "${have_nss}" != "yes"; then | |
341 | AC_MSG_WARN([some compile server client functionality will be restricted, cannot find nss development files]) | |
342 | fi | |
343 | ||
344 | dnl See if we have the avahi libraries and headers | |
345 | AC_ARG_WITH([avahi], | |
346 | AS_HELP_STRING([--without-avahi], | |
347 | [Do not use Avahi even if present])) | |
348 | ||
349 | AS_IF([test "x$with_avahi" != "xno"], [ | |
350 | PKG_CHECK_MODULES([avahi], [avahi-client], | |
351 | [have_avahi=yes | |
352 | AC_DEFINE([HAVE_AVAHI], [1], [Define to 1 if you have the avahi libraries.]) | |
353 | ], [have_avahi=no]) | |
354 | ], [have_avahi=no]) | |
355 | ||
356 | AM_CONDITIONAL([HAVE_AVAHI], [test "${have_avahi}" = "yes"]) | |
357 | ||
358 | if test "${have_avahi}" != "yes"; then | |
359 | AC_MSG_WARN([some compile-server functionality will be restricted, cannot find avahi development files]) | |
360 | fi | |
361 | ||
362 | dnl Handle the optional grapher | |
363 | AC_ARG_ENABLE([grapher], | |
364 | AS_HELP_STRING([--enable-grapher], | |
365 | [enable building of grapher (default on if needed requirements are found).]), | |
366 | [], dnl ACTION-IF-GIVEN | |
367 | [enable_grapher="check"]) dnl ACTION-IF-NOT-GIVEN | |
368 | dnl If the user didn't disable the grapher, check the grapher's requirements. | |
369 | AS_IF([test "x$enable_grapher" != xno], | |
370 | [ | |
371 | dnl Check for gtkmm. Strictly speaking, this isn't necessary, | |
372 | dnl since the libglademm24-devel rpm requires the gtkmm24-devel | |
373 | dnl rpm. But, this could be a non-rpm system. This check will | |
374 | dnl give the user a better idea about how to fix missing | |
375 | dnl requirements. | |
376 | PKG_CHECK_MODULES([gtkmm], [gtkmm-2.4 >= 2.8.0], | |
377 | have_gtkmm="yes", have_gtkmm="no") | |
378 | AS_IF([test "x${have_gtkmm}" == "xno" -a x"$enable_grapher" == "xyes"], | |
379 | AC_MSG_WARN([systemtap cannot find required gtkmm libs (gtkmm24-devel version 2.8.0 or higher may need to be installed)])) | |
380 | ||
381 | dnl Check for libglade | |
382 | PKG_CHECK_MODULES([libglade], [libglademm-2.4 >= 2.6.7], | |
383 | have_libglade="yes", have_libglade="no") | |
384 | AS_IF([test "x${have_libglade}" == "xno" -a x"$enable_grapher" == "xyes"], | |
385 | AC_MSG_WARN([systemtap cannot find required libglade libs (libglademm24-devel version 2.6.7 or higher may need to be installed)])) | |
386 | ||
387 | dnl Check for needed boost headers | |
388 | have_boost_headers="yes" | |
389 | AC_LANG_PUSH(C++) | |
390 | AC_CHECK_HEADERS([boost/algorithm/string.hpp boost/range.hpp], | |
391 | [], have_boost_headers="no") | |
392 | AC_LANG_POP(C++) | |
393 | AS_IF([test "x${have_boost_headers}" == "xno" -a x"$enable_grapher" == "xyes"], | |
394 | AC_MSG_WARN([cannot find required boost headers (boost-devel may need to be installed)])) | |
395 | ||
396 | dnl Bundle up all the grapher requirements into 1 variable. | |
397 | AS_IF([test "x${have_gtkmm}${have_libglade}${have_boost_headers}" == "xyesyesyes"], | |
398 | have_grapher_reqs="yes", have_grapher_reqs="no") | |
399 | ]) | |
400 | dnl If the user explicitly said to enable the grapher, but we can't | |
401 | dnl (since one or more of its requirements aren't installed), error. | |
402 | AS_IF([test "x${have_grapher_reqs}" == "xno" -a x"$enable_grapher" == "xyes"], | |
403 | AC_MSG_ERROR([systemtap cannot find grapher build requirements (gtkmm, libglade, and boost headers)])) | |
404 | dnl If the user didn't say to disable the grapher, and all the | |
405 | dnl requirements are installed, enable the grapher. | |
406 | AM_CONDITIONAL([BUILD_GRAPHER], [test "x${have_grapher_reqs}" == "xyes" -a x"$enable_grapher" != "xno"]) | |
407 | ||
408 | dnl Look for librpm. | |
409 | AC_ARG_WITH([rpm], | |
410 | [AS_HELP_STRING([--with-rpm], | |
411 | [query rpm database for missing debuginfos])], [], [with_rpm="auto"]) | |
412 | if test "$with_rpm" != "no"; then | |
413 | AC_CHECK_LIB(rpm, rpmtsInitIterator, [ | |
414 | AC_DEFINE([HAVE_LIBRPM],[1],[have librpm]) | |
415 | stap_LIBS="$stap_LIBS -lrpm" | |
416 | have_librpm="yes"], [have_librpm="no"]) | |
417 | AC_CHECK_LIB(rpmio, rpmFreeCrypto, [ | |
418 | AC_DEFINE([HAVE_LIBRPMIO],[1],[have librpmio]) | |
419 | stap_LIBS="$stap_LIBS -lrpmio" | |
420 | have_librpmio="yes"], [have_librpmio="no"]) | |
421 | if test "x$have_librpm" != "xyes" -a "$with_rpm" == "yes"; then | |
422 | AC_MSG_ERROR([cannot find librpm]) | |
423 | fi | |
424 | if test "x$have_librpmio" != "xyes" -a "$with_rpm" == "yes"; then | |
425 | AC_MSG_WARN([cannot find librpmio]) | |
426 | fi | |
427 | fi | |
428 | ||
429 | ||
430 | dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used | |
431 | dnl the system's elfutils. | |
432 | build_elfutils=no | |
433 | AC_ARG_WITH([elfutils], | |
434 | AS_HELP_STRING([--with-elfutils=DIRECTORY], | |
435 | [find elfutils source code in DIRECTORY]), | |
436 | [ | |
437 | case "$with_elfutils" in | |
438 | yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;; | |
439 | ''|no) ;; | |
440 | *) build_elfutils=yes ;; | |
441 | esac]) | |
442 | AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes) | |
443 | AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes], | |
444 | [cd $with_elfutils && pwd])`) | |
445 | ||
446 | if test $enable_translator = yes; then | |
447 | if test $build_elfutils = no; then | |
448 | # Need libdwfl-capable recent elfutils http://elfutils.fedorahosted.org/ | |
449 | ||
450 | # On modern debian/ubuntu, libebl has been merged into libdw | |
451 | # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=457543 | |
452 | save_LIBS="$LIBS" | |
453 | AC_CHECK_LIB(ebl, ebl_get_elfmachine,[ebl_LIBS=-lebl],[ebl_LIBS=]) | |
454 | LIBS="$save_LIBS" | |
455 | ||
456 | save_LIBS="$LIBS" | |
457 | AC_CHECK_LIB(dw, dwfl_module_getsym,[],[ | |
458 | AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])], | |
459 | [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf]) | |
460 | AC_CHECK_LIB(dw, dwarf_getcfi_elf,[],[ | |
461 | AC_MSG_ERROR([elfutils, libdw too old, need 0.142+])], | |
462 | [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf]) | |
463 | stap_LIBS="$stap_LIBS -Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf" | |
464 | LIBS="$save_LIBS" | |
465 | else | |
466 | # We built our own and stap_LDFLAGS points at the install. | |
467 | stap_LIBS="$stap_LIBS -Wl,--start-group -ldw -lebl -Wl,--end-group -lelf" | |
468 | fi | |
469 | fi | |
470 | ||
471 | AC_SUBST(stap_LIBS) | |
472 | AC_MSG_NOTICE([stap will link $stap_LIBS]) | |
473 | ||
474 | ||
475 | dnl Plop in the build (configure) date | |
476 | date=`date +%Y-%m-%d` | |
477 | AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date]) | |
478 | AC_SUBST(DATE, "$date") | |
479 | ||
480 | # Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun | |
481 | # being compiled on 32-bit userspace but running against 64-bit kernels. | |
482 | # This is no longer necessary. | |
483 | ||
484 | # Use tr1/unordered_map if available | |
485 | AC_LANG_PUSH(C++) | |
486 | AC_CHECK_HEADERS([tr1/unordered_map]) | |
487 | AC_CHECK_HEADERS([tr1/memory]) | |
488 | AC_CHECK_HEADERS([boost/shared_ptr.hpp]) | |
489 | AC_LANG_POP(C++) | |
490 | ||
491 | ||
492 | AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [ | |
493 | old_CFLAGS="$CFLAGS" | |
494 | CFLAGS="$CFLAGS -Wa,--fatal-warnings" | |
495 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([asm(".section .note.foo,\"?\",\"note\"\n" | |
496 | ".byte 1, 2, 3\n" | |
497 | ".previous\n" | |
498 | ".section .text,\"axG\",\"progbits\",foogroup,comdat\n" | |
499 | ".byte 1\n" | |
500 | ".pushsection .note.foo,\"?\",\"note\"\n" | |
501 | ".byte 4, 5, 6\n" | |
502 | ".popsection\n" | |
503 | ".byte 2\n");])], | |
504 | stap_cv_sectionq=yes, stap_cv_sectionq=no) | |
505 | CFLAGS="$old_CFLAGS"]) | |
506 | AC_SUBST(support_section_question) | |
507 | support_section_question=0 | |
508 | if test $stap_cv_sectionq = yes; then | |
509 | support_section_question=1 | |
510 | fi | |
511 | AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in]) | |
512 | ||
513 | if test $build_elfutils = yes -a $enable_translator = yes; then | |
514 | case "$with_elfutils" in | |
515 | /*) elfutils_srcdir="$with_elfutils" ;; | |
516 | *) elfutils_srcdir="../$with_elfutils" ;; | |
517 | esac | |
518 | AC_MSG_NOTICE([running ${elfutils_srcdir}/configure]) | |
519 | ||
520 | save_CFLAGS="$CFLAGS" | |
521 | save_CXXFLAGS="$CXXFLAGS" | |
522 | CXXFLAGS="$CXXFLAGS -fgnu89-inline" | |
523 | CFLAGS="$CFLAGS -fgnu89-inline" | |
524 | gnu89_inline_flag="" | |
525 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [ | |
526 | AC_MSG_NOTICE([Compiling elfutils with gcc -fgnu89-inline]) | |
527 | gnu89_inline_flag="-fgnu89-inline"],[ | |
528 | AC_MSG_NOTICE([Compiler does not support -fgnu89-inline])]) | |
529 | CFLAGS="$save_CFLAGS" | |
530 | CXXFLAGS="$save_CXXFLAGS" | |
531 | ||
532 | # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that | |
533 | # $ORIGIN is where libdw.so resides, which is not where there is a ../lib. | |
534 | # Note that $libdir might be using a quoted use of $exec_prefix or $prefix. | |
535 | # So we must make sure to pass those settings to elfutils configure. | |
536 | elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}" | |
537 | here=`pwd` | |
538 | (mkdir -p build-elfutils && cd build-elfutils && | |
539 | bash ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \ | |
540 | --includedir="${here}/include-elfutils" \ | |
541 | --libdir="${here}/lib-elfutils" \ | |
542 | --exec-prefix="$exec_prefix" \ | |
543 | --prefix="$prefix" \ | |
544 | CFLAGS="${CFLAGS/-Wall/} $gnu89_inline_flag" \ | |
545 | LDFLAGS="$LDFLAGS $elfutils_rpath" && | |
546 | if test -f ${elfutils_srcdir}/config/version.h.in; then | |
547 | echo Found elfutils/version.h header... | |
548 | else | |
549 | echo elfutils/version.h header not found, need elfutils 0.142+... | |
550 | exit -1 | |
551 | fi | |
552 | ) | |
553 | if test $? != 0; then exit -1; fi | |
554 | fi | |
555 | ||
556 | AC_SUBST(ENABLE_NLS, "$USE_NLS") | |
557 | AC_SUBST(localedir, "$localedir") | |
558 | AC_SUBST(LOCALEDIR, "$localedir") | |
559 | ||
560 | dnl This is here mainly to make sure that configure --prefix=... changes | |
561 | dnl the config.h files so files depending on it are recompiled | |
562 | dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS. | |
563 | dnl Formerly: Don't use this directly (when not given it is set to NONE). | |
564 | dnl Currently: inline autoconf's later defaulting | |
565 | ||
566 | stap_prefix=$prefix | |
567 | test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix | |
568 | AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location]) | |
569 | AC_SUBST(STAP_PREFIX, "$stap_prefix") | |
570 | ||
571 | AC_CONFIG_HEADERS([config.h:config.in]) | |
572 | AC_CONFIG_FILES([Makefile doc/Makefile \ | |
573 | doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \ | |
574 | grapher/Makefile \ | |
575 | grapher/stapgraph.1 \ | |
576 | stappaths.7 \ | |
577 | initscript/systemtap initscript/stap-server ]) | |
578 | AC_CONFIG_SUBDIRS(testsuite runtime/staprun) | |
579 | if test $enable_translator == "yes"; then | |
580 | AC_CONFIG_FILES([run-stap], [chmod +x run-stap]) | |
581 | fi | |
582 | AC_CONFIG_FILES([dtrace], [chmod +x dtrace]) | |
583 | ||
584 | # Setup "shadow" directory doc/beginners that has everything setup for | |
585 | # publican in one directory (through directory links if necessary). | |
586 | # It would be nice to use AC_CONFIG_LINKS, but automake complains when | |
587 | # the src is a directory and not a file. | |
588 | AC_CONFIG_FILES([doc/beginners/publican.cfg:doc/SystemTap_Beginners_Guide/publican.cfg.in]) | |
589 | AC_CONFIG_COMMANDS([doc/beginners], | |
590 | [rm -f $ac_abs_top_builddir/doc/beginners/en-US $ac_abs_top_builddir/doc/beginners/build/en-US/testsuite && mkdir -p $ac_abs_top_builddir/doc/beginners/build/en-US && ln -s $ac_abs_top_srcdir/doc/SystemTap_Beginners_Guide/en-US $ac_abs_top_builddir/doc/beginners/en-US && ln -s $ac_abs_top_srcdir/testsuite $ac_abs_top_builddir/doc/beginners/build/en-US/testsuite]) | |
591 | ||
592 | AC_OUTPUT | |
593 | ||
594 | if test "${prefix}" = "/usr/local"; then | |
595 | AC_MSG_NOTICE([]) | |
596 | AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend]) | |
597 | AC_MSG_NOTICE([configuring with a prefix. For example, try]) | |
598 | AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$]) | |
599 | AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,]) | |
600 | AC_MSG_NOTICE([is not supported.]) | |
601 | fi |