[de78e3]: configure.in Maximize Restore History

Download this file

configure.in    189 lines (154 with data), 4.8 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.6cvs)
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_25" = "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)

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

ORIG_SAVE_LIBS="$LIBS"
AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt library not found]))
AC_CHECK_LIB(dl, dlopen,, AC_MSG_ERROR([dl library not found]))
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)

AX_CHECK_DOCBOOK

dnl finally restore the original libs setting
LIBS="$ORIG_SAVE_LIBS"
dnl some libiberties need -ldl ...
LIBERTY_LIBS="-liberty -ldl"
BFD_LIBS="-lbfd -liberty -ldl"
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")

# inihibited for now
AM_CONDITIONAL(build_oprof_report, false)

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

# 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

AC_SUBST(OP_CFLAGS)
AC_SUBST(OP_CXXFLAGS)

# fixups for config.h
if test "$prefix" = "NONE"; then
	prefix="$ac_default_prefix"
fi
if test "$exec_prefix" = "NONE"; then
	exec_prefix="$prefix"
fi
if test "$bindir" = "NONE"; then
	bindir="$prefix/bin"
fi
if test "$datadir" = "NONE"; then
	datadir="$prefix/share"
fi
OP_DATADIR=`eval echo "$datadir/$PACKAGE/"`
AC_DEFINE_UNQUOTED(OP_DATADIR, "$OP_DATADIR", [package data directory])
OP_BINDIR=`eval echo "$bindir/"`
AC_DEFINE_UNQUOTED(OP_BINDIR, "$OP_BINDIR", [package binary directory])

AC_OUTPUT(Makefile \
	m4/Makefile \
	libutil/Makefile \
	libutil++/Makefile \
	libop/Makefile \
	libopt++/Makefile \
	libdb/Makefile \
	libabi/Makefile \
	libregex/Makefile \
	libregex/stl.pat \
	dae/Makefile \
	daemon/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 \
	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