[092ee5]: configure.in Maximize Restore History

Download this file

configure.in    235 lines (196 with data), 6.6 kB

#   Autoconf script for oprofile
#
#   Copyright 1999 Olaf Titz <olaf@bigred.inka.de>
#   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.8.2cvs)
AM_CONFIG_HEADER(config.h)

AC_PROG_RANLIB

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)
 
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)

AX_MALLOC_ATTRIBUTE
AX_BUILTIN_EXPECT

AC_SUBST(EXTRA_CFLAGS_MODULE)

topdir=`pwd`
AC_SUBST(topdir)
 
AX_EXTRA_DIRS

dnl some distro have a libiberty.a but does not have a libiberty.h
AC_CHECK_HEADERS(libiberty.h)
AC_CHECK_LIB(iberty, cplus_demangle,, AC_MSG_ERROR([liberty library not found]))
AC_CHECK_FUNCS(xcalloc)
AC_CHECK_FUNCS(xmemdup)
dnl advanced glibc features which we need but may not be present
AC_CHECK_FUNCS(sched_setaffinity perfmonctl)

ORIG_SAVE_LIBS="$LIBS"
AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt library not found]))
AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl"; DL_LIB="-ldl", DL_LIB="")
AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl"; INTL_LIB="-lintl", INTL_LIB="")
AC_CHECK_LIB(bfd, bfd_openr,, AC_MSG_ERROR([bfd library not found]))

# 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 code to describe the binary layout of libdb files, for platform portability
AC_ARG_ENABLE(abi,
	[  --enable-abi                 enable abi portability code (default is disabled)],
	enable_abi=$enableval, enable_abi=no)
if test "$enable_abi" = yes; then
	AC_DEFINE(OPROF_ABI, 1, [whether to build ABI tools])
fi
AM_CONDITIONAL(enable_abi, test "$enable_abi" = yes)

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"
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_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 \
	libopt++/Makefile \
	libdb/Makefile \
	libdb/tests/Makefile \
	libabi/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/op_help.1 \
	doc/opreport.1 \
	doc/opannotate.1 \
	doc/opgprof.1 \
	doc/opstack.1 \
	doc/oparchive.1 \
	doc/srcdoc/Doxyfile \
	libpp/Makefile \
	pp/Makefile \
	gui/Makefile \
	gui/ui/Makefile \
	module/Makefile \
	module/x86/Makefile \
	module/ia64/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