writing a patch to use pkg-config to determine CFLAGS/LDFLAGS for libspiro, libuninameslist

suzuki toshiya <[email protected]> Wed, 27 Apr 2016 12:03:24 +0900
Newsgroups gmane.comp.fonts.fontforge.devel
Message-ID <[email protected]>
Hi,

Just yesterday I found that the latest fontforge configure
script could not configure CFLAGS/LDFLAGS for libspiro and
libuninameslist appropriately, if they are installed in
irregular directories (the directories which CC does not
search by default).

Fortunately, fontforge's configure has already adopted the
use of pkg-config, and both libraries provide pkg-config
database. So, I could made a small patch for configure to
try pkg-config for these libraries, as pasted at the end
of this post.

I think it could useful to help the people who wants to
build fontforge and required libraries at once, in same
directory structure (e.g. fontforge-latest/libspiro/...).

Yet I'm unfamiliar with the convention of ff-specific
autoconf macro. I wish if anybody help me to improve the
patch to the level considerable to be applied in main
trunk.

Regards,
mpsuzuki

---
diff --git a/configure.ac b/configure.ac
index ee9b6e4..325fb2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -382,8 +382,54 @@ FONTFORGE_ARG_WITH_LIBJPEG
 FONTFORGE_ARG_WITH_LIBPNG
 FONTFORGE_ARG_WITH_LIBTIFF
 FONTFORGE_ARG_WITH_CAIRO # do this test only 'after' zlib and png checks
-FONTFORGE_ARG_WITH_LIBSPIRO
-FONTFORGE_ARG_WITH_LIBUNINAMESLIST
+PKG_CHECK_MODULES([libspiro],[libspiro],
+	[
+		i_do_have_libspiro="yes"
+		LIBSPIRO_CPPFLAGS=`$PKG_CONFIG --cflags libspiro`
+		LIBSPIRO_CFLAGS="${LIBSPIRO_CPPFLAGS}"
+		LIBSPIRO_LDFLAGS=`$PKG_CONFIG --libs-only-other --libs-only-L libspiro`
+		LIBSPIRO_LIBS=`$PKG_CONFIG --libs libspiro`
+		orig_CPPFLAGS="${CFLAGS}"
+		orig_CFLAGS="${CFLAGS}"
+		orig_LDFLAGS="${LDFLAGS}"
+		orig_LIBS="${LIBS}"
+		CPPFLAGS="${orig_CFLAGS} ${LIBSPIRO_CPPFLAGS}"
+		CFLAGS="${orig_CFLAGS} ${LIBSPIRO_CFLAGS}"
+		LDFLAGS="${orig_LDFLAGS} ${LIBSPIRO_LDFLAGS}"
+		LIBS="${orig_LIBS} ${LIBSPIRO_LDFLAGS}"
+		FONTFORGE_ARG_WITH_LIBSPIRO
+		CPPFLAGS="${orig_CFLAGS}"
+		CFLAGS="${orig_CFLAGS}"
+		LDFLAGS="${orig_LDFLAGS}"
+		LIBS="${orig_LIBS}"
+	],
+	[
+		FONTFORGE_ARG_WITH_LIBSPIRO
+	])
+PKG_CHECK_MODULES([libuninameslist],[libuninameslist],
+	[
+		i_do_have_libspiro="yes"
+		LIBUNINAMESLIST_CPPFLAGS=`$PKG_CONFIG --cflags libuninameslist`
+		LIBUNINAMESLIST_CFLAGS="${LIBUNINAMESLIST_CPPFLAGS}"
+		LIBUNINAMESLIST_LDFLAGS=`$PKG_CONFIG --libs-only-other --libs-only-L
libuninameslist`
+		LIBUNINAMESLIST_LIBS=`$PKG_CONFIG --libs libuninameslist`
+		orig_CPPFLAGS="${CFLAGS}"
+		orig_CFLAGS="${CFLAGS}"
+		orig_LDFLAGS="${LDFLAGS}"
+		orig_LIBS="${LIBS}"
+		CPPFLAGS="${orig_CFLAGS} ${LIBUNINAMESLIST_CPPFLAGS}"
+		CFLAGS="${orig_CFLAGS} ${LIBUNINAMESLIST_CFLAGS}"
+		LDFLAGS="${orig_LDFLAGS} ${LIBUNINAMESLIST_LDFLAGS}"
+		LIBS="${orig_LIBS} ${LIBUNINAMESLIST_LDFLAGS}"
+		FONTFORGE_ARG_WITH_LIBUNINAMESLIST
+		CPPFLAGS="${orig_CFLAGS}"
+		CFLAGS="${orig_CFLAGS}"
+		LDFLAGS="${orig_LDFLAGS}"
+		LIBS="${orig_LIBS}"
+	],
+	[
+		FONTFORGE_ARG_WITH_LIBUNINAMESLIST
+	])
 #FONTFORGE_ARG_WITH_LIBUNICODENAMES
 FONTFORGE_ARG_WITH_ZEROMQ
 FONTFORGE_ARG_WITH_LIBREADLINE


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
fontforge-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html