]> sourceware.org Git - systemtap.git/blob - configure.ac
PR 10889: Reorganize client/server man pages. Document --unprivileged.
[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], 1.0, systemtap@sources.redhat.com, systemtap)
5 dnl ^^^ see also NEWS, systemtap.spec, testsuite/configure.ac
6
7 AC_PREREQ(2.59)
8 AM_INIT_AUTOMAKE
9 AM_MAINTAINER_MODE
10
11 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
12
13 AM_PROG_MKDIR_P
14 AC_SUBST(MKDIR_P)
15 AC_PROG_LN_S
16 AC_PROG_CC
17 AC_PROG_CXX
18 AC_PROG_CPP
19 AM_PROG_CC_STDC
20 AM_PROG_CC_C_O
21 AM_C_PROTOTYPES
22 AC_PROG_RANLIB
23 AC_OBJEXT
24 AC_EXEEXT
25 AC_PROG_INSTALL
26 AC_PROG_MAKE_SET
27 AC_SUBST(CFLAGS)
28 AC_SUBST(CXXFLAGS)
29
30 dnl Handle the perfmon option.
31 AC_ARG_ENABLE([perfmon],
32 AS_HELP_STRING([--enable-perfmon@<:@=DIRECTORY@:>@],
33 [enable perfmon support (default is disabled). Optional DIRECTORY
34 is the path to the perfmon installation (needed if installed in a
35 non-standard location).]), [
36 if test "$enable_perfmon" != "no"; then
37 dnl Add perfmon define and library
38 CPPFLAGS="$CPPFLAGS -DPERFMON"
39 LIBS="$LIBS -lpfm"
40 dnl Handle custom install dir (if needed)
41 if test "$enable_perfmon" != "yes"; then
42 CPPFLAGS="$CPPFLAGS -I$enable_perfmon/include"
43 LDFLAGS="$LDFLAGS -L$enable_perfmon/lib"
44 fi
45 AC_CHECK_LIB([pfm], [pfm_start], [], [
46 AC_MSG_ERROR([systemtap cannot find required perfmon libs (libpfm-devel may need to be installed])])
47 fi])
48
49 dnl Handle the prologues option.
50 dnl
51 dnl If the user didn't specify --enable-prologues/--disable-prologues
52 dnl and the x86 system has a version of gcc less than version 4,
53 dnl automatically enable prologues.
54 if test "${enable_prologues+set}" != set; then
55 AC_MSG_CHECKING([to see if prologue searching should be the default])
56 if { echo '#if __i386__ == 1 && __GNUC__ < 4'
57 echo ' yes '
58 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
59 enable_prologues=yes
60 AC_MSG_RESULT([yes])
61 else
62 AC_MSG_RESULT([no])
63 fi
64 fi
65 AC_ARG_ENABLE([prologues],
66 AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]),
67 [
68 if test "$enable_prologues" = yes; then
69 AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default])
70 fi])
71
72 AC_ARG_ENABLE([ssp],
73 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
74 AS_IF([test "x$enable_ssp" != xno],[
75 save_CFLAGS="$CFLAGS"
76 save_CXXFLAGS="$CXXFLAGS"
77 CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
78 CFLAGS="$CFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
79 AC_COMPILE_IFELSE([int something ();], [
80 AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.])
81 CFLAGS="$save_CFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"
82 CXFXLAGS="$save_CXXFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"],[
83 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
84 CFLAGS="$save_CFLAGS"
85 CXXFLAGS="$save_CXXFLAGS"])])
86
87 # Compiling without fPIE by default (see PR 9922)
88 AC_ARG_ENABLE([pie],
89 [AS_HELP_STRING([--enable-pie], [enable position-independent-executable])])
90 AS_IF([test "x$enable_pie" == xyes],[
91 save_CFLAGS="$CFLAGS"
92 save_CXXFLAGS="$CXXFLAGS"
93 save_LDFLAGS="$LDFLAGS"
94 CFLAGS="$CFLAGS -fPIE"
95 CXXFLAGS="$CXXFLAGS -fPIE"
96 LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now"
97 AC_LINK_IFELSE([void main () {}], [
98 AC_MSG_NOTICE([Compiling with gcc pie et al.])
99 # LDFLAGS is special since it may be passed down to bundled-elfutils,
100 # and interfere with the .so's built therein
101 PIELDFLAGS="$LDFLAGS"
102 LDFLAGS="$save_LDFLAGS"
103 PIECFLAGS="$CFLAGS"
104 CFLAGS="$save_CFLAGS"
105 PIECXXFLAGS="$CXXFLAGS"
106 CXXFLAGS="$save_CXXFLAGS"
107 ],[
108 AC_MSG_NOTICE([Compiler does not support -pie et al.])
109 PIECFLAGS=""
110 CFLAGS="$save_CFLAGS"
111 PIECXXFLAGS=""
112 CXXFLAGS="$save_CXXFLAGS"
113 PIELDFLAGS=""
114 LDFLAGS="$save_LDFLAGS"])])
115 AC_SUBST(PIELDFLAGS)
116 AC_SUBST(PIECFLAGS)
117 AC_SUBST(PIECXXFLAGS)
118
119 dnl Handle optional sqlite support. If enabled/disabled by the user,
120 dnl do the right thing. If not specified by the user, use it if
121 dnl present.
122 AC_ARG_ENABLE([sqlite],
123 AS_HELP_STRING([--enable-sqlite], [build with sqlite support]),
124 [], dnl ACTION-IF-GIVEN
125 [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN
126 sqlite3_LIBS=
127 AS_IF([test "x$enable_sqlite" != xno],
128 [AC_CHECK_LIB([sqlite3], [sqlite3_open],
129 [AC_SUBST([sqlite3_LIBS], [-lsqlite3])
130 AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the `sqlite3' library (-lsqlite3).])],
131 [if test "x$enable_sqlite" != xcheck; then
132 AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite failed])
133 fi])])
134
135 dnl Handle the option to only build runtime
136 AC_ARG_ENABLE([translator],
137 AS_HELP_STRING([--disable-translator], [build only runtime utilities]),
138 [],
139 [enable_translator="yes"])
140 AM_CONDITIONAL([BUILD_TRANSLATOR], [test "$enable_translator" == "yes"])
141
142 dnl Handle the option to build the crash extension
143 AC_ARG_ENABLE([crash],
144 AS_HELP_STRING([--enable-crash@<:@=DIRECTORY@:>@],
145 [enable crash extension (default is disabled). Optional DIRECTORY
146 is the path to the crash header file (needed if installed in a
147 non-standard location).]),
148 [if test "$enable_crash" != "no"; then
149 dnl Handle custom install dir (if needed)
150 save_CPPFLAGS="$CPPFLAGS"
151 if test "$enable_crash" != "yes"; then
152 staplog_CPPFLAGS=-I$enable_crash
153 CPPFLAGS="${staplog_CPPFLAGS} $CPPFLAGS"
154 AC_SUBST([staplog_CPPFLAGS])
155 fi
156 AC_CHECK_HEADERS([crash/defs.h], [],
157 [AC_MSG_ERROR([cannot find required crash header (crash-devel may need to be installed)])],
158 [
159 #define NR_CPUS 256
160 ])
161 CPPFLAGS="$save_CPPFLAGS"
162 fi],
163 [enable_crash="no"])
164 AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"])
165
166 dnl Handle the option to build the documentation
167 building_docs="no"
168 AC_ARG_ENABLE([docs],
169 AS_HELP_STRING([--enable-docs],
170 [enable building documentation (default on if latex etc. found).]),
171 [enable_docs=$enableval],
172 [enable_docs="check"])
173 AC_CHECK_PROG(have_latex, latex, yes, no)
174 AC_CHECK_PROG(have_dvips, dvips, yes, no)
175 AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no)
176 AC_CHECK_PROG(have_latex2html, latex2html, yes, no)
177 if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" != "xyesyesyesyes"; then
178 if test "$enable_docs" == "yes"; then
179 AC_MSG_ERROR([cannot find all tools for building documentation])
180 fi
181 if test "$enable_docs" == "check"; then
182 AC_MSG_WARN([will not build documentation, cannot find all tools])
183 fi
184 fi
185 if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"; then
186 building_docs="yes"
187 fi
188 AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" == "yes"])
189
190 dnl Handle the option to build the reference documentation
191 building_refdocs="no"
192 AC_ARG_ENABLE([refdocs],
193 AS_HELP_STRING([--enable-refdocs],
194 [enable building reference documentation (default on if xmlto etc. found and other documentation built).]),
195 [enable_refdocs=$enableval],
196 [enable_refdocs="check"])
197 if test "$building_docs" == "no" -a "$enable_refdocs" == "yes" ; then
198 AC_MSG_ERROR([must use --enable-docs with --enable-refdocs])
199 fi
200 AC_CHECK_PROG(have_xmlto, xmlto, yes, no)
201 if test "$enable_refdocs" == "yes"; then
202 if test "x${have_xmlto}" != "xyes"; then
203 AC_MSG_ERROR([cannot find xmlto for building reference documentation])
204 fi
205 fi
206 if test "x${have_xmlto}" == "xyes" -a "$enable_refdocs" != "no" -a "${building_docs}" == "yes"; then
207 building_refdocs="yes"
208 fi
209 AM_CONDITIONAL([BUILD_REFDOCS], [test "$building_refdocs" == "yes"])
210
211 cat > conftest.xml << 'EOF'
212 <?xml version="1.0" encoding="UTF-8"?>
213 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
214 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
215 <book lang="en">
216 <bookinfo><title>foo</title></bookinfo>
217 <chapter><title>bar</title><para>baz</para></chapter>
218 </book>
219 EOF
220
221 if test "x${have_xmlto}" == "xyes"; then
222 AC_MSG_CHECKING([for xmlto --stringparam support])
223 xmlto --stringparam man.authors.section.enabled=0 txt conftest.xml >/dev/null 2>&1
224 if test $? == 0; then
225 have_xmlto_stringparam="yes"
226 AC_MSG_RESULT([yes])
227 else
228 AC_MSG_RESULT([no])
229 fi
230 rm -f conftest.txt
231 fi
232 AM_CONDITIONAL([XMLTO_STRINGPARAM], [test "$have_xmlto_stringparam" == "yes"])
233
234 if test "x${building_refdocs}" == "xyes"; then
235 AC_MSG_CHECKING([for xmlto pdf support])
236 xmlto pdf conftest.xml >& /dev/null
237 if test $? == 0; then
238 have_xmlto_pdf="yes"
239 AC_MSG_RESULT([yes])
240 else
241 AC_MSG_RESULT([no])
242 AC_MSG_WARN([Not building reference documentation in PDF format])
243 fi
244 rm -f conftest.pdf
245 fi
246 dnl Unfortunately https://bugzilla.redhat.com/show_bug.cgi?id=526273
247 dnl blocks "xmlto pdf" on our docs (but not on the above test).
248 dnl So we need to disable this anyway.
249 dnl AM_CONDITIONAL([BUILD_PDFREFDOCS], [test "$have_xmlto_pdf" == "yes"])
250 AM_CONDITIONAL([BUILD_PDFREFDOCS], [test "maybe later" == "yes"])
251
252 rm -f conftest.xml
253
254
255 dnl Handle the option to build the server setup.
256 AC_ARG_ENABLE([server],
257 AS_HELP_STRING([--enable-server],
258 [enable building of stap-server/client (default on if nss etc. found).]),
259 [enable_server=$enableval],
260 [enable_server="check"])
261 dnl Find the location of nss and nspr headers and certutil
262 AC_CHECK_PROG(have_certutil, certutil, [yes], [no])
263 AC_CHECK_FILE([/usr/include/nss3], nssdir=nss3, [
264 AC_CHECK_FILE([/usr/include/nss], nssdir=nss)
265 ])
266 AC_CHECK_FILE([/usr/include/nspr4], nsprdir=nspr4, [
267 AC_CHECK_FILE([/usr/include/nspr], nsprdir=nspr)
268 ])
269 if test "x$nssdir" != "x" -a "x$nsprdir" != "x"; then
270 nss_CFLAGS="-I/usr/include/$nssdir"
271 nspr_CFLAGS="-I/usr/include/$nsprdir"
272 AC_SUBST(nss_CFLAGS)
273 AC_SUBST(nspr_CFLAGS)
274 save_CPPFLAGS="$CPPFLAGS"
275 CPPFLAGS="$CFLAGS $nss_CFLAGS $nspr_CFLAGS"
276 have_nss_includes=yes
277 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)
278 CPPFLAGS="$save_CPPFLAGS"
279 have_nss_libs=no
280 AC_CHECK_LIB(nspr4, PR_Connect, [
281 AC_CHECK_LIB(ssl3, SSL_ReHandshake, have_nss_libs=yes)
282 ])
283 fi
284 if test "x${have_nss_includes}${have_nss_libs}${have_certutil}" != "xyesyesyes"; then
285 if test "$enable_server" == "yes"; then
286 AC_MSG_ERROR([cannot find all libraries or tools for stap-server])
287 fi
288 if test "$enable_server" == "check"; then
289 AC_MSG_WARN([will not build stap-server, cannot find all libraries or tools])
290 fi
291 else
292 AC_DEFINE([HAVE_NSS], [1], [Define to 1 if you have the nss libraries.])
293 fi
294 AM_CONDITIONAL([BUILD_SERVER], [test "x${have_nss_includes}${have_nss_libs}${have_certutil}" == "xyesyesyes" -a "$enable_server" != "no"])
295 AM_CONDITIONAL([HAVE_NSS], [test "x${have_nss_includes}${have_nss_libs}${have_certutil}" == "xyesyesyes"])
296
297 dnl Handle the optional grapher
298 AC_ARG_ENABLE([grapher],
299 AS_HELP_STRING([--enable-grapher],
300 [enable building of grapher (default on if needed requirements are found).]),
301 [], dnl ACTION-IF-GIVEN
302 [enable_grapher="check"]) dnl ACTION-IF-NOT-GIVEN
303 dnl If the user didn't disable the grapher, check the grapher's requirements.
304 AS_IF([test "x$enable_grapher" != xno],
305 [
306 dnl Check for gtkmm. Strictly speaking, this isn't necessary,
307 dnl since the libglademm24-devel rpm requires the gtkmm24-devel
308 dnl rpm. But, this could be a non-rpm system. This check will
309 dnl give the user a better idea about how to fix missing
310 dnl requirements.
311 PKG_CHECK_MODULES([gtkmm], [gtkmm-2.4 >= 2.8.0],
312 have_gtkmm="yes", have_gtkmm="no")
313 AS_IF([test "x${have_gtkmm}" == "xno" -a x"$enable_grapher" == "xyes"],
314 AC_MSG_WARN([systemtap cannot find required gtkmm libs (gtkmm24-devel version 2.8.0 or higher may need to be installed)]))
315
316 dnl Check for libglade
317 PKG_CHECK_MODULES([libglade], [libglademm-2.4 >= 2.6.7],
318 have_libglade="yes", have_libglade="no")
319 AS_IF([test "x${have_libglade}" == "xno" -a x"$enable_grapher" == "xyes"],
320 AC_MSG_WARN([systemtap cannot find required libglade libs (libglademm24-devel version 2.6.7 or higher may need to be installed)]))
321
322 dnl Check for needed boost headers
323 have_boost_headers="yes"
324 AC_LANG_PUSH(C++)
325 AC_CHECK_HEADERS([boost/algorithm/string.hpp boost/range.hpp],
326 [], have_boost_headers="no")
327 AC_LANG_POP(C++)
328 AS_IF([test "x${have_boost_headers}" == "xno" -a x"$enable_grapher" == "xyes"],
329 AC_MSG_WARN([cannot find required boost headers (boost-devel may need to be installed)]))
330
331 dnl Bundle up all the grapher requirements into 1 variable.
332 AS_IF([test "x${have_gtkmm}${have_libglade}${have_boost_headers}" == "xyesyesyes"],
333 have_grapher_reqs="yes", have_grapher_reqs="no")
334 ])
335 dnl If the user explicitly said to enable the grapher, but we can't
336 dnl (since one or more of its requirements aren't installed), error.
337 AS_IF([test "x${have_grapher_reqs}" == "xno" -a x"$enable_grapher" == "xyes"],
338 AC_MSG_ERROR([systemtap cannot find grapher build requirements (gtkmm, libglade, and boost headers)]))
339 dnl If the user didn't say to disable the grapher, and all the
340 dnl requirements are installed, enable the grapher.
341 AM_CONDITIONAL([BUILD_GRAPHER], [test "x${have_grapher_reqs}" == "xyes" -a x"$enable_grapher" != "xno"])
342
343
344 # Integration with rpm library to support missing debuginfo suggestions.
345 # --without-rpm: Disable any rpm support.
346 # --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
347 # Even with runtime missing `libname.so' GDB will still other run correctly.
348 # Missing `libname.so' during ./configure will abort the configuration.
349 # --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
350 # minor version first such as `librpm-4.6.so' as minor version differences
351 # mean API+ABI incompatibility. If the specific match versioned library name
352 # could not be found still open dynamically at least `librpm.so'.
353 # --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
354 # to find librpm for compilation-time linking by pkg-config. GDB binary will
355 # be probably linked with the version specific library (as `librpm-4.6.so').
356 # Failure to find librpm by pkg-config will abort the configuration.
357 # (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
358 # cannot find librpm use to the rpmless compilation (like `--without-rpm').
359
360 AC_ARG_WITH([rpm],
361 [AS_HELP_STRING([--with-rpm],
362 [query rpm database for missing debuginfos @<:@yes/no, def. auto=librpm.so@:>@])], [], [with_rpm="auto"])
363
364 m4_pattern_allow([^AC_MSG_ERROR$])
365 m4_pattern_allow([^AC_MSG_WARN$])
366 if test "x$with_rpm" != "xno"; then
367 if test "x$with_rpm" = "xyes"; then
368 LIBRPM="librpm.so"
369 RPM_REQUIRE=true
370 DLOPEN_REQUIRE=false
371 elif test "x$with_rpm" = "xauto"; then
372 LIBRPM="librpm.so"
373 RPM_REQUIRE=false
374 DLOPEN_REQUIRE=false
375 else
376 LIBRPM="$with_rpm"
377 RPM_REQUIRE=true
378 DLOPEN_REQUIRE=true
379 fi
380 LIBRPM_STRING='"'"$LIBRPM"'"'
381
382 AC_MSG_CHECKING([specific librpm version])
383 HAVE_DLOPEN_LIBRPM=false
384 save_LIBS="$LIBS"
385 LIBS="$LIBS -ldl"
386 AC_RUN_IFELSE(AC_LANG_PROGRAM([[
387 #include <rpm/rpmlib.h>
388 #include <dlfcn.h>
389 #include <errno.h>
390 ]], [[
391 void *h;
392 const char *const *rpmverp;
393 FILE *f;
394
395 f = fopen ("conftest.out", "w");
396 if (!f)
397 {
398 fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
399 strerror (errno));
400 return 1;
401 }
402 h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
403 if (!h)
404 {
405 fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
406 return 1;
407 }
408 rpmverp = dlsym (h, "RPMVERSION");
409 if (!rpmverp)
410 {
411 fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
412 return 1;
413 }
414 fprintf (stderr, "RPMVERSION is: \"");
415 fprintf (stderr, "%s\"\n", *rpmverp);
416
417 /* Try to find the specific librpm version only for "librpm.so" as we do
418 not know how to assemble the version string otherwise. */
419
420 if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
421 {
422 fprintf (f, "%s\n", $LIBRPM_STRING);
423 return 0;
424 }
425 else
426 {
427 char *h2_name;
428 void *h2;
429 int major, minor;
430
431 if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
432 {
433 fprintf (stderr, "Unable to parse RPMVERSION.\n");
434 fprintf (f, "%s\n", $LIBRPM_STRING);
435 return 0;
436 }
437 /* Avoid the square brackets by malloc. */
438 h2_name = malloc (64);
439 sprintf (h2_name, "librpm-%d.%d.so", major, minor);
440 h2 = dlopen (h2_name, RTLD_LAZY);
441 if (!h2)
442 {
443 fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
444 fprintf (f, "%s\n", $LIBRPM_STRING);
445 return 0;
446 }
447 if (h2 != h)
448 {
449 fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
450 $LIBRPM_STRING, h2_name);
451 fprintf (f, "%s\n", $LIBRPM_STRING);
452 return 0;
453 }
454 /* Found the valid .so name with a specific version. */
455 fprintf (f, "%s\n", h2_name);
456 return 0;
457 }
458 ]]), [
459 DLOPEN_LIBRPM="`cat conftest.out`"
460 if test "x$DLOPEN_LIBRPM" != "x"; then
461 HAVE_DLOPEN_LIBRPM=true
462 AC_MSG_RESULT($DLOPEN_LIBRPM)
463 fi
464 ])
465 rm -f conftest.out
466
467 m4_define([CHECK_LIBRPM_COMPAT], [
468 AC_MSG_CHECKING([rpm library API compatibility])
469 # The compilation requires -Werror to verify anything.
470 save_CFLAGS="$CFLAGS"
471 CFLAGS="$CFLAGS -Werror"
472 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
473 /* Duplicate here the declarations to verify they match "symfile.c". */
474 #include <rpm/rpmlib.h>
475 #include <rpm/rpmts.h>
476 #include <rpm/rpmdb.h>
477 #include <rpm/header.h>
478 extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
479 extern int rpmReadConfigFiles(const char * file, const char * target);
480 extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
481 extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
482 extern rpmts rpmtsCreate(void);
483 extern rpmts rpmtsFree(rpmts ts);
484 extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
485 const void * keyp, size_t keylen);
486 ]]), [
487 LIBRPM_COMPAT=true
488 rpm_LIBS=-lrpm
489 AC_MSG_RESULT(yes)
490 ], [
491 LIBRPM_COMPAT=false
492 rpm_LIBS=
493 AC_MSG_RESULT(no)
494 ])
495 CFLAGS="$save_CFLAGS"
496 ])
497 AC_SUBST(rpm_LIBS)
498
499 if $HAVE_DLOPEN_LIBRPM; then
500 CHECK_LIBRPM_COMPAT
501 if ! $LIBRPM_COMPAT; then
502 HAVE_DLOPEN_LIBRPM=false
503 fi
504 fi
505
506 if $HAVE_DLOPEN_LIBRPM; then
507 DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
508 AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
509 AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
510 else
511 AC_MSG_RESULT(no)
512 LIBS="$save_LIBS"
513 if $DLOPEN_REQUIRE; then
514 AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
515 fi
516 PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
517
518 if $HAVE_LIBRPM; then
519 CHECK_LIBRPM_COMPAT
520 if ! $LIBRPM_COMPAT; then
521 HAVE_LIBRPM=false
522 RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
523 fi
524 fi
525
526 if $HAVE_LIBRPM; then
527 AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
528 CFLAGS="$CFLAGS $RPM_CFLAGS"
529 LIBS="$LIBS $RPM_LIBS"
530 else
531 if $RPM_REQUIRE; then
532 AC_MSG_ERROR($RPM_PKG_ERRORS)
533 else
534 AC_MSG_WARN($RPM_PKG_ERRORS)
535 fi
536 fi
537 fi
538 fi
539
540
541 dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
542 dnl the system's elfutils.
543 build_elfutils=no
544 AC_ARG_WITH([elfutils],
545 AS_HELP_STRING([--with-elfutils=DIRECTORY],
546 [find elfutils source code in DIRECTORY]),
547 [
548 case "$with_elfutils" in
549 yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
550 ''|no) ;;
551 *) build_elfutils=yes ;;
552 esac])
553 AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
554 AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
555 [cd $with_elfutils && pwd])`)
556
557 if test $build_elfutils = no; then
558 # Need libdwfl-capable recent elfutils http://elfutils.fedorahosted.org/
559 save_LIBS="$LIBS"
560 AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
561 AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])],
562 [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
563 AC_CHECK_LIB(dw, dwarf_getelf,[],[
564 AC_MSG_ERROR([elfutils, libdw too old, need 0.126+])],
565 [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
566 stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
567 LIBS="$save_LIBS"
568 else
569 # We built our own and stap_LDFLAGS points at the install.
570 stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
571 fi
572
573 AC_SUBST(stap_LIBS)
574 AC_MSG_NOTICE([stap will link $stap_LIBS])
575
576 dnl Plop in the build (configure) date
577 date=`date +%Y-%m-%d`
578 AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
579 AC_SUBST(DATE, "$date")
580
581 # Before PR4037, we used to arrange to pass CFLAGS+=-m64 for a staprun
582 # being compiled on 32-bit userspace but running against 64-bit kernels.
583 # This is no longer necessary.
584
585 # Use tr1/unordered_map if available
586 AC_LANG_PUSH(C++)
587 AC_CHECK_HEADERS([tr1/unordered_map])
588 AC_CHECK_HEADERS([tr1/memory])
589 AC_CHECK_HEADERS([boost/shared_ptr.hpp])
590 AC_LANG_POP(C++)
591
592
593 if test $build_elfutils = yes; then
594 case "$with_elfutils" in
595 /*) elfutils_srcdir="$with_elfutils" ;;
596 *) elfutils_srcdir="../$with_elfutils" ;;
597 esac
598 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
599
600 save_CFLAGS="$CFLAGS"
601 save_CXXFLAGS="$CXXFLAGS"
602 CXXFLAGS="$CXXFLAGS -fgnu89-inline"
603 CFLAGS="$CFLAGS -fgnu89-inline"
604 gnu89_inline_flag=""
605 AC_COMPILE_IFELSE([int something ();], [
606 AC_MSG_NOTICE([Compiling elfutils with gcc -fgnu89-inline])
607 gnu89_inline_flag="-fgnu89-inline"],[
608 AC_MSG_NOTICE([Compiler does not support -fgnu89-inline])])
609 CFLAGS="$save_CFLAGS"
610 CXXFLAGS="$save_CXXFLAGS"
611
612 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
613 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
614 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
615 # So we must make sure to pass those settings to elfutils configure.
616 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
617 here=`pwd`
618 (mkdir -p build-elfutils && cd build-elfutils &&
619 bash ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
620 --includedir="${here}/include-elfutils" \
621 --libdir="${here}/lib-elfutils" \
622 --exec-prefix="$exec_prefix" \
623 --prefix="$prefix" \
624 CFLAGS="${CFLAGS/-Wall/} $gnu89_inline_flag" \
625 LDFLAGS="$LDFLAGS $elfutils_rpath" &&
626 if test -f ${elfutils_srcdir}/config/version.h.in; then
627 echo Trying to install elfutils version header...
628 make install-pkgincludeHEADERS
629 fi
630 # so that elfutils/version.h - available from 0.138 - may be found.
631 # Don't use install-data because that will fail (installing in $prefix).
632 )
633 if test $? != 0; then exit; fi
634 save_CPPFLAGS=${CPPFLAGS}
635 CPPFLAGS="${CPPFLAGS} -Iinclude-elfutils" # in case bundled elfutils
636 AC_CHECK_HEADERS([elfutils/version.h])
637 CPPFLAGS="$save_CPPFLAGS"
638 else
639 AC_CHECK_HEADERS([elfutils/version.h])
640 fi
641
642 dnl This is here mainly to make sure that configure --prefix=... changes
643 dnl the config.h files so files depending on it are recompiled
644 dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS.
645 dnl Don't use this directly (when not given it is set to NONE).
646 AC_DEFINE_UNQUOTED(STAP_PREFIX, "$prefix", [configure prefix location])
647
648 AC_CONFIG_HEADERS([config.h:config.in])
649 AC_CONFIG_FILES(Makefile doc/Makefile doc/SystemTap_Tapset_Reference/Makefile grapher/Makefile grapher/stapgraph.1 stap.1 stapprobes.3stap stapfuncs.3stap stapvars.3stap stapex.3stap staprun.8 stap-client.8 stap-server.8 stap-authorize-server-cert.8 stap-authorize-signing-cert.8 man/stapprobes.iosched.3stap man/stapprobes.irq.3stap man/stapprobes.netdev.3stap man/stapprobes.nfs.3stap man/stapprobes.nfsd.3stap man/stapprobes.pagefault.3stap man/stapprobes.kprocess.3stap man/stapprobes.rpc.3stap man/stapprobes.scsi.3stap man/stapprobes.signal.3stap man/stapprobes.socket.3stap man/stapprobes.tcp.3stap man/stapprobes.udp.3stap man/stapprobes.snmp.3stap initscript/systemtap initscript/stap-server)
650 AC_CONFIG_SUBDIRS(testsuite)
651 if test $enable_translator == "yes"; then
652 AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
653 fi
654 AC_CONFIG_FILES([run-staprun], [chmod +x run-staprun])
655 AC_CONFIG_FILES([dtrace], [chmod +x dtrace])
656 AC_OUTPUT
657
658 if test "${prefix}" = "/usr/local"; then
659 AC_MSG_NOTICE([])
660 AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend])
661 AC_MSG_NOTICE([configuring with a prefix. For example, try])
662 AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$])
663 AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,])
664 AC_MSG_NOTICE([is not supported.])
665 fi
This page took 0.06186 seconds and 6 git commands to generate.