]> sourceware.org Git - systemtap.git/blob - configure.ac
Merge commit 'origin/dwarfless'
[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.7, systemtap@sources.redhat.com, systemtap)
5 dnl ^^^ see also NEWS, testsuite/configure.ac
6
7 AC_PREREQ(2.59)
8 AM_INIT_AUTOMAKE
9 AM_MAINTAINER_MODE
10
11 AC_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 AC_CHECK_HEADERS([sys/capability.h], ,
165 [AC_MSG_ERROR([cannot find required libcap header (libcap-devel may need to be installed)])])
166
167 dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
168 dnl the system's elfutils.
169 build_elfutils=no
170 AC_ARG_WITH([elfutils],
171 AS_HELP_STRING([--with-elfutils=DIRECTORY],
172 [find elfutils source code in DIRECTORY]),
173 [
174 case "$with_elfutils" in
175 yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
176 ''|no) ;;
177 *) build_elfutils=yes ;;
178 esac])
179 AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
180 AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
181 [cd $with_elfutils && pwd])`)
182
183 if test $build_elfutils = no; then
184 # Need libdwfl-capable recent elfutils from Fedora
185 save_LIBS="$LIBS"
186 AC_CHECK_LIB(dw, dwfl_module_getsym,,[
187 AC_MSG_ERROR([missing elfutils development headers/libraries (dw 0.123+)])])
188 AC_CHECK_LIB(ebl, ebl_openbackend,,[
189 AC_MSG_ERROR([missing elfutils development headers/libraries (ebl 0.123+)])])
190
191 stap_LIBS="$LIBS"
192 LIBS="$save_LIBS"
193 else
194 # We built our own and stap_LDFLAGS points at the install.
195 stap_LIBS="-ldw -lebl"
196 fi
197
198 AC_SUBST(stap_LIBS)
199 AC_MSG_NOTICE([stap will link $stap_LIBS])
200
201 dnl Plop in the build (configure) date
202 date=`date +%Y-%m-%d`
203 AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
204 AC_SUBST(DATE, "$date")
205
206
207 # This procflags business is for staprun/stapio, which need to
208 # be compiled with the same bitness as the kernel. On e.g. PPC,
209 # userspace might be 32-bit default, but staprun needs to be
210 # 64-bit. See also bug #4037.
211
212 processor=`uname -p`
213 case "$processor" in
214 ppc64) PROCFLAGS=-m64 ;;
215 x86_64) PROCFLAGS=-m64 ;;
216 *) PROCFLAGS=""
217 esac
218 AC_SUBST([PROCFLAGS])
219
220 # -lcap is used for staprun, so PROCFLAGS comes in to play
221 SAVE_LIBS="$LIBS"
222 SAVE_CFLAGS="$CFLAGS"
223 CFLAGS="$CFLAGS $PROCFLAGS"
224 AC_CHECK_LIB(cap, cap_init, [], [AC_MSG_ERROR(need $PROCFLAGS -lcap)])
225 cap_LIBS="$LIBS"
226 AC_SUBST(cap_LIBS)
227 LIBS="$SAVE_LIBS"
228 CFLAGS="$SAVE_CFLAGS"
229
230 AC_CONFIG_HEADERS([config.h:config.in])
231 AC_CONFIG_FILES(Makefile doc/Makefile systemtap.spec stap.1 stapprobes.5 stapfuncs.5 stapex.5 staprun.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)
232 AC_CONFIG_SUBDIRS(testsuite)
233
234 AC_OUTPUT
235
236 if test $build_elfutils = yes; then
237 case "$with_elfutils" in
238 /*) elfutils_srcdir="$with_elfutils" ;;
239 *) elfutils_srcdir="../$with_elfutils" ;;
240 esac
241 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
242 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
243 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
244 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
245 # So we must make sure to pass those settings to elfutils configure.
246 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
247 here=`pwd`
248 (mkdir -p build-elfutils && cd build-elfutils &&
249 ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
250 --includedir="${here}/include-elfutils" \
251 --libdir="${here}/lib-elfutils" \
252 --exec-prefix="$exec_prefix" \
253 --prefix="$prefix" \
254 CFLAGS="${CFLAGS/-Wall/}" \
255 LDFLAGS="$LDFLAGS $elfutils_rpath"
256 )
257 fi
258
This page took 0.051998 seconds and 6 git commands to generate.