]> sourceware.org Git - systemtap.git/blob - configure.ac
configury: look for json-c >= 0.12 for monitor/interactive modes
[systemtap.git] / configure.ac
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], 3.1, systemtap@sourceware.org, systemtap)
5 dnl ^^^ see also NEWS, systemtap.spec, testsuite/configure.ac
6 dnl doc/SystemTap_Beginners_Guide/en-US/Book_Info.xml
7
8 dnl Get the target arch for libHelperSDT.so
9 AC_CANONICAL_TARGET
10
11 AC_PREREQ(2.63)
12 dnl We don't maintain a ChangeLog, which makes us non-GNU -> foreign.
13 AM_INIT_AUTOMAKE([no-dist foreign])
14 AM_MAINTAINER_MODE
15
16 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
17
18 AC_USE_SYSTEM_EXTENSIONS
19 AC_PROG_MKDIR_P
20 AC_SUBST(MKDIR_P)
21 AC_PROG_LN_S
22 AC_PROG_CC
23 AC_PROG_CXX
24 AC_PROG_CPP
25 AM_PROG_CC_C_O
26 AC_PROG_RANLIB
27 AC_OBJEXT
28 AC_EXEEXT
29 AC_PROG_INSTALL
30 AC_PROG_MAKE_SET
31 AC_SUBST(CFLAGS)
32 AC_SUBST(CXXFLAGS)
33 AC_SYS_LARGEFILE
34 AC_CHECK_FUNCS(ppoll)
35 AC_CHECK_FUNCS(openat)
36 AM_GNU_GETTEXT(external)
37 AM_GNU_GETTEXT_VERSION([0.19.4])
38
39 if test "x$GMSGFMT" = "x:"; then
40 AC_MSG_ERROR([missing gnu /usr/bin/msgfmt])
41 fi
42
43 dnl Handle the prologues option.
44 dnl
45 dnl If the user didn't specify --enable-prologues/--disable-prologues
46 dnl and the x86 system has a version of gcc less than version 4,
47 dnl automatically enable prologues.
48 if test "${enable_prologues+set}" != set; then
49 AC_MSG_CHECKING([to see if prologue searching should be the default])
50 if { echo '#if __i386__ == 1 && __GNUC__ < 4'
51 echo ' yes '
52 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
53 enable_prologues=yes
54 AC_MSG_RESULT([yes])
55 else
56 AC_MSG_RESULT([no])
57 fi
58 fi
59 AC_ARG_ENABLE([prologues],
60 AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]),
61 [
62 if test "$enable_prologues" = yes; then
63 AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default])
64 fi])
65
66 dnl Handle the disable-sdt-probes option.
67 dnl
68 dnl Default to --disable-sdt-probes if --enable-sdt-probes/--disable-prologues
69 dnl was not specified and the gcc version is less than version 4,
70
71 if test "${enable_sdt_probes+set}" != set; then
72 AC_MSG_CHECKING([to see if sdt probes should be the default])
73 if { echo '#if __GNUC__ < 4'
74 echo ' yes '
75 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
76 enable_sdt_probes=no
77 AC_MSG_RESULT([no])
78 else
79 AC_MSG_RESULT([yes])
80 fi
81 fi
82 AC_ARG_ENABLE([sdt-probes],
83 [AS_HELP_STRING([--disable-sdt-probes],
84 [disable process.mark probes in stap, staprun, stapio])])
85 AS_IF([test "x$enable_sdt_probes" != xno], [
86 AC_DEFINE([ENABLE_SDT_PROBES], [1],
87 [Define to 1 to enable process.mark probes in stap, staprun, stapio.])
88 ])
89
90 dnl We're now requiring *some* C++11, using RHEL6 (gcc 4.4.7) as a baseline.
91 dnl This is too strict about __cplusplus for gcc < 4.7, so we have a manual fallback.
92 AX_CXX_COMPILE_STDCXX(11, noext, optional)
93 AS_IF([test "x$HAVE_CXX11" != x1],[
94 AC_LANG_PUSH(C++)
95 AX_CHECK_COMPILE_FLAG([-std=c++0x], [
96 AC_MSG_NOTICE([Compiling with -std=c++0x])
97 CXX="$CXX -std=c++0x"
98 HAVE_CXX11=1
99 ], [
100 AC_MSG_ERROR([A compiler with C++11 support is required.])
101 ])
102 AC_LANG_POP(C++)
103 ])
104
105 AC_ARG_ENABLE([ssp],
106 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
107 AS_IF([test "x$enable_ssp" != xno],[
108 save_CFLAGS="$CFLAGS"
109 save_CXXFLAGS="$CXXFLAGS"
110 CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
111 CFLAGS="$CFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
112 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
113 AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.])
114 CFLAGS="$save_CFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"
115 CXXFLAGS="$save_CXXFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"],[
116 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
117 CFLAGS="$save_CFLAGS"
118 CXXFLAGS="$save_CXXFLAGS"])])
119
120
121 dnl Link with gold if possible
122 dnl but: https://bugzilla.redhat.com/show_bug.cgi?id=636603
123 dnl
124 dnl AC_PATH_PROG(GOLD, [ld.gold], [no])
125 dnl if test "x$GOLD" != "xno"
126 dnl then
127 dnl mkdir -p Bdir
128 dnl ln -sf $GOLD Bdir/ld
129 dnl LDFLAGS="$LDFLAGS -B`pwd`/Bdir/"
130 dnl AC_MSG_NOTICE([using ld.gold to link])
131 dnl fi
132
133
134 # Compiling without fPIE by default (see PR 9922)
135 AC_ARG_ENABLE([pie],
136 [AS_HELP_STRING([--enable-pie], [enable position-independent-executable])])
137 AS_IF([test "x$enable_pie" == xyes],[
138 PIECFLAGS='-fPIE'
139 PIECXXFLAGS='-fPIE'
140 PIELDFLAGS='-pie -Wl,-z,relro -Wl,-z,now'
141 save_CFLAGS="$CFLAGS"
142 save_CXXFLAGS="$CXXFLAGS"
143 save_LDFLAGS="$LDFLAGS"
144 CFLAGS="$CFLAGS $PIECFLAGS"
145 CXXFLAGS="$CXXFLAGS $PIECXXFLAGS"
146 LDFLAGS="$LDFLAGS $PIELDFLAGS"
147 AC_LINK_IFELSE([AC_LANG_SOURCE([void main () {}])], [
148 AC_MSG_NOTICE([Compiling with gcc pie et al.])
149 ], [
150 AC_MSG_NOTICE([Compiler does not support -pie et al.])
151 PIECFLAGS=""
152 PIECXXFLAGS=""
153 PIELDFLAGS=""
154 ])
155 CFLAGS="$save_CFLAGS"
156 CXXFLAGS="$save_CXXFLAGS"
157 LDFLAGS="$save_LDFLAGS"
158 ])
159 AC_SUBST(PIELDFLAGS)
160 AC_SUBST(PIECFLAGS)
161 AC_SUBST(PIECXXFLAGS)
162
163 dnl Handle optional sqlite support. If enabled/disabled by the user,
164 dnl do the right thing. If not specified by the user, use it if
165 dnl present.
166 AC_ARG_ENABLE([sqlite],
167 AS_HELP_STRING([--enable-sqlite], [build with sqlite support]),
168 [], dnl ACTION-IF-GIVEN
169 [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN
170 sqlite3_LIBS=
171 AS_IF([test "x$enable_sqlite" != xno],
172 [AC_CHECK_LIB([sqlite3], [sqlite3_open],
173 [AC_SUBST([sqlite3_LIBS], [-lsqlite3])
174 AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the 'sqlite3' library (-lsqlite3).])],
175 [if test "x$enable_sqlite" != xcheck; then
176 AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite failed])
177 fi])])
178
179 dnl Handle the option to only build runtime
180 AC_ARG_ENABLE([translator],
181 AS_HELP_STRING([--disable-translator], [build only runtime utilities]),
182 [],
183 [enable_translator="yes"])
184 AM_CONDITIONAL([BUILD_TRANSLATOR], [test "$enable_translator" == "yes"])
185
186 dnl Handle the option to build the crash extension
187 AC_ARG_ENABLE([crash],
188 AS_HELP_STRING([--enable-crash@<:@=DIRECTORY@:>@],
189 [enable crash extension (default is disabled). Optional DIRECTORY
190 is the path to the crash header file (needed if installed in a
191 non-standard location).]),
192 [if test "$enable_crash" != "no"; then
193 dnl Handle custom install dir (if needed)
194 save_CPPFLAGS="$CPPFLAGS"
195 if test "$enable_crash" != "yes"; then
196 staplog_CPPFLAGS=-I$enable_crash
197 CPPFLAGS="${staplog_CPPFLAGS} $CPPFLAGS"
198 AC_SUBST([staplog_CPPFLAGS])
199 fi
200 AC_CHECK_HEADERS([crash/defs.h], [],
201 [AC_MSG_ERROR([cannot find required crash header (crash-devel may need to be installed)])],
202 [
203 #define NR_CPUS 256
204 ])
205 CPPFLAGS="$save_CPPFLAGS"
206 fi],
207 [enable_crash="no"])
208 AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"])
209
210 dnl Handle the option to build the documentation
211 building_docs="no"
212 AC_ARG_ENABLE([docs],
213 AS_HELP_STRING([--enable-docs],
214 [enable building documentation (default on if latex etc. found).]),
215 [enable_docs=$enableval],
216 [enable_docs="check"])
217 AC_CHECK_PROG(have_latex, latex, yes, no)
218 AC_CHECK_PROG(have_dvips, dvips, yes, no)
219 AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no)
220 if test "x${have_latex}${have_dvips}${have_ps2pdf}" != "xyesyesyes"; then
221 if test "$enable_docs" == "yes"; then
222 AC_MSG_ERROR([cannot find all tools for building documentation])
223 fi
224 if test "$enable_docs" == "check"; then
225 AC_MSG_WARN([will not build documentation, cannot find all tools])
226 fi
227 fi
228 if test "x${have_latex}${have_dvips}${have_ps2pdf}" == "xyesyesyes" -a "$enable_docs" != "no"; then
229 building_docs="yes"
230 fi
231 AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" == "yes"])
232
233
234 dnl Handle the option to build the reference documentation
235 building_refdocs="no"
236 AC_ARG_ENABLE([refdocs],
237 AS_HELP_STRING([--enable-refdocs],
238 [enable building reference documentation (default on if other documentation built).]),
239 [enable_refdocs=$enableval],
240 [enable_refdocs="check"])
241 if test "$building_docs" == "no" -a "$enable_refdocs" == "yes" ; then
242 AC_MSG_ERROR([must use --enable-docs with --enable-refdocs])
243 fi
244 if test "$enable_refdocs" != "no" -a "${building_docs}" == "yes"; then
245 building_refdocs="yes"
246 fi
247 AM_CONDITIONAL([BUILD_REFDOCS], [test "$building_refdocs" == "yes"])
248
249 AC_CHECK_PROG(have_xmlto, xmlto, yes, no)
250 AC_CHECK_PROG(have_fop, fop, yes, no)
251 if test "x${have_fop}" == "xyes"; then
252 # Due to rhbz505364 / 830266, we must actually test-run fop, not just
253 # hope that it works.
254 AC_MSG_CHECKING([to see if xmlto --with-fop actually works])
255 if xmlto --with-fop pdf ${srcdir}/doc/SystemTap_Tapset_Reference/dummy-tapsets.xml >/dev/null 2>&1; then
256 AC_MSG_RESULT([yes])
257 else
258 AC_MSG_RESULT([it's dead, Jim])
259 have_fop="broken"
260 fi
261 rm -f dummy-tapsets.pdf
262 fi
263 AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" == "yes"])
264 AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" == "yes"])
265
266 dnl Handle the option to build the html documentation
267 building_htmldocs="no"
268 AC_ARG_ENABLE([htmldocs],
269 AS_HELP_STRING([--enable-htmldocs],
270 [enable building html documentation (default off).]),
271 [building_htmldocs=$enableval],
272 [building_htmldocs="no"])
273 if test "$have_xmlto" == "no" -a "$building_htmldocs" == "yes"; then
274 AC_MSG_ERROR([xmlto required for building html documentation])
275 fi
276
277 AM_CONDITIONAL([BUILD_HTMLDOCS], [test "$building_htmldocs" == "yes"])
278
279 dnl There is a strange bug in older versions of xmlto when generating pdf.
280 dnl https://bugzilla.redhat.com/show_bug.cgi?id=526273
281 dnl So make sure to have a chapter title starting with L plus an refentry.
282 dnl This will make sure the xmlto pdf support test fails on buggy versions.
283 cat > conftest.xml << 'EOF'
284 <?xml version="1.0" encoding="UTF-8"?>
285 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
286 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
287 <book lang="en">
288 <bookinfo><title>foo</title></bookinfo>
289 <chapter id="logging.stp"><title>Logging Tapset</title>
290 <refentry id="API-log"><refnamediv><refname>log</refname>
291 <refpurpose>logging</refpurpose></refnamediv>
292 <refsect1><title>Description</title>
293 <para>baz</para></refsect1></refentry></chapter>
294 </book>
295 EOF
296
297 if test "x${have_xmlto}" == "xyes"; then
298 AC_MSG_CHECKING([for xmlto --stringparam support])
299 xmlto --stringparam man.authors.section.enabled=0 html-nochunks conftest.xml >/dev/null 2>&1
300 if test $? == 0; then
301 have_xmlto_stringparam="yes"
302 AC_MSG_RESULT([yes])
303 else
304 AC_MSG_RESULT([no])
305 fi
306 rm -f conftest.html
307 fi
308 AM_CONDITIONAL([XMLTO_STRINGPARAM], [test "$have_xmlto_stringparam" == "yes"])
309
310 rm -f conftest.xml
311
312 dnl See if we have the nss/nspr headers and libraries
313 AC_ARG_WITH([nss],
314 AS_HELP_STRING([--without-nss],
315 [Do not use NSS even if present]))
316
317 AS_IF([test "x$with_nss" != "xno"], [
318 PKG_CHECK_MODULES([nss], [nss >= 3],
319 [have_nss=yes
320 AC_DEFINE([HAVE_NSS], [1], [Define to 1 if you have the nss libraries.])
321 ], [have_nss=no])
322 ], [have_nss=no])
323
324 AM_CONDITIONAL([HAVE_NSS], [test "${have_nss}" = "yes"])
325
326 dnl Handle dracut directory configuration. Note we hard-code /usr by default,
327 dnl instead of $prefix, because dracut is a system service that doesn't listen
328 dnl at relocatable directories.
329 AC_ARG_WITH([dracutstap],
330 AS_HELP_STRING([--with-dracutstap=DIR],
331 [Install dracut module files in DIR]))
332 AS_IF([test "x$with_dracutstap" != "x"],[dracutstap="$with_dracutstap"],
333 [dracutstap=/usr/lib/dracut/modules.d/99stap])
334 AC_MSG_NOTICE([using dracut module directory $dracutstap])
335 AC_SUBST(dracutstap)
336
337 dnl PR20850 Fix the boot time probing feature for fedora too. Typical rhel
338 dnl location is /sbin, typical fedora location is /usr/bin.
339 AC_ARG_WITH([dracutbindir],
340 AS_HELP_STRING([--with-dracutbindir=DIR],
341 [Use the dracut binary located in DIR]))
342 AS_IF([test "x$with_dracutbindir" != "x"],[dracutbindir="$with_dracutbindir"],
343 [dracutbindir=/sbin])
344 AC_MSG_NOTICE([using dracut binary $dracutbindir])
345 AC_SUBST(dracutbindir)
346
347 dnl Handle the option to build the compile server.
348 AC_ARG_ENABLE([server],
349 AS_HELP_STRING([--enable-server],
350 [enable building of stap-server (default on if nss etc. found).]),
351 [enable_server=$enableval],
352 [enable_server="check"])
353
354 if test "$enable_server" != "no"; then
355 dnl See if we have enough libraries and tools to build the compile server
356 if test "x${have_nss}" != "xyes"; then
357 AC_MSG_WARN([will not build systemtap compile server, cannot find nss headers])
358 fi
359 fi
360 AM_CONDITIONAL([BUILD_SERVER], [test "${have_nss}" == "yes" -a "$enable_server" != "no"])
361
362 if test "${have_nss}" != "yes"; then
363 AC_MSG_WARN([compile-server client functionality will be disabled, cannot find nss development files])
364 fi
365
366 dnl See if we have the avahi libraries and headers
367 AC_ARG_WITH([avahi],
368 AS_HELP_STRING([--without-avahi],
369 [Do not use Avahi even if present]))
370
371 AS_IF([test "x$with_avahi" != "xno"], [
372 PKG_CHECK_MODULES([avahi], [avahi-client],
373 [have_avahi=yes
374 AC_DEFINE([HAVE_AVAHI], [1], [Define to 1 if you have the avahi libraries.])
375 ], [have_avahi=no])
376 ], [have_avahi=no])
377
378 AM_CONDITIONAL([HAVE_AVAHI], [test "${have_avahi}" = "yes"])
379
380 if test "${have_avahi}" != "yes"; then
381 AC_MSG_WARN([some compile-server functionality will be restricted, cannot find avahi development files])
382 fi
383
384
385 dnl Look for librpm.
386 AC_ARG_WITH([rpm],
387 [AS_HELP_STRING([--with-rpm],
388 [query rpm database for missing debuginfos])], [], [with_rpm="auto"])
389 if test "$with_rpm" != "no"; then
390 AC_CHECK_LIB(rpm, rpmtsInitIterator, [
391 AC_DEFINE([HAVE_LIBRPM],[1],[have librpm])
392 stap_LIBS="$stap_LIBS -lc -lrpm"
393 have_librpm="yes"], [have_librpm="no"])
394 AC_CHECK_LIB(rpmio, rpmFreeCrypto, [
395 AC_DEFINE([HAVE_LIBRPMIO],[1],[have librpmio])
396 stap_LIBS="$stap_LIBS -lc -lrpmio"
397 have_librpmio="yes"], [have_librpmio="no"])
398 if test "x$have_librpm" != "xyes" -a "$with_rpm" == "yes"; then
399 AC_MSG_ERROR([cannot find librpm])
400 fi
401 if test "x$have_librpmio" != "xyes" -a "$with_rpm" == "yes"; then
402 AC_MSG_WARN([cannot find librpmio])
403 fi
404 fi
405
406 dnl Look for readline.
407 dnl
408 dnl First save the orignal value of LIBS.
409 LIBS_no_readline=$LIBS
410
411 dnl Check how for readline presence and how to link with it. On some
412 dnl systems you need to add a termcap compatible library.
413 have_libreadline="no"
414 AC_MSG_CHECKING([how to link readline libs])
415 for libtermcap in "" tinfo ncursesw ncurses curses termcap; do
416 if test -z "$libtermcap"; then
417 READLINE_LIBS="-lreadline"
418 else
419 READLINE_LIBS="-lreadline -l$libtermcap"
420 fi
421 LIBS="$READLINE_LIBS $LIBS_no_readline"
422 AC_LINK_IFELSE(
423 [AC_LANG_CALL([],[readline])],
424 [have_libreadline="yes"])
425 if test "$have_libreadline" = "yes"; then
426 break
427 fi
428 done
429 if test "$have_libreadline" = "no"; then
430 AC_MSG_RESULT([none])
431 READLINE_LIBS=""
432 else
433 AC_MSG_RESULT([$READLINE_LIBS])
434 AC_DEFINE(HAVE_LIBREADLINE, [1],
435 [Define if you have the readline library (-lreadline).])
436 fi
437 AC_SUBST([READLINE_LIBS])
438 AM_CONDITIONAL([HAVE_LIBREADLINE], [test "$have_libreadline" == "yes"])
439
440 dnl End of readline checks: restore LIBS
441 LIBS=$LIBS_no_readline
442
443 dnl Allow user to choose python3 for /usr/bin/dtrace
444 AC_ARG_WITH([python3],
445 AS_HELP_STRING([--with-python3],[prefer /usr/bin/python3]))
446 AS_IF([test "x$with_python3" = "xyes"],
447 [AC_SUBST(python,[python3])],
448 [AC_SUBST(python,[python])])
449
450 dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
451 dnl the system's elfutils.
452 build_elfutils=no
453 AC_ARG_WITH([elfutils],
454 AS_HELP_STRING([--with-elfutils=DIRECTORY],
455 [find elfutils source code in DIRECTORY]),
456 [
457 case "$with_elfutils" in
458 yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
459 ''|no) ;;
460 *) build_elfutils=yes ;;
461 esac])
462 AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
463 AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
464 [cd $with_elfutils && pwd])`)
465
466 if test $enable_translator = yes; then
467 if test $build_elfutils = no; then
468 # Need libdwfl-capable recent elfutils http://elfutils.org/
469
470 # On modern debian/ubuntu, libebl has been merged into libdw
471 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=457543
472 save_LIBS="$LIBS"
473 AC_CHECK_LIB(ebl, ebl_get_elfmachine,[ebl_LIBS=-lebl],[ebl_LIBS=])
474 LIBS="$save_LIBS"
475
476 save_LIBS="$LIBS"
477 AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
478 AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])],
479 [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf])
480 AC_CHECK_LIB(dw, dwarf_next_unit,[],[
481 AC_MSG_ERROR([elfutils, libdw too old, need 0.148+])],
482 [-Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf])
483 stap_LIBS="$stap_LIBS -Wl,--start-group -ldw $ebl_LIBS -Wl,--end-group -lelf"
484 LIBS="$save_LIBS"
485 else
486 # We built our own and stap_LDFLAGS points at the install.
487 stap_LIBS="$stap_LIBS -Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
488 fi
489 fi
490
491 AC_SUBST(stap_LIBS)
492 AC_MSG_NOTICE([stap will link $stap_LIBS])
493
494 # staprun has more modest libelf needs
495 if test $build_elfutils = no; then
496 save_LIBS="$LIBS"
497 dnl this will only succeed with elfutils 0.142+
498 AC_CHECK_LIB(elf,elf_getshdrstrndx,[],[
499 AC_MSG_FAILURE([libelf too old, need 0.142+])])
500 staprun_LIBS="$staprun_LIBS -lelf"
501 LIBS="$save_LIBS"
502 else
503 # We built our own and staprun_LDFLAGS points at the install.
504 staprun_LIBS="$staprun_LIBS -lelf"
505 fi
506
507 AC_SUBST(staprun_LIBS)
508 AC_MSG_NOTICE([staprun will link $staprun_LIBS])
509
510
511 dnl Plop in the build (configure) date
512 date=`date +%Y-%m-%d`
513 AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
514 AC_SUBST(DATE, "$date")
515
516 # Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun
517 # being compiled on 32-bit userspace but running against 64-bit kernels.
518 # This is no longer necessary.
519
520 AC_LANG_PUSH(C++)
521 # Use boost::string_ref if available
522 AC_CHECK_HEADERS([boost/utility/string_ref.hpp])
523 AC_LANG_POP(C++)
524
525
526 # Check for Dyninst headers and libraries
527 AC_ARG_WITH([dyninst],
528 AS_HELP_STRING([--with-dyninst=DIRECTORY],
529 [find dyninst headers/libraries in DIRECTORY]))
530
531 case "$with_dyninst" in
532 no) ;;
533 ''|yes) # Try a simple-minded distro search
534 DYNINST_CXXFLAGS="-I/usr/include/dyninst"
535 DYNINST_LDFLAGS="-L/usr/lib64/dyninst -L/usr/lib/dyninst" # XXX both lib paths!?!
536 ;;
537 *) # Use paths in the user-specified prefix
538 DYNINST_CXXFLAGS="-I$with_dyninst/include"
539 DYNINST_LDFLAGS="-L$with_dyninst/lib/" # XXX need lib64 too?
540 ;;
541 esac
542 if test "$with_dyninst" != "no"; then
543 AC_LANG_PUSH(C++)
544 old_CPPFLAGS="$CPPFLAGS"
545 CPPFLAGS="$CPPFLAGS $DYNINST_CXXFLAGS"
546 AC_MSG_NOTICE([checking dyninst support])
547 AC_CHECK_HEADERS([BPatch_object.h], [
548 AC_SUBST(DYNINST_CXXFLAGS)
549 AC_SUBST(DYNINST_LDFLAGS)
550 AC_DEFINE([HAVE_DYNINST],[1],[Define to 1 if Dyninst is enabled])
551 have_dyninst=yes
552 AC_MSG_NOTICE([dyninst support available])])
553 if test -n "$with_dyninst" -a "$have_dyninst" != "yes"; then
554 AC_MSG_ERROR([Dyninst does not appear to be usable])
555 fi
556 CPPFLAGS="$old_CPPFLAGS"
557 AC_LANG_POP(C++)
558 fi
559 AM_CONDITIONAL([HAVE_DYNINST], [test "${have_dyninst}" = "yes"])
560
561
562 dnl Check for the libvirt and libxml2 devel packages
563
564 AC_ARG_ENABLE([virt],
565 AS_HELP_STRING([--enable-virt],
566 [enable building of stapvirt support (default on if libvirt etc. found).]),
567 [enable_virt=$enableval],
568 [enable_virt="check"])
569
570 dnl We require libvirt >= 1.0.2 because stapvirt relies on the
571 dnl virDomainOpenChannel function, which was implemented in 1.0.2.
572 PKG_CHECK_MODULES([libvirt], [libvirt >= 1.0.2], [
573 have_libvirt=yes
574 AC_DEFINE([HAVE_LIBVIRT],[1],[Define to 1 if libvirt development libraries are installed])
575 ], [have_libvirt=no])
576 AM_CONDITIONAL([HAVE_LIBVIRT], [test "${have_libvirt}" = "yes"])
577 PKG_CHECK_MODULES([libxml2], [libxml-2.0], [
578 have_libxml2=yes
579 AC_DEFINE([HAVE_LIBXML2],[1],[Define to 1 if libxml2 development libraries are installed])
580 ], [have_libxml2=no])
581 AM_CONDITIONAL([HAVE_LIBXML2], [test "${have_libxml2}" = "yes"])
582
583 if test "$enable_virt" != "no"; then
584 dnl See if we have enough libraries and tools to build the virt server
585 if test "x${have_libvirt}" != "xyes"; then
586 AC_MSG_WARN([will not build systemtap virt support, cannot find libvirt headers])
587 fi
588 if test "x${have_libxml2}" != "xyes"; then
589 AC_MSG_WARN([will not build systemtap virt support, cannot find xml2 headers])
590 fi
591 fi
592 AM_CONDITIONAL([BUILD_VIRT], [test "${have_libvirt}" == "yes" -a "${have_libxml2}" == "yes" -a "$enable_virt" != "no"])
593
594 dnl Check for presence of json-c and ncurses for use in monitor mode
595 PKG_CHECK_MODULES([jsonc], [json-c >= 0.12], [have_jsonc=yes], [have_jsonc=no])
596 PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=yes], [have_ncurses=no])
597 AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes"])
598 if test "${have_jsonc}" == "yes" -a "${have_ncurses}" == yes; then
599 AC_DEFINE([HAVE_MONITOR_LIBS],[1],[Define to 1 if json-c and ncurses libraries are installed])
600 fi
601
602 AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [
603 old_CFLAGS="$CFLAGS"
604 CFLAGS="$CFLAGS -Wa,--fatal-warnings"
605 AC_COMPILE_IFELSE([AC_LANG_SOURCE([asm(".section .note.foo,\"?\",\"note\"\n"
606 ".byte 1, 2, 3\n"
607 ".previous\n"
608 ".section .text,\"axG\",\"progbits\",foogroup,comdat\n"
609 ".byte 1\n"
610 ".pushsection .note.foo,\"?\",\"note\"\n"
611 ".byte 4, 5, 6\n"
612 ".popsection\n"
613 ".byte 2\n");])],
614 stap_cv_sectionq=yes, stap_cv_sectionq=no)
615 CFLAGS="$old_CFLAGS"])
616 AC_SUBST(support_section_question)
617 support_section_question=0
618 if test $stap_cv_sectionq = yes; then
619 support_section_question=1
620 fi
621 AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in])
622
623 if test $build_elfutils = yes -a $enable_translator = yes; then
624 here=`pwd`
625 case "$with_elfutils" in
626 /*) elfutils_srcdir="$with_elfutils" ;;
627 *) elfutils_srcdir="${here}/$with_elfutils" ;;
628 esac
629
630 if ! test -f ${elfutils_srcdir}/configure; then
631 AC_MSG_ERROR([No ${elfutils_srcdir}/configure, forgot to run autoreconf -i?])
632 fi
633 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
634
635 save_CFLAGS="$CFLAGS"
636 save_CXXFLAGS="$CXXFLAGS"
637 CXXFLAGS="$CXXFLAGS -fgnu89-inline"
638 CFLAGS="$CFLAGS -fgnu89-inline"
639 gnu89_inline_flag=""
640 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [
641 AC_MSG_NOTICE([Compiling elfutils with gcc -fgnu89-inline])
642 gnu89_inline_flag="-fgnu89-inline"],[
643 AC_MSG_NOTICE([Compiler does not support -fgnu89-inline])])
644 CFLAGS="$save_CFLAGS"
645 CXXFLAGS="$save_CXXFLAGS"
646
647 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
648 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
649 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
650 # So we must make sure to pass those settings to elfutils configure.
651 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
652 # Check whether this is a source release, or a source checkout.
653 # We need --enable-maintainer-mode if it isn't a source release.
654 # elfutils.spec is only distributed in source releases.
655 if test -f ${elfutils_srcdir}/elfutils.spec; then
656 need_maintainer_option=""
657 else
658 need_maintainer_option="--enable-maintainer-mode"
659 fi
660 (mkdir -p build-elfutils && cd build-elfutils &&
661 bash ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
662 --includedir="${here}/include-elfutils" \
663 --libdir="${here}/lib-elfutils" \
664 --exec-prefix="$exec_prefix" \
665 --prefix="$prefix" \
666 --enable-dwz \
667 ${need_maintainer_option} \
668 CFLAGS="${CFLAGS/-Wall/} $gnu89_inline_flag -fexceptions" \
669 LDFLAGS="$LDFLAGS $elfutils_rpath" &&
670 if test -f ${elfutils_srcdir}/config/version.h.in; then
671 echo Found elfutils/version.h header...
672 else
673 echo elfutils/version.h header not found, need elfutils 0.142+...
674 exit -1
675 fi
676 )
677 if test $? != 0; then exit -1; fi
678 fi
679
680 dnl Optional libselinux support allows stapdyn to check
681 dnl for booleans that would prevent Dyninst from working.
682 AC_ARG_WITH([selinux],
683 AS_HELP_STRING([--without-selinux],
684 [Do not use libselinux even if present]))
685
686 AS_IF([test "x$with_selinux" != "xno"], [
687 PKG_CHECK_MODULES([selinux], [libselinux],
688 [have_selinux=yes
689 AC_DEFINE([HAVE_SELINUX], [1], [Define to 1 if you have the SELinux libraries.])
690 ], [have_selinux=no])
691 ], [have_selinux=no])
692
693 AM_CONDITIONAL([HAVE_SELINUX], [test "${have_selinux}" = "yes"])
694
695 dnl Used in monitor mode. Only available on kernel versions >= 2.6.35
696 AC_CHECK_DECL([F_SETPIPE_SZ],
697 [AC_DEFINE(HAVE_F_SETPIPE_SZ,[1], Define to 1 if F_SETPIPE_SZ is available.)],
698 [],
699 [#include <fcntl.h>])
700
701 dnl Handle java+byteman support
702 AC_CHECK_PROG(have_javac, javac, yes, no)
703 AC_CHECK_PROG(have_jar, jar, yes, no)
704 if test "$have_javac" != no -a "$have_jar" != no; then
705 echo java found, will try to configure Byteman support
706
707 AC_ARG_WITH([java],
708 [AS_HELP_STRING([--with-java=DIRECTORY],
709 [Specify JDK directory to compile libHelperSDT.so against (default is /usr/lib/jvm/java)])],
710 [],
711 [with_java=/usr/lib/jvm/java])
712 dnl don't use AC_CHECK_FILE here, as that blocks cross-compiling
713 if test ! -d "$with_java"; then
714 with_java=no
715 fi
716 AC_SUBST(JAVADIR, "${with_java}") # always needed to compile
717
718 if test "$with_java" != "no"; then
719 AC_DEFINE_UNQUOTED(HAVE_JAVA, "1", [Flag indicating that libHelperSDT.so is available (can be found in PKGLIBDIR)])
720 fi
721
722 AM_CONDITIONAL([HAVE_JAVA], [test "$with_java" != "no"])
723
724 else
725 AC_MSG_WARN([will not run per-method java probing, missing byteman or java requirements])
726 AM_CONDITIONAL([HAVE_JAVA],false)
727 fi # java+byteman support
728
729 AC_SUBST(ENABLE_NLS, "$USE_NLS")
730 AC_SUBST(localedir, "$localedir")
731 AC_SUBST(LOCALEDIR, "$localedir")
732
733 AC_ARG_WITH([extra-version],
734 AS_HELP_STRING([--with-extra-version=STRING],
735 [Add STRING to stap -V version]))
736 AS_IF([test "x$with_extra_version" != "xno"], [
737 stap_extra_version="$with_extra_version"
738 AC_MSG_NOTICE([Adding extra version $stap_extra_version])], [
739 stap_extra_version=""])
740 AC_DEFINE_UNQUOTED(STAP_EXTRA_VERSION, "$stap_extra_version", [extra stap version code])
741 AC_SUBST(STAP_EXTRA_VERSION, "$stap_extra_version")
742
743 dnl This is here mainly to make sure that configure --prefix=... changes
744 dnl the config.h files so files depending on it are recompiled
745 dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS.
746 dnl Formerly: Don't use this directly (when not given it is set to NONE).
747 dnl Currently: inline autoconf's later defaulting
748
749 stap_prefix=$prefix
750 test "$stap_prefix" = NONE && stap_prefix=$ac_default_prefix
751 AC_DEFINE_UNQUOTED(STAP_PREFIX, "$stap_prefix", [configure prefix location])
752 AC_SUBST(STAP_PREFIX, "$stap_prefix")
753
754 AC_CONFIG_HEADERS([config.h:config.in])
755 AC_CONFIG_FILES([Makefile doc/Makefile man/Makefile man/cs/Makefile \
756 doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \
757 man/stap.1 man/stappaths.7 man/systemtap.8 \
758 man/cs/stap.1 man/cs/stappaths.7 man/cs/systemtap.8 \
759 initscript/config.systemtap initscript/config.stap-server \
760 initscript/systemtap initscript/stap-server \
761 initscript/99stap/module-setup.sh \
762 initscript/99stap/install \
763 initscript/99stap/check ])
764 AC_CONFIG_SUBDIRS(testsuite)
765 if test $enable_translator == "yes"; then
766 AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
767 fi
768 AC_CONFIG_FILES([dtrace], [chmod +x dtrace])
769 AC_CONFIG_FILES(stapdyn/Makefile)
770 AC_CONFIG_FILES(java/Makefile)
771 AC_CONFIG_FILES([java/stapbm], [chmod +x java/stapbm])
772 AC_CONFIG_FILES(staprun/Makefile)
773 AC_CONFIG_FILES([staprun/run-staprun], [chmod +x staprun/run-staprun])
774 AC_CONFIG_FILES([staprun/guest/stapshd], [chmod +x staprun/guest/stapshd])
775 AC_CONFIG_FILES([staprun/guest/stapsh-daemon], [chmod +x staprun/guest/stapsh-daemon])
776 AC_CONFIG_FILES([staprun/guest/stapsh@.service])
777
778 # Setup "shadow" directory doc/beginners that has the basic directories setup for
779 # xmlto in one directory (through directory links if necessary).
780 # It would be nice to use AC_CONFIG_LINKS, but automake complains when
781 # the src is a directory and not a file.
782 AC_CONFIG_COMMANDS([doc/beginners],
783 [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])
784
785 AC_OUTPUT
786
787 if test "${prefix}" = "/usr/local"; then
788 AC_MSG_NOTICE([])
789 AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend])
790 AC_MSG_NOTICE([configuring with a prefix. For example, try])
791 AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$])
792 AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,])
793 AC_MSG_NOTICE([is not supported.])
794 fi
This page took 0.069554 seconds and 6 git commands to generate.