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