]> sourceware.org Git - systemtap.git/blob - configure.ac
PR6925: generate script to run stap from build directory
[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 -pie -Wl,-z,relro -Wl,-z,now"
98 LDFLAGS="$save_LDFLAGS"
99 ],[
100 AC_MSG_NOTICE([Compiler does not support -pie et al.])
101 CFLAGS="$save_CFLAGS"
102 CXXFLAGS="$save_CXXFLAGS"
103 PIELDFLAGS=""
104 LDFLAGS="$save_LDFLAGS"])])
105 AC_SUBST(PIELDFLAGS)
106
107 dnl Handle optional sqlite support. If enabled/disabled by the user,
108 dnl do the right thing. If not specified by the user, use it if
109 dnl present.
110 AC_ARG_ENABLE([sqlite],
111 AS_HELP_STRING([--enable-sqlite], [build with sqlite support]),
112 [], dnl ACTION-IF-GIVEN
113 [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN
114 sqlite3_LIBS=
115 AS_IF([test "x$enable_sqlite" != xno],
116 [AC_CHECK_LIB([sqlite3], [sqlite3_open],
117 [AC_SUBST([sqlite3_LIBS], [-lsqlite3])
118 AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the `sqlite3' library (-lsqlite3).])],
119 [if test "x$enable_sqlite" != xcheck; then
120 AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite failed])
121 fi])])
122
123 dnl Handle the option to build the crash extension
124 AC_ARG_ENABLE([crash],
125 AS_HELP_STRING([--enable-crash@<:@=DIRECTORY@:>@],
126 [enable crash extension (default is disabled). Optional DIRECTORY
127 is the path to the crash header file (needed if installed in a
128 non-standard location).]),
129 [if test "$enable_crash" != "no"; then
130 dnl Handle custom install dir (if needed)
131 save_CPPFLAGS="$CPPFLAGS"
132 if test "$enable_crash" != "yes"; then
133 staplog_CPPFLAGS=-I$enable_crash
134 CPPFLAGS="${staplog_CPPFLAGS} $CPPFLAGS"
135 AC_SUBST([staplog_CPPFLAGS])
136 fi
137 AC_CHECK_HEADERS([crash/defs.h], [],
138 [AC_MSG_ERROR([cannot find required crash header (crash-devel may need to be installed)])],
139 [
140 #define NR_CPUS 256
141 ])
142 CPPFLAGS="$save_CPPFLAGS"
143 fi],
144 [enable_crash="no"])
145 AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"])
146
147 dnl Handle the option to build the documentation
148 AC_ARG_ENABLE([docs],
149 AS_HELP_STRING([--enable-docs],
150 [enable building documentation (default on if latex etc. found).]),
151 [enable_docs=$enableval],
152 [enable_docs="check"])
153 AC_CHECK_PROG(have_latex, latex, yes, no)
154 AC_CHECK_PROG(have_dvips, dvips, yes, no)
155 AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no)
156 AC_CHECK_PROG(have_latex2html, latex2html, yes, no)
157 if test "$enable_docs" == "yes"; then
158 if test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" != "xyesyesyesyes"; then
159 AC_MSG_ERROR([cannot find all tools for building documentation])
160 fi
161 fi
162 AM_CONDITIONAL([BUILD_DOCS], [test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"])
163
164 dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
165 dnl the system's elfutils.
166 build_elfutils=no
167 AC_ARG_WITH([elfutils],
168 AS_HELP_STRING([--with-elfutils=DIRECTORY],
169 [find elfutils source code in DIRECTORY]),
170 [
171 case "$with_elfutils" in
172 yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
173 ''|no) ;;
174 *) build_elfutils=yes ;;
175 esac])
176 AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
177 AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
178 [cd $with_elfutils && pwd])`)
179
180 if test $build_elfutils = no; then
181 # Need libdwfl-capable recent elfutils http://elfutils.fedorahosted.org/
182 save_LIBS="$LIBS"
183 AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
184 AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])],
185 [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
186 AC_CHECK_LIB(dw, dwarf_getelf,[],[
187 AC_MSG_ERROR([elfutils, libdw too old, need 0.126+])],
188 [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
189 stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
190 LIBS="$save_LIBS"
191 else
192 # We built our own and stap_LDFLAGS points at the install.
193 stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
194 fi
195
196 AC_SUBST(stap_LIBS)
197 AC_MSG_NOTICE([stap will link $stap_LIBS])
198
199 dnl Plop in the build (configure) date
200 date=`date +%Y-%m-%d`
201 AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
202 AC_SUBST(DATE, "$date")
203
204
205 # This procflags business is for staprun/stapio, which need to
206 # be compiled with the same bitness as the kernel. On e.g. PPC,
207 # userspace might be 32-bit default, but staprun needs to be
208 # 64-bit. See also bug #4037.
209
210 processor=`uname -p`
211 case "$processor" in
212 ppc64) PROCFLAGS=-m64 ;;
213 x86_64) PROCFLAGS=-m64 ;;
214 *) PROCFLAGS=""
215 esac
216 AC_SUBST([PROCFLAGS])
217
218 # Use tr1/unordered_map if available
219 AC_LANG_PUSH(C++)
220 AC_CHECK_HEADERS([tr1/unordered_map])
221 AC_LANG_POP(C++)
222
223 AC_CONFIG_HEADERS([config.h:config.in])
224 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)
225 AC_CONFIG_SUBDIRS(testsuite)
226
227 AC_CONFIG_FILES([run-stap], [chmod +x run-stap])
228
229 AC_OUTPUT
230
231 if test $build_elfutils = yes; then
232 case "$with_elfutils" in
233 /*) elfutils_srcdir="$with_elfutils" ;;
234 *) elfutils_srcdir="../$with_elfutils" ;;
235 esac
236 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
237 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
238 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
239 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
240 # So we must make sure to pass those settings to elfutils configure.
241 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
242 here=`pwd`
243 (mkdir -p build-elfutils && cd build-elfutils &&
244 ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
245 --includedir="${here}/include-elfutils" \
246 --libdir="${here}/lib-elfutils" \
247 --exec-prefix="$exec_prefix" \
248 --prefix="$prefix" \
249 CFLAGS="${CFLAGS/-Wall/}" \
250 LDFLAGS="$LDFLAGS $elfutils_rpath"
251 )
252 fi
253
254 if test "${prefix}" = "/usr/local"; then
255 AC_MSG_NOTICE([])
256 AC_MSG_NOTICE([For a private or temporary build of systemtap, we recommend])
257 AC_MSG_NOTICE([configuring with a prefix. For example, try])
258 AC_MSG_NOTICE([$0 $ac_configure_args --prefix=$HOME/systemtap-${PACKAGE_VERSION}-$$])
259 AC_MSG_NOTICE([Running systemtap uninstalled, entirely out of the build tree,])
260 AC_MSG_NOTICE([is not supported.])
261 fi
This page took 0.050321 seconds and 6 git commands to generate.