blob: b45896ae4daaa40fe148bda3703d91bb599188f4 [file] [log] [blame]
# Process this file with autoconf to produce a configure script.
AC_INIT(Valgrind, 2.3.0.CVS, valgrind-users@lists.sourceforge.net)
AC_CONFIG_SRCDIR(coregrind/vg_main.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
# Checks for programs.
CFLAGS=""
AC_PROG_LN_S
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_RANLIB
# Check for the compiler support
if test "${GCC}" != "yes" ; then
AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
fi
# figure out where perl lives
AC_PATH_PROG(PERL, perl)
# figure out where gdb lives
AC_PATH_PROG(GDB, gdb)
# autoheader tries to execute the 3rd string or something; I get warnings when
# it's defined. So just leave it undefined. --njn 2002-Apr-18
AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", "")
# some older automake's don't have it so try something on our own
ifdef([AM_PROG_AS],[AM_PROG_AS],
[
AS="${CC}"
AC_SUBST(AS)
ASFLAGS=""
AC_SUBST(ASFLAGS)
])
# This variable will collect the individual suppression files
# depending on the results of autoconf
DEFAULT_SUPP=""
# We don't want gcc 2.7
AC_MSG_CHECKING([for a supported version of gcc])
gcc_version=`${CC} --version | head -n 1`
case "${gcc_version}" in
gcc-2.7.*)
AC_MSG_RESULT([no (${gcc_version})])
AC_MSG_ERROR([please use a recent (>= gcc-2.95) version of gcc])
;;
*)
AC_MSG_RESULT([ok (${gcc_version})])
;;
esac
# Checks for the platform
AC_CANONICAL_HOST
AC_MSG_CHECKING([for a supported CPU])
AC_SUBST(VG_ARCH)
case "${host_cpu}" in
i?86)
AC_MSG_RESULT([ok (${host_cpu})])
VG_ARCH="x86"
;;
powerpc*)
AC_MSG_RESULT([no (${host_cpu})])
VG_ARCH="ppc"
AC_MSG_ERROR([PowerPC not supported. Sorry])
;;
*)
AC_MSG_RESULT([no (${host_cpu})])
AC_MSG_ERROR([Unsupported host architecture. Sorry])
;;
esac
AC_MSG_CHECKING([for a supported OS])
AC_SUBST(VG_OS)
case "${host_os}" in
*linux*)
AC_MSG_RESULT([ok (${host_os})])
VG_OS="linux"
# Ok, this is linux. Check the kernel version
AC_MSG_CHECKING([for the kernel version])
kernel=`uname -r`
case "${kernel}" in
2.6.*)
AC_MSG_RESULT([2.6 family (${kernel})])
AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
;;
2.4.*)
AC_MSG_RESULT([2.4 family (${kernel})])
AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
;;
2.2.*)
AC_MSG_RESULT([2.2 family (${kernel})])
AC_DEFINE([KERNEL_2_2], 1, [Define to 1 if you're using Linux 2.2.x])
;;
*)
AC_MSG_RESULT([unsupported (${kernel})])
AC_MSG_ERROR([Valgrind works on kernels 2.2, 2.4, 2.6])
;;
esac
;;
*freebsd*)
AC_MSG_RESULT([ok (${host_os})])
VG_OS="freebsd"
;;
*)
AC_MSG_RESULT([no (${host_os})])
AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
;;
esac
AC_MSG_CHECKING([for a supported CPU/OS combination])
AC_SUBST(VG_PLATFORM)
VG_PLATFORM="$VG_ARCH-$VG_OS"
case $VG_PLATFORM in
x86-linux)
AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
;;
*)
AC_MSG_RESULT([no (${host_cpu}-${host_os})])
AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doin
g a port.])
;;
esac
AC_SUBST(DEFAULT_SUPP)
glibc=""
AC_EGREP_CPP([GLIBC_21], [
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 1)
GLIBC_21
#endif
#endif
],
glibc="2.1")
AC_EGREP_CPP([GLIBC_22], [
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
GLIBC_22
#endif
#endif
],
glibc="2.2")
AC_EGREP_CPP([GLIBC_23], [
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
GLIBC_23
#endif
#endif
],
glibc="2.3")
# Ok, this is linux. Check the kernel version
AC_MSG_CHECKING([the glibc version])
case "${glibc}" in
2.1)
AC_MSG_RESULT(2.1 family)
AC_DEFINE([GLIBC_2_1], 1, [Define to 1 if you're using glibc 2.1.x])
DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.1.supp"
;;
2.2)
AC_MSG_RESULT(2.2 family)
AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.2.supp"
;;
2.3)
AC_MSG_RESULT(2.3 family)
AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.3.supp"
;;
*)
AC_MSG_RESULT(unsupported version)
AC_MSG_ERROR([Valgrind requires the glibc version 2.1, 2.2 or 2.3])
;;
esac
# APIs introduced in recent glibc versions
AC_MSG_CHECKING([whether sched_param has a sched_priority member])
AC_CACHE_VAL(vg_have_sched_priority,
[
AC_TRY_COMPILE([#include <pthread.h>],[
struct sched_param p; p.sched_priority=1;],
vg_have_sched_priority=yes,
vg_have_sched_priority=no)
])
AC_MSG_RESULT($vg_have_sched_priority)
if test "$vg_have_sched_priority" = yes; then
AC_DEFINE([HAVE_SCHED_PRIORITY], 1, [pthread / sched_priority exists])
fi
AC_MSG_CHECKING([whether nfds_t is defined])
AC_CACHE_VAL(vg_have_nfds_t,
[
AC_TRY_COMPILE([#include <sys/poll.h>],[
nfds_t i=0;],
vg_have_nfds_t=yes,
vg_have_nfds_t=no)
])
AC_MSG_RESULT($vg_have_nfds_t)
if test "$vg_have_nfds_t" = yes; then
AC_DEFINE([HAVE_NFDS_T], 1, [nfds_t exists])
fi
# try to detect the XFree version
# JRS 2002-06-17: this is completely bogus because it
# detects the server version, whereas we need to know the
# client library version. So what follows is hacked to
# use all the X supp files regardless of what is detected.
# This is really stoooopid and should be fixed properly.
AC_PATH_X
if test "${no_x}" != 'yes' ; then
AC_MSG_CHECKING([X version])
cat<<EOF > conftest.c
#include <X11/Xlib.h>
int main (int argc, char * argv [])
{
Display * display = XOpenDisplay (NULL);
if (display) {
printf ("%s version=%d\n", ServerVendor (display), VendorRelease (display));
}
return 0;
}
EOF
${CC} -o conftest conftest.c -I${x_includes} -L${x_libraries} -lX11 >&5 2>&1
if test "$?" != 0 ; then
AC_MSG_RESULT([cannot compile test program])
else
xfree=`./conftest`
case "${xfree}" in
*XFree86*)
case "${xfree}" in
*version=4*)
AC_MSG_RESULT([XFree 4.x family])
AC_DEFINE([XFREE_4], 1, [Define to 1 if you're using XFree 4.x])
DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
# haaaaaaack!
DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp"
;;
*version=3*)
AC_MSG_RESULT([XFree 3.x family])
AC_DEFINE([XFREE_3], 1, [Define to 1 if you're using XFree86 3.x])
DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp"
# haaaaaaack!
DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
;;
*) AC_MSG_RESULT([unknown XFree86 server (${xfree})])
# haaaaaaack!
DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp"
DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
;;
esac
;;
*X.Org*)
case "${xfree}" in
*version=6*)
AC_MSG_RESULT([X.Org 6.x family])
AC_DEFINE([XFREE_4], 1, [Define to 1 if you're using XFree 4.x])
DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
# haaaaaaack!
DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp"
;;
esac
;;
*) AC_MSG_RESULT([not a XFree86 server])
;;
esac
fi
rm -f conftest conftest.c
fi
# check if the GNU as supports CFI directives
AC_MSG_CHECKING([if gas accepts .cfi])
AC_TRY_LINK(, [
__asm__ __volatile__ (".cfi_startproc\n"
".cfi_adjust_cfa_offset 0x0\n"
".cfi_endproc\n");
],
[
AC_DEFINE_UNQUOTED([HAVE_GAS_CFI], 1, [Define if your GNU as supports .cfi])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no)
)
# does this compiler support -mpreferred-stack-boundary=2 ?
AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
safe_CFLAGS=$CFLAGS
CFLAGS="-mpreferred-stack-boundary=2"
AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
AC_MSG_RESULT([yes])
], [
PREFERRED_STACK_BOUNDARY=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AC_SUBST(PREFERRED_STACK_BOUNDARY)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/statfs.h sys/time.h sys/endian.h endian.h termios.h unistd.h utime.h linux/fb.h mqueue.h linux/compiler.h])
AH_TEMPLATE([HAVE_LINUX_MII_H], [])
AC_MSG_CHECKING([for linux/mii.h])
AC_PREPROC_IFELSE([#include <linux/mii.h>],
[AC_DEFINE([HAVE_LINUX_MII_H])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_CHECK_TYPES(__pthread_unwind_buf_t,,,[#include <pthread.h>])
AC_CHECK_TYPES(u16,,,[#include <linux/mii.h>])
# Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
AC_OUTPUT(
Makefile
valgrind.spec
valgrind.pc
docs/Makefile
tests/Makefile
tests/vg_regtest
tests/unused/Makefile
include/valgrind.h
include/Makefile
include/x86/Makefile
auxprogs/Makefile
coregrind/Makefile
coregrind/demangle/Makefile
coregrind/docs/Makefile
coregrind/x86/Makefile
coregrind/x86-linux/Makefile
addrcheck/Makefile
addrcheck/tests/Makefile
addrcheck/tests/x86/Makefile
addrcheck/docs/Makefile
memcheck/Makefile
memcheck/tests/Makefile
memcheck/tests/x86/Makefile
memcheck/docs/Makefile
cachegrind/Makefile
cachegrind/x86/Makefile
cachegrind/tests/Makefile
cachegrind/tests/x86/Makefile
cachegrind/docs/Makefile
cachegrind/cg_annotate
helgrind/Makefile
helgrind/tests/Makefile
helgrind/tests/x86/Makefile
helgrind/docs/Makefile
massif/Makefile
massif/hp2ps/Makefile
massif/tests/Makefile
massif/docs/Makefile
corecheck/Makefile
corecheck/tests/Makefile
corecheck/docs/Makefile
lackey/Makefile
lackey/tests/Makefile
lackey/docs/Makefile
none/Makefile
none/tests/Makefile
none/tests/x86/Makefile
none/docs/Makefile
)
cat<<EOF
Using the following suppressions by default:
${DEFAULT_SUPP}
EOF
cat<<EOF > default.supp
# This is a generated file, composed of the following suppression rules:
#
# ${DEFAULT_SUPP}
#
EOF
for file in ${DEFAULT_SUPP} ; do
cat ${srcdir}/$file >> default.supp
done