summaryrefslogtreecommitdiff
path: root/dev-libs/libg15render/files/libg15render-3.0.4-freetype_pkgconfig.patch
blob: 54a8fd4c07d37d364b2a562e1311af39b8c91c57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff --git a/configure.ac b/configure.ac
index 97338f3..a64f64c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,19 +13,41 @@ AC_PROG_CC
 LT_INIT
 
 # Checks for --enable args
-AC_MSG_CHECKING(whether to enable FreeType2 support)
-AC_ARG_ENABLE(ttf, [  --enable-ttf		enable FreeType2 support],
-	if [[[ "$enableval" = "yes" ]]]; then
-		AC_DEFINE(TTF_SUPPORT, [1], [Define to 1 to enable FreeType2 support])
-		CFLAGS="$CFLAGS `freetype-config --cflags`"
-		FTLIB="-lfreetype"
-		ttf_support="yes"
-	else
-		ttf_support="no"
-	fi,
-	ttf_support="no"
-)
-AC_MSG_RESULT($ttf_support)
+AC_ARG_ENABLE(ttf, [  --enable-ttf		enable FreeType2 support],,[enable_ttf=no])
+AS_IF([test "x$enable_ttf" != "xno"], [
+    m4_ifdef([PKG_PROG_PKG_CONFIG], [
+	PKG_PROG_PKG_CONFIG
+	PKG_CHECK_MODULES(FREETYPE, freetype2,
+		[
+			AC_DEFINE(TTF_SUPPORT, [1], [Define to 1 to enable FreeType2 support])
+			CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
+			FTLIB="$FREETYPE_LIBS"
+		], [
+			AS_IF([test "x$enable_ttf" = "xyes"], [
+				AC_MSG_ERROR([Cannot find freetype2])
+			])
+		])
+	], [
+		AC_MSG_CHECKING(whether to enable FreeType2 support)
+		AC_PATH_PROG([FTCONFIG], [freetype-config])
+		AS_IF([test -n "$FTCONFIG" ], [
+			CFLAGS="$CFLAGS `$FTCONFIG --cflags`"
+			FTLIB="-lfreetype"
+			AC_DEFINE(TTF_SUPPORT, [1])
+			AC_MSG_RESULT([yes])
+		], [
+			AS_IF([test "x$enable_ttf" = "xyes"], [
+				AC_MSG_ERROR([Cannot find freetype-config])
+			], [
+				AC_DEFINE(TTF_SUPPORT, [0])
+			])
+		])
+		AC_MSG_RESULT([no])
+	]
+    )
+], [
+	AC_MSG_RESULT(No Freetype is being used)
+])
 
 # Checks for libraries.
 AC_CHECK_LIB([g15], [writePixmapToLCD], ,AC_MSG_ERROR(["libg15 not found. please install it"]))