This repository has been archived by the owner on Aug 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathconfigure.in
301 lines (252 loc) · 8.5 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# Autoconf script for oprofile
#
# Copyright 1999 Olaf Titz <[email protected]>
# Adapted for oprofile
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
AC_PREREQ(2.13)
AC_INIT(libop/op_config.h)
AM_INIT_AUTOMAKE(oprofile, 0.9.7cvs)
AM_CONFIG_HEADER(config.h)
AC_CHECK_DECLS([basename], [], [], [[#include <libgen.h>]])
AC_PROG_RANLIB
AC_PROG_LIBTOOL
dnl for the man page
DATE="`date '+%a %d %B %Y'`"
AC_SUBST(DATE)
dnl needed for module build
OPROFILE_DIR=`pwd`
AC_SUBST(OPROFILE_DIR)
# this needs to come before --with-gcc so we link with binutil's version
# of libiberty ... sigh
AC_ARG_WITH(binutils,
[ --with-binutils=dir Path to binutils installation to use], BINUTILSDIR=$withval)
if test "$BINUTILSDIR" != ""; then
LD="$BINUTILSDIR/ld"
if test "$CFLAGS" = ""; then
CFLAGS="-g -O2"
fi
if test "$CXXFLAGS" = ""; then
CXXFLAGS="-g -O2"
fi
CFLAGS="$CFLAGS -I$BINUTILSDIR/include"
CXXFLAGS="$CXXFLAGS -I$BINUTILSDIR/include"
AC_ARG_WITH(binutils-libname,
[ --with-binutils-libname Lib dir name under binutils installation; @<:@lib@:>@]],
BINUTILSLIB=$withval)
if test "$BINUTILSLIB" = ""; then
BINUTILSLIB="lib"
fi
LDFLAGS="$LDFLAGS -L$BINUTILSDIR/$BINUTILSLIB -Xlinker -R -Xlinker $BINUTILSDIR/$BINUTILSLIB"
fi
AC_ARG_WITH(gcc,
[ --with-gcc=dir Path to GCC installation to use], GCCDIR=$withval)
if test "$GCCDIR" != ""; then
CC="$GCCDIR/bin/gcc"
CXX="$GCCDIR/bin/g++"
LDFLAGS="$LDFLAGS -L$GCCDIR/lib -Xlinker -R -Xlinker $GCCDIR/lib"
fi
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_CHECK_PROG(LD,ld,ld,)
test "$LD" || AC_ERROR(ld not found)
AX_FIND_KERNEL
if test "$OPROFILE_26" = "no"; then
AX_CONFIG_MODULE
fi
AC_ARG_WITH(module-dir,
[ --with-module-dir=dir Path to module installation directory], MODINSTALLDIR=$withval)
AC_SUBST(MODINSTALLDIR)
AC_ARG_WITH(java,
[ --with-java=java-home Path to Java home directory], JAVA_HOMEDIR=$withval)
AC_SUBST(JAVA_HOMEDIR)
if test -n "$JAVA_HOMEDIR"; then
AC_CHECK_FILE("$JAVA_HOMEDIR/include/jvmti.h",JVMTI_H_EXISTS="yes",)
AC_CHECK_FILE("$JAVA_HOMEDIR/include/jvmpi.h",JVMPI_H_EXISTS="yes",)
fi
AM_CONDITIONAL(BUILD_JVMTI_AGENT, test -n "$JVMTI_H_EXISTS")
AM_CONDITIONAL(BUILD_JVMPI_AGENT, test -n "$JVMPI_H_EXISTS")
AX_MALLOC_ATTRIBUTE
AX_BUILTIN_EXPECT
AC_SUBST(EXTRA_CFLAGS_MODULE)
topdir=`pwd`
AC_SUBST(topdir)
AX_EXTRA_DIRS
ORIG_SAVE_LIBS="$LIBS"
dnl advanced glibc features which we need but may not be present
AC_CHECK_FUNCS(sched_setaffinity perfmonctl)
AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt library not found]))
AX_BINUTILS
AX_CELL_SPU
# C++ tests
AC_LANG_CPLUSPLUS
AX_POPT_CONST
AX_CHECK_SSTREAM
dnl bfd.h pre 1998 check only for gnu 2.xx series, so gcc 3.0 can't compile it
AC_MSG_CHECKING([whether bfd defines bool])
AC_TRY_COMPILE([#include <bfd.h>], [],
AC_MSG_RESULT([no]);,
AC_MSG_RESULT([yes]); AC_DEFINE(TRUE_FALSE_ALREADY_DEFINED, 1, [whether bfd.h defines bool values]))
dnl smart demangler need to know what are the underlined type for some typedef
AX_TYPEDEFED_NAME(size_t, "unsigned" "unsigned long", SIZE_T_TYPE)
AC_SUBST(SIZE_T_TYPE)
AX_TYPEDEFED_NAME(ptrdiff_t, "int" "long", PTRDIFF_T_TYPE)
AC_SUBST(PTRDIFF_T_TYPE)
AC_PATH_XTRA
ORIG_X_SAVE_LIBS="$LIBS"
LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
X_LIBS="$LIBS"
AC_SUBST(X_LIBS)
QT_DO_IT_ALL
LIBS="$ORIG_X_SAVE_LIBS"
dnl enable pch for c++
AC_ARG_ENABLE(pch,
[ --enable-pch enable precompiled header (default is disabled)],
enable_pch=$enableval, enable_pch=no)
if test "$enable_pch" = yes; then
AX_CHECK_PRECOMPILED_HEADER(OP_CXXFLAGS)
fi
AX_CHECK_DOCBOOK
dnl finally restore the original libs setting
LIBS="$ORIG_SAVE_LIBS"
LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB"
BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $Z_LIB"
POPT_LIBS="-lpopt"
AC_SUBST(LIBERTY_LIBS)
AC_SUBST(BFD_LIBS)
AC_SUBST(POPT_LIBS)
# do NOT put tests here, they will fail in the case X is not installed !
AM_CONDITIONAL(have_qt, test -n "$QT_LIB")
AX_CFLAGS_OPTION(OP_CFLAGS,[-W])
AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-W])
AX_CFLAGS_OPTION(OP_CFLAGS,[-Wall])
AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-Wall])
AX_CFLAGS_OPTION(OP_CFLAGS,[-fno-common])
AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-fno-common])
AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-ftemplate-depth-50])
AX_CFLAGS_OPTION(OP_CFLAGS,[-Wdeclaration-after-statement])
dnl enable option to use GCC test coverage
AC_ARG_ENABLE(gcov,
[ --enable-gcov enable option for gcov coverage testing (default is disabled)],
enable_gcov=$enableval, enable_gcov=no)
if test "$enable_gcov" = yes; then
AX_CFLAGS_OPTION(OP_CFLAGS,[-fprofile-arcs])
AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-fprofile-arcs])
AX_CFLAGS_OPTION(OP_CFLAGS,[-ftest-coverage])
AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-ftest-coverage])
fi
AC_ARG_ENABLE(werror,
[ --disable-werror disable -Werror flag (default is enabled for non-release)],
enable_werror=$enableval, enable_werror=yes)
if test "$enable_werror" = yes; then
# enable -Werror for non-release versions.
if echo "$VERSION" | grep cvs >/dev/null; then
AX_CFLAGS_OPTION(OP_CFLAGS,[-Werror])
AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-Werror])
fi
fi
AC_ARG_ENABLE(optimization,
[ --disable-optimization disable optimization flags (default is enabled)],
enable_optimization=$enableval, enable_optimisation=yes)
if test "$enable_optimization" = "no"; then
CFLAGS=`echo $CFLAGS | sed 's/-O2//g'`
CXXFLAGS=`echo $CXXFLAGS | sed 's/-O2//g'`
fi
AC_ARG_ENABLE(account-check,
[ --disable-account-check disable account check (default is enabled)],
enable_account_check=$enableval, enable_account_check=yes)
AM_CONDITIONAL(CHECK_ACCOUNT, test "x$enable_account_check" = "xyes")
AC_SUBST(OP_CFLAGS)
AC_SUBST(OP_CXXFLAGS)
# fixups for config.h
if test "$prefix" = "NONE"; then
my_op_prefix="$ac_default_prefix"
else
my_op_prefix="$prefix"
fi
my_op_datadir="$my_op_prefix/share"
if test "$exec_prefix" = "NONE"; then
my_op_exec_prefix="$my_op_prefix"
else
my_op_exec_prefix="$exec_prefix"
fi
my_op_bindir="$my_op_exec_prefix/bin"
OP_DATADIR=`eval echo "$my_op_datadir/$PACKAGE/"`
AC_DEFINE_UNQUOTED(OP_DATADIR, "$OP_DATADIR", [package data directory])
OP_BINDIR=`eval echo "$my_op_bindir/"`
AC_DEFINE_UNQUOTED(OP_BINDIR, "$OP_BINDIR", [package binary directory])
OP_DOCDIR=`eval echo "${my_op_prefix}/share/doc/$PACKAGE/"`
AC_SUBST(OP_DOCDIR)
AC_OUTPUT(Makefile \
m4/Makefile \
libutil/Makefile \
libutil/tests/Makefile \
libutil++/Makefile \
libutil++/tests/Makefile \
libop/Makefile \
libop/tests/Makefile \
libopagent/Makefile \
libopt++/Makefile \
libdb/Makefile \
libdb/tests/Makefile \
libabi/Makefile \
libabi/tests/Makefile \
libregex/Makefile \
libregex/tests/Makefile \
libregex/stl.pat \
libregex/tests/mangled-name \
daemon/Makefile \
daemon/liblegacy/Makefile \
events/Makefile \
utils/Makefile \
doc/Makefile \
doc/xsl/catalog-1.xml \
doc/oprofile.1 \
doc/opcontrol.1 \
doc/ophelp.1 \
doc/opreport.1 \
doc/opannotate.1 \
doc/opgprof.1 \
doc/oparchive.1 \
doc/opimport.1 \
doc/srcdoc/Doxyfile \
libpp/Makefile \
opjitconv/Makefile \
pp/Makefile \
gui/Makefile \
gui/ui/Makefile \
module/Makefile \
module/x86/Makefile \
module/ia64/Makefile \
agents/Makefile \
agents/jvmti/Makefile \
agents/jvmpi/Makefile)
AX_COPY_IF_CHANGE(doc/xsl/catalog-1.xml, doc/xsl/catalog.xml)
if test -z "$QT_LIB"; then
echo "Warning: a working Qt not found; no GUI will be built"
fi
if ! test "x$enable_account_check" = "xyes"; then
:
elif test "`getent passwd oprofile 2>/dev/null`" == "" || \
test "`getent group oprofile 2>/dev/null`" == ""; then
if test `id -u` != "0"; then
echo "Warning: The user account 'oprofile:oprofile' does not exist on the system."
echo " To profile JITed code, this special user account must exist."
echo " Please ask your system administrator to add the following user and group:"
echo " user name : 'oprofile'"
echo " group name: 'oprofile'"
echo " The 'oprofile' group must be the default group for the 'oprofile' user."
else
echo "Warning: The user account 'oprofile:oprofile' does not exist on the system."
echo " To profile JITed code, this special user account must exist."
echo " Please add the following user and group:"
echo " user name : 'oprofile'"
echo " group name: 'oprofile'"
echo " The 'oprofile' group must be the default group for the 'oprofile' user."
fi
fi