Attempt to determine the correct {ACLOCAL,PKG_CONFIG}_PATH.

This commit is contained in:
Dag-Erling Smørgrav 2018-08-03 13:53:34 +02:00
parent 6bd043cac5
commit 5836c338bc

View file

@ -4,6 +4,20 @@ has() {
which "$@" >/dev/null 2>&1 which "$@" >/dev/null 2>&1
} }
# Evaluate any envar assignments present on the command line
for arg ; do
case "${arg}" in
--prefix=*)
PREFIX="${arg#*=}"
export PREFIX
;;
CC=*|CXX=*|CPP=*|PREFIX=*)
eval "${arg}"
export "${arg%%=*}"
;;
esac
done
# BullseyeCoverage needs to know exactly which compiler we're using # BullseyeCoverage needs to know exactly which compiler we're using
if has "${CC}" "${CXX}" ; then if has "${CC}" "${CXX}" ; then
echo "using CC=${CC}" echo "using CC=${CC}"
@ -19,10 +33,27 @@ else
echo "WARNING: using default compiler," \ echo "WARNING: using default compiler," \
"coverage analysis may not work" "coverage analysis may not work"
fi fi
export CPP="${CPP:-${CC} -E}" if [ -n "${CC}" ] ; then
export CPP="${CPP:-${CC} -E}"
fi
# If a prefix was provided, look for autoconf and pkg-config directories
if [ -n "${PREFIX}" ] ; then
if [ -f "${PREFIX}/share/aclocal/cryb_to.m4" ] ; then
export ACLOCAL_PATH="${PREFIX}/share/aclocal:${ACLOCAL_PATH}"
ACLOCAL_PATH="${ACLOCAL_PATH%:}"
export ACLOCAL_PATH
fi
if [ -f "${PREFIX}/lib/pkgconfig/cryb-core.pc" ] ; then
PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"
PKG_CONFIG_PATH="${PKG_CONFIG_PATH%:}"
export PKG_CONFIG_PATH
fi
fi
set -e set -e
# Push coverage state and disable
if has cov01 ; then if has cov01 ; then
cov01 -qu cov01 -qu
cov01 -q0 cov01 -q0
@ -31,11 +62,13 @@ fi
. ./autogen.sh . ./autogen.sh
./configure \ ./configure \
${PREFIX:+--prefix="${PREFIX}"} \
--enable-all \ --enable-all \
--enable-developer-warnings \ --enable-developer-warnings \
--enable-werror \ --enable-werror \
"$@" "$@"
# Restore coverage state
if has cov01 ; then if has cov01 ; then
cov01 -qo cov01 -qo
fi fi