From a416c989801cfc803f74dfb6f0e770bb6f4d87fc Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 28 Oct 2017 19:20:06 +0200 Subject: CONFIGURE: Handle freetype-config SYSROOT duplication in prefix Since version 2.3.12, freetype-config adds SYSROOT to all paths. If we pass a --prefix that already includes SYSROOT, this will return a duplicate SYSROOT. This patch detects that and adjusts prefix accordingly. --- configure | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 08480b76c8..cd79adfce6 100755 --- a/configure +++ b/configure @@ -4615,8 +4615,19 @@ if test "$_freetype2" != "no"; then if test -z "$_freetypeconfig"; then _freetype2=no else - FREETYPE2_LIBS=`$_freetypeconfig --prefix="$_freetypepath" --libs` - FREETYPE2_CFLAGS=`$_freetypeconfig --prefix="$_freetypepath" --cflags` + # Since 2.3.12, freetype-config prepends $SYSROOT to everything. + # This means we can't pass it a --prefix that includes $SYSROOT. + freetypeprefix="$_freetypepath" + if test -n "$SYSROOT" -a "$SYSROOT" != "/"; then + teststring=VeryImplausibleSysrootX1Y2Z3 + if ( env SYSROOT=/$teststring "$_freetypeconfig" --cflags | grep $teststring 2> /dev/null > /dev/null ); then + echo "Adapting FreeType prefix to SYSROOT" >> "$TMPLOG" + freetypeprefix="${freetypeprefix##$SYSROOT}" + fi + fi + + FREETYPE2_LIBS=`$_freetypeconfig --prefix="$freetypeprefix" --libs` + FREETYPE2_CFLAGS=`$_freetypeconfig --prefix="$freetypeprefix" --cflags` if test "$_freetype2" = "auto"; then _freetype2=no -- cgit v1.2.3