From: Julian Seward Date: Mon, 11 Jul 2011 20:42:34 +0000 (+0000) Subject: Introduce the concept of platform variants. These allow further X-Git-Tag: svn/VALGRIND_3_7_0~365 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d136f187bb24cc35ad8ee693221101152774b1a9;p=thirdparty%2Fvalgrind.git Introduce the concept of platform variants. These allow further qualification of the normal (arch, os) pairings used to factorise the code base via the VGP_ defines. With this change, a new define VGPV___ is also passed to each compile. The initial motivation is to allow clean factorisation of Android-specific code, which is a minor variant of arm-linux, without having to introduce a complete new platform. In all other cases the supplied tag is simply "vanilla". Also add configure.in stuff to recognise Android at configure time. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11872 --- diff --git a/Makefile.all.am b/Makefile.all.am index 2f89f05765..513b810b45 100644 --- a/Makefile.all.am +++ b/Makefile.all.am @@ -122,7 +122,8 @@ AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ = \ -I$(top_srcdir)/VEX/pub \ -DVGA_@VGCONF_ARCH_PRI@=1 \ -DVGO_@VGCONF_OS@=1 \ - -DVGP_@VGCONF_ARCH_PRI@_@VGCONF_OS@=1 + -DVGP_@VGCONF_ARCH_PRI@_@VGCONF_OS@=1 \ + -DVGPV_@VGCONF_ARCH_PRI@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1 if VGCONF_HAVE_PLATFORM_SEC AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ = \ -I$(top_srcdir) \ @@ -130,7 +131,8 @@ AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ = \ -I$(top_srcdir)/VEX/pub \ -DVGA_@VGCONF_ARCH_SEC@=1 \ -DVGO_@VGCONF_OS@=1 \ - -DVGP_@VGCONF_ARCH_SEC@_@VGCONF_OS@=1 + -DVGP_@VGCONF_ARCH_SEC@_@VGCONF_OS@=1 \ + -DVGPV_@VGCONF_ARCH_SEC@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1 endif AM_FLAG_M3264_X86_LINUX = @FLAG_M32@ diff --git a/configure.in b/configure.in index 13d75e3a9d..8f2242319d 100644 --- a/configure.in +++ b/configure.in @@ -595,6 +595,15 @@ else fi +#---------------------------------------------------------------------------- +# Extra fine-tuning of installation directories +#---------------------------------------------------------------------------- +AC_ARG_WITH(tmpdir, + [ --with-tmpdir=PATH Specify path for temporary files], + tmpdir="$withval", + tmpdir="/tmp") +AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory]) + #---------------------------------------------------------------------------- # Libc and suppressions #---------------------------------------------------------------------------- @@ -623,6 +632,15 @@ AC_EGREP_CPP([DARWIN_LIBC], [ ], GLIBC_VERSION="darwin") +# not really a version check +AC_EGREP_CPP([BIONIC_LIBC], [ +#if defined(__ANDROID__) + BIONIC_LIBC +#endif +], +GLIBC_VERSION="bionic") + + AC_MSG_CHECKING([the GLIBC_VERSION version]) case "${GLIBC_VERSION}" in @@ -725,6 +743,11 @@ case "${GLIBC_VERSION}" in AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin]) # DEFAULT_SUPP set by kernel version check above. ;; + bionic) + AC_MSG_RESULT(Bionic) + AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic]) + DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}" + ;; *) AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}]) @@ -747,6 +770,57 @@ DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}" DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}" +#---------------------------------------------------------------------------- +# Platform variants? +#---------------------------------------------------------------------------- + +# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough. +# But there are times where we need a bit more control. The motivating +# and currently only case is Android: this is almost identical to arm-linux, +# but not quite. So this introduces the concept of platform variant tags, +# which get passed in the compile as -DVGPV___ along +# with the main -DVGP__ definition. +# +# In almost all cases, the bit is "vanilla". But for Android +# it is "android" instead. +# +# Consequently (eg), plain arm-linux would build with +# +# -DVGP_arm_linux -DVGPV_arm_linux_vanilla +# +# whilst an Android build would have +# +# -DVGP_arm_linux -DVGPV_arm_linux_android +# +# The setup of the platform variant is pushed relatively far down this +# file in order that we can inspect any of the variables set above. + +# In the normal case .. +VGCONF_PLATVARIANT="vanilla" + +# Android on ARM ? +if test "$VGCONF_ARCH_PRI-$VGCONF_OS" = "arm-linux" \ + -a "$GLIBC_VERSION" = "bionic"; +then + VGCONF_PLATVARIANT="android" +fi + +AC_SUBST(VGCONF_PLATVARIANT) + + +# FIXME: do we also want to define automake variables +# VGCONF_PLATVARIANT_IS_, where WHATEVER is (currently) +# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE, +# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough +# do that. Problem is that we can't do and-ing in Makefile.am's, but +# that's what we'd need to do to use this, since what we'd want to write +# is something like +# +# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID +# +# Oh well, something to figure out properly later on. + + #---------------------------------------------------------------------------- # Checking for various library functions and other definitions #---------------------------------------------------------------------------- @@ -1909,6 +1983,8 @@ cat<