]> sourceware.org Git - systemtap.git/blame - configure.ac
hangeLog entries for latest commits.
[systemtap.git] / configure.ac
CommitLineData
2f1a1aea
FCE
1dnl configure.ac --- autoconf input file for systemtap
2dnl Process this file with autoconf to produce a configure script.
3
cfaa068c
FCE
4AC_INIT([systemtap], 0.7.1, systemtap@sources.redhat.com, systemtap)
5dnl ^^^^^ see also NEWS, systemtap.spec, testsuite/configure.ac
e872ae09 6
2f1a1aea
FCE
7AC_PREREQ(2.59)
8AM_INIT_AUTOMAKE
9AM_MAINTAINER_MODE
10
98aab489 11AC_PROG_MKDIR_P
2f1a1aea
FCE
12AC_PROG_LN_S
13AC_PROG_CC
14AC_PROG_CXX
15AC_PROG_CPP
16AM_PROG_CC_STDC
8ae7a94a 17AM_PROG_CC_C_O
2f1a1aea 18AM_C_PROTOTYPES
2f1a1aea
FCE
19AC_PROG_RANLIB
20AC_OBJEXT
21AC_EXEEXT
22AC_PROG_INSTALL
23AC_PROG_MAKE_SET
24AC_SUBST(CFLAGS)
25AC_SUBST(CXXFLAGS)
26
e8f3c2c2
DS
27dnl Handle the perfmon option.
28AC_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).]), [
564eb0a8
DS
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])
70d28673 45
e8f3c2c2
DS
46dnl Handle the prologues option.
47dnl
70d28673
DS
48dnl If the user didn't specify --enable-prologues/--disable-prologues
49dnl and the x86 system has a version of gcc less than version 4,
50dnl automatically enable prologues.
51if 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
61fi
e8f3c2c2
DS
62AC_ARG_ENABLE([prologues],
63 AS_HELP_STRING([--enable-prologues], [make -P prologue-searching default]),
64 [
70d28673
DS
65if test "$enable_prologues" = yes; then
66 AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default])
67fi])
68
9921a199 69AC_ARG_ENABLE([ssp],
bbfd8c1a
FCE
70 [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])])
71AS_IF([test "x$enable_ssp" != xno],[
72 save_CFLAGS="$CFLAGS"
73 save_CXXFLAGS="$CXXFLAGS"
f0510eaa
FCE
74 CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
75 CFLAGS="$CFLAGS -Werror -fstack-protector-all -D_FORTIFY_SOURCE=2"
bbfd8c1a 76 AC_COMPILE_IFELSE([int something ();], [
f0510eaa
FCE
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"],[
bbfd8c1a
FCE
80 AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.])
81 CFLAGS="$save_CFLAGS"
82 CXXFLAGS="$save_CXXFLAGS"])])
70d28673 83
8730f377
FCE
84AC_ARG_ENABLE([pie],
85 [AS_HELP_STRING([--disable-pie], [disable position-independent-executable])])
86AS_IF([test "x$enable_pie" != xno],[
87 save_CFLAGS="$CFLAGS"
88 save_CXXFLAGS="$CXXFLAGS"
89 save_LDFLAGS="$LDFLAGS"
7b53a460
SD
90 CFLAGS="$CFLAGS -fPIE"
91 CXXFLAGS="$CXXFLAGS -fPIE"
8730f377
FCE
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"])])
105AC_SUBST(PIELDFLAGS)
106
9921a199
DS
107dnl Handle optional sqlite support. If enabled/disabled by the user,
108dnl do the right thing. If not specified by the user, use it if
109dnl present.
110AC_ARG_ENABLE([sqlite],
e8f3c2c2
DS
111 AS_HELP_STRING([--enable-sqlite], [build with sqlite support]),
112 [], dnl ACTION-IF-GIVEN
113 [enable_sqlite=check]) dnl ACTION-IF-NOT-GIVEN
9921a199
DS
114sqlite3_LIBS=
115AS_IF([test "x$enable_sqlite" != xno],
116 [AC_CHECK_LIB([sqlite3], [sqlite3_open],
07606685 117 [AC_SUBST([sqlite3_LIBS], [-lsqlite3])
0d563e60 118 AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the `sqlite3' library (-lsqlite3).])],
9921a199
DS
119 [if test "x$enable_sqlite" != xcheck; then
120 AC_MSG_FAILURE([--enable-sqlite was given, but test for sqlite failed])
121 fi])])
e6c086bb 122
564eb0a8
DS
123dnl Handle the option to build the crash extension
124AC_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 [
e8f3c2c2 140#define NR_CPUS 256
564eb0a8
DS
141 ])
142 CPPFLAGS="$save_CPPFLAGS"
143 fi],
144 [enable_crash="no"])
145AM_CONDITIONAL([BUILD_CRASHMOD], [test "$enable_crash" != "no"])
e6c086bb 146
465e8fbf
FCE
147dnl Handle the option to build the documentation
148AC_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"])
153AC_CHECK_PROG(have_latex, latex, yes, no)
154AC_CHECK_PROG(have_dvips, dvips, yes, no)
155AC_CHECK_PROG(have_ps2pdf, ps2pdf, yes, no)
156AC_CHECK_PROG(have_latex2html, latex2html, yes, no)
157if 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
161fi
162AM_CONDITIONAL([BUILD_DOCS], [test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"])
163
e8f3c2c2
DS
164dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used
165dnl the system's elfutils.
4d9087fc
RM
166build_elfutils=no
167AC_ARG_WITH([elfutils],
e8f3c2c2
DS
168 AS_HELP_STRING([--with-elfutils=DIRECTORY],
169 [find elfutils source code in DIRECTORY]),
170 [
4d9087fc
RM
171case "$with_elfutils" in
172yes) AC_MSG_ERROR([--with-elfutils requires an argument]) ;;
173''|no) ;;
174*) build_elfutils=yes ;;
175esac])
176AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
fa1d05cd
RM
177AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
178 [cd $with_elfutils && pwd])`)
179
9cb3a339 180if test $build_elfutils = no; then
8d4b1ab0 181 # Need libdwfl-capable recent elfutils http://elfutils.fedorahosted.org/
4d9087fc 182 save_LIBS="$LIBS"
cfa2ca3c 183 AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
8d4b1ab0 184 AC_MSG_ERROR([missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)])],
cfa2ca3c
JS
185 [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
186 stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
e8f3c2c2 187 LIBS="$save_LIBS"
4d9087fc
RM
188else
189 # We built our own and stap_LDFLAGS points at the install.
cfa2ca3c 190 stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
4d9087fc 191fi
a74dd276 192
6b1a0274
WC
193AC_SUBST(stap_LIBS)
194AC_MSG_NOTICE([stap will link $stap_LIBS])
c3a3c0c9 195
69c68955
FCE
196dnl Plop in the build (configure) date
197date=`date +%Y-%m-%d`
198AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
82fab474 199AC_SUBST(DATE, "$date")
69c68955 200
10b20266
FCE
201
202# This procflags business is for staprun/stapio, which need to
203# be compiled with the same bitness as the kernel. On e.g. PPC,
204# userspace might be 32-bit default, but staprun needs to be
205# 64-bit. See also bug #4037.
206
5566993b
MH
207processor=`uname -p`
208case "$processor" in
209ppc64) PROCFLAGS=-m64 ;;
210x86_64) PROCFLAGS=-m64 ;;
211*) PROCFLAGS=""
212esac
213AC_SUBST([PROCFLAGS])
214
3bf6ac45
TM
215# Use tr1/unordered_map if available
216AC_LANG_PUSH(C++)
217AC_CHECK_HEADERS([tr1/unordered_map])
218AC_LANG_POP(C++)
219
2f1a1aea 220AC_CONFIG_HEADERS([config.h:config.in])
d1f2fc72 221AC_CONFIG_FILES(Makefile doc/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)
5ba96b90
FCE
222AC_CONFIG_SUBDIRS(testsuite)
223
2f1a1aea 224AC_OUTPUT
4d9087fc
RM
225
226if test $build_elfutils = yes; then
227 case "$with_elfutils" in
228 /*) elfutils_srcdir="$with_elfutils" ;;
229 *) elfutils_srcdir="../$with_elfutils" ;;
230 esac
231 AC_MSG_NOTICE([running ${elfutils_srcdir}/configure])
b7165f65
RM
232 # Our libdw.so's libebl will look in $ORIGIN/../lib/... but that
233 # $ORIGIN is where libdw.so resides, which is not where there is a ../lib.
fa1d05cd
RM
234 # Note that $libdir might be using a quoted use of $exec_prefix or $prefix.
235 # So we must make sure to pass those settings to elfutils configure.
b7165f65 236 elfutils_rpath="-Wl,--enable-new-dtags,-rpath,${libdir}/${PACKAGE_NAME}"
4d9087fc
RM
237 here=`pwd`
238 (mkdir -p build-elfutils && cd build-elfutils &&
239 ${elfutils_srcdir}/configure --enable-libebl-subdir=${PACKAGE_NAME} \
240 --includedir="${here}/include-elfutils" \
b7165f65 241 --libdir="${here}/lib-elfutils" \
fa1d05cd
RM
242 --exec-prefix="$exec_prefix" \
243 --prefix="$prefix" \
2a86df4c 244 CFLAGS="${CFLAGS/-Wall/}" \
b7165f65 245 LDFLAGS="$LDFLAGS $elfutils_rpath"
4d9087fc
RM
246 )
247fi
5566993b 248
This page took 0.083007 seconds and 5 git commands to generate.