From a6038e4bd732bc30e4e55ab9e54bdc655095127b Mon Sep 17 00:00:00 2001
From: Phil Edworthy <phil.edworthy@renesas.com>
Date: Thu, 16 Dec 2010 11:57:16 +0000
Subject: [PATCH 3/4] sh772x: Use pkg-config to detect and use SH772x dependencies.


Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
 configure.in                  |    6 +++++-
 gfxdrivers/sh772x/Makefile.am |    6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/configure.in b/configure.in
index 01b6f2e..58110e8 100644
--- a/configure.in
+++ b/configure.in
@@ -1179,7 +1179,11 @@ if test "$checkfor_savage" = "yes" && test "$have_sysio" = "yes"; then
 fi
 
 if test "$checkfor_sh772x" = "yes" && test "$have_sh4" = "yes"; then
-  sh772x=yes
+  PKG_CHECK_MODULES([SH772X_DEP],
+    [uiomux >= 1.5.0 shbeu >= 1.0.2 shjpeg >= 1.3.1], [sh772x=yes], [sh772x=no])
+  if test "$sh772x" = "no"; then
+       AC_MSG_WARN([*** Missing UIOMUX, SHBEU or SHJPEG library -- sh772x driver will not be built.])
+  fi
 fi
 
 if test "$checkfor_sis315" = "yes"; then
diff --git a/gfxdrivers/sh772x/Makefile.am b/gfxdrivers/sh772x/Makefile.am
index 1e1dcb4..ccdedbc 100644
--- a/gfxdrivers/sh772x/Makefile.am
+++ b/gfxdrivers/sh772x/Makefile.am
@@ -50,13 +50,13 @@ libdirectfb_sh7722_la_SOURCES =	\
 	sh7722_types.h		\
 	sh7722_jpeg.c
 
+libdirectfb_sh7722_la_CFLAGS = $(SH772X_DEP_CFLAGS)
+
 libdirectfb_sh7722_la_LDFLAGS = \
 	-module			\
 	-avoid-version		\
 	$(DFB_LDFLAGS)		\
-	-lshbeu			\
-	-luiomux		\
-	-lshjpeg
+	$(SH772X_DEP_LIBS)
 
 libdirectfb_sh7722_la_LIBADD = \
 	$(top_builddir)/src/libdirectfb.la
-- 
1.7.1

