]> sourceware.org Git - systemtap.git/blob - configure.ac
Use install-pkgincludeHEADERS for elfutils configure build step.
[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], 0.8, 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 AM_PROG_MKDIR_P
12 AC_PROG_LN_S
13 AC_PROG_CC
14 AC_PROG_CXX
15 AC_PROG_CPP
16 AM_PROG_CC_STDC
17 AM_PROG_CC_C_O
18 AM_C_PROTOTYPES
19 AC_PROG_RANLIB
20 AC_OBJEXT
21 AC_EXEEXT
22 AC_PROG_INSTALL
23 AC_PROG_MAKE_SET
24 AC_SUBST(CFLAGS)
25 AC_SUBST(CXXFLAGS)
26
27 dnl Handle the perfmon option.
28 AC_ARG_ENABLE([perfmon],
29 AS_HELP_STRING([--enable-perfmon@<:@=DIRECTORY@:>@],
30 [enable perfmon support (default is disabled). Optional DIRECTORY
31 is the path to the perfmon installation (needed if installed in a
32 non-standard location).]), [
33 if test "$enable_perfmon" != "no"; then
34 dnl Add perfmon define and library
35 CPPFLAGS="$CPPFLAGS -DPERFMON"
36 LIBS="$LIBS -lpfm"
37 dnl Handle custom install dir (if needed)
38 if test "$enable_perfmon" != "yes"; then
39 CPPFLAGS="$CPPFLAGS -I$enable_perfmon/include"
40 LDFLAGS="$LDFLAGS -L$enable_perfmon/lib"
41 fi
42 AC_CHECK_LIB([pfm], [pfm_start], [], [
43 AC_MSG_ERROR([systemtap cannot find required perfmon libs (libpfm-devel may need to be installed])])
44 fi])
45
46 dnl Handle the prologues option.
47 dnl
48 dnl If the user didn't specify --enable-prologues/--disable-prologues
49 dnl and the x86 system has a version of gcc less than version 4,
50 dnl automatically enable prologues.
51 if test "${enable_prologues+set}" != set; then
52 AC_MSG_CHECKING([to see if prologue searching should be the default])
53 if { echo '#if __i386__ == 1 && __GNUC__ < 4'
54 echo ' yes '
55 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
56 enable_prologues=yes
57 AC_MSG_RESULT([yes])
58 else
59 AC_MSG_RESULT([no])
60 fi
61 fi
62 AC_ARG_ENABLE([prologues],
63 AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]),
64 [
65 if test "$enable_prologues" = yes; then
66 AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default])
67 fi])
68
69 AC_ARG_ENABLE([ssp],
70 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
71 AS_IF([test "x$enable_ssp" != xno],[
72 save_CFLAGS="$CFLAGS"
73 save_CXXFLAGS="$CXXFLAGS"
74 CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
75 CFLAGS="$CFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
76 AC_COMPILE_IFELSE([int something ();], [
77 AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.])
78 CFLAGS="$save_CFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"
79 CXFXLAGS="$save_CXXFLAGS -fstack-protector-all -D_FORTIFY_SOURCE=2"],[
80 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
81 CFLAGS="$save_CFLAGS"
82 CXXFLAGS="$save_CXXFLAGS"])])
83
84 AC_ARG_ENABLE([pie],
85 [AS_HELP_STRING([--disable-pie], [disable position-independent-executable])])
86 AS_IF([test "x$enable_pie" != xno],[
87 save_CFLAGS="$CFLAGS"
88 save_CXXFLAGS="$CXXFLAGS"
89 save_LDFLAGS="$LDFLAGS"
90 CFLAGS="$CFLAGS -fPIE"
91 CXXFLAGS="$CXXFLAGS -fPIE"
92 LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now"
93 AC_LINK_IFELSE([void main () {}], [
94 AC_MSG_NOTICE([Compiling with gcc pie et al.])
95 # LDFLAGS is special since it may be passed down to bundled-elfutils,
96 # and interfere with the .so's built therein
97 PIELDFLAGS="$LDFLAGS"
98 LDFLAGS="$save_LDFLAGS"
99 PIECFLAGS="$CFLAGS"
100 CFLAGS="$save_CFLAGS"
101 PIECXXFLAGS="$CXXFLAGS"
102 CXXFLAGS="$save_CXXFLAGS"
103 ],[
104 AC_MSG_NOTICE([Compiler does not support -pie et al.])
105 PIECFLAGS=""
106 CFLAGS="$save_CFLAGS"
107 PIECXXFLAGS=""
108 CXXFLAGS="$save_CXXFLAGS"
109 PIELDFLAGS=""
110 LDFLAGS="$save_LDFLAGS"])])
111 AC_SUBST(PIELDFLAGS)
112 AC_SUBST(PIECFLAGS)
113 AC_SUBST(PIECXXFLAGS)
114
115 dnl Handle optional sqlite support. If enabled/disabled by the user,
116 dnl do the right thing. If not specified by the user, use it if
117 dnl present.
118 AC_ARG_ENABLE([sqlite],
119 AS_HELP_STRING([--enable-sqlite], [build with sqlite support]),
120 [], dnl ACTION-IF-GIVEN
121 [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN
122 sqlite3_LIBS=
123 AS_IF([test "x$enable_sqlite" != xno],
124 [AC_CHECK_LIB([sqlite3], [sqlite3_open],
125 [AC_SUBST([sqlite3_LIBS], [-lsqlite3])
126 AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the `sqlite3' library (-lsqlite3).])],
127 [if test "x$enable_sqlite" != xcheck; then
128 AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite failed])
129 fi])])
130
131 dnl Handle the option to build the crash extension
132 AC_ARG_ENABLE([crash],
133 AS_HELP_STRING([--enable-crash@<:@=DIRECTORY@:>@],
134 [enable crash extension (default is disabled). Optional DIRECTORY
135 is the path to the crash header file (needed if installed in a
136 non-standard location).]),
137 [if test "$enable_crash" != "no"; then
138 dnl Handle custom install dir (if needed)
139 save_CPPFLAGS="$CPPFLAGS"
140 if test "$enable_crash" != "yes"; then
141 staplog_CPPFLAGS=-I$enable_crash
142 CPPFLAGS="${staplog_CPPFLAGS} $CPPFLAGS"
143 AC_SUBST([staplog_CPPFLAGS])
144 fi
145 AC_CHECK_HEADERS([crash/defs.h], [],
146 [AC_MSG_ERROR([cannot find required crash header (crash-devel may need to be installed)])],
147 [
148 #define NR_CPUS 256
149 ])
150 CPPFLAGS="$save_CPPFLAGS"
151 fi],
152 [enable_crash="no"])
153 AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"])
154
155 dnl Handle the option to build the documentation
156 building_docs="no"
157 AC_ARG_ENABLE([docs],
158 AS_HELP_STRING([--enable-docs],
159 [enable building documentation (default on if latex etc. found).]),
160 [enable_docs=$enableval],
161 [enable_docs="check"])
162 AC_CHECK_PROG(have_latex, latex, yes, no)
163 AC_CHECK_PROG(have_dvips, dvips, yes, no)
164 AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no)
165 AC_CHECK_PROG(have_latex2html, latex2html, yes, no)
166 if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" != "xyesyesyesyes"; then
167 if test "$enable_docs" == "yes"; then
168 AC_MSG_ERROR([cannot find all tools for building documentation])
169 fi
170 if test "$enable_docs" == "check"; then
171 AC_MSG_WARN([will not build documentation, cannot find all tools])
172 fi
173 fi
174 if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"; then
175 building_docs="yes"
176 fi
177 AM_CONDITIONAL([BUILD_DOCS], [test "$building_docs" == "yes"])
178
179 dnl Handle the option to build the reference documentation
180 building_refdocs="no"
181 AC_ARG_ENABLE([refdocs],
182 AS_HELP_STRING([--enable-refdocs],
183 [enable building reference documentation (default on if xmlto etc. found and other documentation built).]),
184 [enable_refdocs=$enableval],
185 [enable_refdocs="check"])
186 if test "$building_docs" == "no" -a "$enable_refdocs" == "yes" ; then
187 AC_MSG_ERROR([must use --enable-docs with --enable-refdocs])
188 fi
189 AC_CHECK_PROG(have_xmlto, xmlto, yes, no)
190 if test "x${have_xmlto}" == "xyes"; then
191 AC_MSG_CHECKING([for xmlto pdf support])
192 cat > conftest.$ac_ext << EOF
193 <?xml version="1.0" encoding="UTF-8"?>
194 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
195 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
196 <book id="pdffromxml">
197 </book>
198 EOF
199 xmlto pdf conftest.$ac_ext >& /dev/null
200 if test $? == 0; then
201 have_xmlto_pdf="yes"
202 AC_MSG_RESULT([yes])
203 else
204 AC_MSG_RESULT([no])
205 fi
206 fi
207 if test "$enable_refdocs" == "yes"; then
208 if test "x${have_xmlto}${have_xmlto_pdf}" != "xyesyes"; then
209 AC_MSG_ERROR([cannot find proper yxmlto for building reference documentation])
210 fi
211 fi
212 if test "x${have_xmlto}${have_xmlto_pdf}" == "xyesyes" -a "$enable_refdocs" != "no" -a "${building_docs}" == "yes"; then
213 building_refdocs="yes"
214 fi
215 AM_CONDITIONAL([BUILD_REFDOCS], [test "$building_refdocs" == "yes"])
216
217 dnl Handle the option to build the server setup.
218 AC_ARG_ENABLE([server],
219 AS_HELP_STRING([--enable-server],
220 [enable building of stap-server/client (default on if nss etc. found).]),
221 [enable_server=$enableval],
222 [enable_server="check"])
223 PKG_CHECK_MODULES([nss],[nss >= 3], have_nss=yes, have_nss=no)
224 PKG_CHECK_MODULES([nspr],[nspr >= 4], have_nspr=yes, have_nspr=no)
225 if test "x${have_nss}${have_nspr}" != "xyesyes"; then
226 if test "$enable_server" == "yes"; then
227 AC_MSG_ERROR([cannot find all libraries for stap-server])
228 fi
229 if test "$enable_server" == "check"; then
230 AC_MSG_WARN([will not build stap-server, cannot find all libraries])
231 fi
232 fi
233 AM_CONDITIONAL([BUILD_SERVER], [test "x${have_nss}${have_nspr}" == "xyesyes" -a "$enable_server" != "no"])
234
235 dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
236 dnl the system's elfutils.
237 build_elfutils=no
238 AC_ARG_WITH([elfutils],
239 AS_HELP_STRING([--with-elfutils=DIRECTORY],
240 [find elfutils source code in DIRECTORY]),
241 [
242 case "$with_elfutils" in
243 yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
244 ''|no) ;;
245 *) build_elfutils=yes ;;
246 esac])
247 AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
248 AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
249 [cd $with_elfutils && pwd])`)
250
251 if test $build_elfutils = no; then
252 # Need libdwfl-capable recent elfutils http://elfutils.fedorahosted.org/
253 save_LIBS="$LIBS"
254 AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
255 AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])],
256 [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
257 AC_CHECK_LIB(dw, dwarf_getelf,[],[
258 AC_MSG_ERROR([elfutils, libdw too old, need 0.126+])],
259 [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
260 stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
261 LIBS="$save_LIBS"
262 else
263 # We built our own and stap_LDFLAGS points at the install.
264 stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
265 fi
266
267 AC_SUBST(stap_LIBS)
268 AC_MSG_NOTICE([stap will link $stap_LIBS])
269
270 dnl Plop in the build (configure) date
271 date=`date +%Y-%m-%d`
272 AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
273 AC_SUBST(DATE, "$date")
274
275
276 # This procflags business is for staprun/stapio, which need to
277 # be compiled with the same bitness as the kernel. On e.g. PPC,
278 # userspace might be 32-bit default, but staprun needs to be
279 # 64-bit. See also bug #4037.
280
281 processor=`uname -p`
282 case "$processor" in
283 ppc64) PROCFLAGS=-m64 ;;
284 x86_64) PROCFLAGS=-m64 ;;
285 *) PROCFLAGS=""
286 esac
287 AC_SUBST([PROCFLAGS])
288
289 # Use tr1/unordered_map if available
290 AC_LANG_PUSH(C++)
291 AC_CHECK_HEADERS([tr1/unordered_map])
292 AC_LANG_POP(C++)
293
294
295 if test $build_elfutils = yes; then
296 case "$with_elfutils" in
297 /*) elfutils_srcdir="$with_elfutils" ;;
298 *) elfutils_srcdir="../$with_elfutils" ;;
299 esac
300 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
301 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
302 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
303 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
304 # So we must make sure to pass those settings to elfutils configure.
305 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
306 here=`pwd`
307 (mkdir -p build-elfutils && cd build-elfutils &&
308 ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
309 --includedir="${here}/include-elfutils" \
310 --libdir="${here}/lib-elfutils" \
311 --exec-prefix="$exec_prefix" \
312 --prefix="$prefix" \
313 CFLAGS="${CFLAGS/-Wall/}" \
314 LDFLAGS="$LDFLAGS $elfutils_rpath" &&
315 make install-pkgincludeHEADERS
316 # so that elfutils/version.h - if any - may be found.
317 # Don't use install-data because that will fail (installing in $prefix).
318 )
319 if test $? != 0; then exit; fi
320 save_CPPFLAGS=${CPPFLAGS}
321 CPPFLAGS="${CPPFLAGS} -Iinclude-elfutils" # in case bundled elfutils
322 AC_CHECK_HEADERS([elfutils/version.h])
323 CPPFLAGS="$save_CPPFLAGS"
324 else
325 AC_CHECK_HEADERS([elfutils/version.h])
326 fi
327
328 dnl This is here mainly to make sure that configure --prefix=... changes
329 dnl the config.h files so files depending on it are recompiled
330 dnl prefix is passed through indirectly in the Makefile.am AM_CPPFLAGS.
331 dnl Don't use this directly (when not given it is set to NONE).
332 AC_DEFINE_UNQUOTED(STAP_PREFIX, "$prefix", [configure prefix location])
333
334 AC_CONFIG_HEADERS([config.h:config.in])
335 AC_CONFIG_FILES(Makefile doc/Makefile doc/SystemTap_Tapset_Reference/Makefile stap.1 stapprobes.5 stapfuncs.5 stapvars.5 stapex.5 staprun.8 stap-server.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5)
336 AC_CONFIG_SUBDIRS(testsuite)
337 AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
338 AC_OUTPUT
339
340 if test "${prefix}" = "/usr/local"; then
341 AC_MSG_NOTICE([])
342 AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend])
343 AC_MSG_NOTICE([configuring with a prefix. For example, try])
344 AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$])
345 AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,])
346 AC_MSG_NOTICE([is not supported.])
347 fi
This page took 0.051951 seconds and 6 git commands to generate.