From baa86bb3f97bedb90eba7a2ede23532c4319a8d8 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 12 Jul 2021 10:29:50 +0300
Subject: [PATCH] make sure the system harfbuzz library was built with FreeType
support.
---
configure | 42 +++++++++++++++++++++++++++++++++++++++---
configure.ac | 24 ++++++++++++++++++++++--
2 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/configure b/configure
index 4ba16cf..9d2817c 100755
--- a/configure
+++ b/configure
@@ -16893,7 +16893,7 @@ $as_echo "$as_me: WARNING:
FT2_CFLAGS=""
FT2_LIBS=""
- as_fn_error $? "*** Unable to find FreeType2 library (http://www.freetype.org/)" "$LINENO" 5
+ as_fn_error $? "*** Unable to find FreeType2 library (https://www.freetype.org)" "$LINENO" 5
fi
@@ -17204,7 +17204,7 @@ $as_echo "$as_me: WARNING:
FT2_CFLAGS=""
FT2_LIBS=""
- as_fn_error $? "*** Unable to find FreeType2 library (http://www.freetype.org/)" "$LINENO" 5
+ as_fn_error $? "*** Unable to find FreeType2 library (https://www.freetype.org)" "$LINENO" 5
fi
@@ -18365,6 +18365,42 @@ $as_echo "yes" >&6; }
harfbuzz=yes
fi
+ if test x$harfbuzz = xyes; then
+ save_CFLAGS="$CFLAGS"
+ save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $HB_CFLAGS"
+ LIBS="$LIBS $HB_LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype support in harfbuzz" >&5
+$as_echo_n "checking for freetype support in harfbuzz... " >&6; }
+ harbuzz_has_freetype=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ void* hb_ft_font_create(void*, void*);
+ return !hb_ft_font_create((void*)0,(void*)0);
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ harbuzz_has_freetype=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $harbuzz_has_freetype" >&5
+$as_echo "$harbuzz_has_freetype" >&6; }
+ if test x$harbuzz_has_freetype = xno; then
+ harfbuzz=no
+ as_fn_error $? "*** HarfBuzz library was built without FreeType support.)" "$LINENO" 5
+ fi
+ fi
if test x$harfbuzz = xyes; then
$as_echo "#define TTF_USE_HARFBUZZ 1" >>confdefs.h
@@ -18372,7 +18408,7 @@ fi
TTF_LIBS="$TTF_LIBS $HB_LIBS"
SUMMARY="${SUMMARY}Using harfbuzz : YES\n"
else
- as_fn_error $? "*** Unable to find HarfBuzz library (http://www.freetype.org/)" "$LINENO" 5
+ as_fn_error $? "*** Unable to find HarfBuzz library (https://harfbuzz.github.io)" "$LINENO" 5
fi
fi
else
diff --git a/configure.ac b/configure.ac
index ecb174f..a2525b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,7 +110,7 @@ if test x$enable_freetype_builtin = xyes; then
else
PKG_CHECK_MODULES([FT2], [freetype2 >= 7.0.1], [], [dnl
AC_CHECK_FT2(,,[AC_MSG_ERROR([dnl
-*** Unable to find FreeType2 library (http://www.freetype.org/)])]
+*** Unable to find FreeType2 library (https://www.freetype.org)])]
)
])
TTF_CFLAGS="$TTF_CFLAGS $FT2_CFLAGS"
@@ -155,6 +155,26 @@ if test x$enable_harfbuzz = xyes; then
SUMMARY="${SUMMARY}Using included HarfBuzz : NO\n"
PKG_CHECK_MODULES([HB], [harfbuzz >= 2.3.1], harfbuzz=yes, harfbuzz=no)
+ if test x$harfbuzz = xyes; then
+ save_CFLAGS="$CFLAGS"
+ save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $HB_CFLAGS"
+ LIBS="$LIBS $HB_LIBS"
+ AC_MSG_CHECKING(for freetype support in harfbuzz)
+ harbuzz_has_freetype=no
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[
+ void* hb_ft_font_create(void*, void*);
+ return !hb_ft_font_create((void*)0,(void*)0);]])
+ ], [harbuzz_has_freetype=yes])
+ CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ AC_MSG_RESULT($harbuzz_has_freetype)
+ if test x$harbuzz_has_freetype = xno; then
+ harfbuzz=no
+ AC_MSG_ERROR([dnl
+*** HarfBuzz library was built without FreeType support.)])
+ fi
+ fi
if test x$harfbuzz = xyes; then
AC_DEFINE(TTF_USE_HARFBUZZ, 1, [])
TTF_CFLAGS="$TTF_CFLAGS $HB_CFLAGS"
@@ -162,7 +182,7 @@ if test x$enable_harfbuzz = xyes; then
SUMMARY="${SUMMARY}Using harfbuzz : YES\n"
else
AC_MSG_ERROR([dnl
-*** Unable to find HarfBuzz library (http://www.freetype.org/)])
+*** Unable to find HarfBuzz library (https://harfbuzz.github.io)])
fi
fi
else