]> granicus.if.org Git - graphviz/commitdiff
fix breakage caused by using fontconfig for dot -v
authorellson <devnull@localhost>
Tue, 24 Jul 2007 13:21:36 +0000 (13:21 +0000)
committerellson <devnull@localhost>
Tue, 24 Jul 2007 13:21:36 +0000 (13:21 +0000)
configure.ac
plugin/pango/Makefile.am
plugin/pango/gvtextlayout_pango.c

index c7af82a99fc13bef30c24e7f53537dae934f13a1..9cce7660a8dc6e8e20882543552599355737d31d 100644 (file)
@@ -1362,6 +1362,29 @@ AC_SUBST(PANGOCAIRO_LIBS)
 fi
 AM_CONDITIONAL(WITH_PANGOCAIRO, [test "x$HAVE_PANGOCAIRO" != "x"])
 
+dnl -----------------------------------
+dnl INCLUDES and LIBS for FONTCONFIG
+                                                                                
+AC_ARG_WITH(fontconfig,
+  [AC_HELP_STRING([--with-fontconfig],
+                  [use fontconfig library])])
+
+### default is to build with fontconfig
+if test "x$with_fontconfig" != "xno"; then
+       with_fontconfig=yes
+fi
+
+if test "x$with_fontconfig" = "xyes"; then
+PKG_CHECK_MODULES(FONTCONFIG, [fontconfig >= 1.0],
+       [HAVE_FONTCONFIG=1
+       AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG,1,
+               [Define if you have the fontconfig library])],
+       [AC_MSG_WARN(fontconfig library not available)])
+AC_SUBST(FONTCONFIG_CFLAGS)
+AC_SUBST(FONTCONFIG_LIBS)
+fi
+AM_CONDITIONAL(WITH_FONTCONFIG, [test "x$HAVE_FONTCONFIG" != "x"])
+
 dnl -----------------------------------
 dnl INCLUDES and LIBS for GTK.
 
@@ -1659,64 +1682,11 @@ dnl ----------------------------------
 dnl INCLUDES and LIBS for FONTCONFIG (only with mylibgd)
 
 if test "x$with_mylibgd" = "xyes"; then
-
-AC_ARG_WITH(fontconfig,
-  [AC_HELP_STRING([--with-fontconfig],
-                  [use fontconfig library])])
-
-### default is to build with fontconfig
-if test "x$with_fontconfig" != "xno"; then
-       with_fontconfig=yes
-fi
-
-if test "x$with_fontconfig" = "xyes"; then
-save_CPPFLAGS=$CPPFLAGS
-save_LDFLAGS=$LDFLAGS
-FC_INCLUDES=""
-FC_LIBS=""
-AC_PATH_PROG(FONTCONFIG_CONFIG,fontconfig-config)
-if test -n "$FONTCONFIG_CONFIG"; then
-        fc_cflags=`$FONTCONFIG_CONFIG --cflags`
-       if test "$fc_cflags" != "-I/usr/include" ; then
-               FC_INCLUDES="$fc_cflags"
-       fi
-       fc_prefix=`$FONTCONFIG_CONFIG --prefix`
-       if test "$fc_prefix" != "/usr" ; then
-               FC_LIBS="-L${fc_prefix}/lib"
-       fi
-fi
-
-PKG_CHECK_MODULES(FONTCONFIG, fontconfig,
-       [AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG,1,
-                 [Define if you have the fontconfig library])],
-       [AC_MSG_WARN(Optional fontconfig library not available)])
-
-if test "x$HAVE_FONTCONFIG" = "x1"; then
-       FC_INCLUDES=$(FONTCONFIG_INCLUDES)
-       FC_LIBS=$(FONTCONFIG_LIBS)
-fi
-
-AC_ARG_WITH(fontconfigincludedir,
-       [  --with-fontconfigincludedir=DIR use FONTCONFIG includes from DIR],
-       FC_INCLUDES="-I$withval")
-CPPFLAGS="$CPPFLAGS $FC_INCLUDES"
-AC_ARG_WITH(fontconfiglibdir,
-       [  --with-fontconfiglibdir=DIR use FONTCONFIG libraries from DIR],
-       [FC_LIBS="-L$withval"])
-LDFLAGS="$LDFLAGS $FC_LIBS"
-AC_CHECK_HEADERS(fontconfig/fontconfig.h)
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-       AC_CHECK_LIB(fontconfig,FcGetVersion,
-               [FC_LIBS="$FC_LIBS -lfontconfig"
-               AC_DEFINE_UNQUOTED(HAVE_GD_FONTCONFIG,1,[Define if the GD library has the GD_FONTCONFIG feature])
-
-               AC_DEFINE_UNQUOTED(HAVE_LIBFONTCONFIG,1,[Define if you have the FONTCONFIG library])],
-               [AC_MSG_WARN(Optional FONTCONFIG library not available - no libfontconfig.)])
-else
-       AC_MSG_WARN(Optional FONTCONFIG library not available - no fontconfig/fontconfig.h)
-fi
-CPPFLAGS=$save_CPPFLAGS
-LDFLAGS=$save_LDFLAGS
+if test "x$HAVE_FONTCONFIG" != "x"; then
+FC_INCLUDES="$FONTCONFIG_INCLUDES"
+FC_LIBS="$FONTCONFIG_LIBS"
+AC_DEFINE_UNQUOTED(HAVE_GD_FONTCONFIG,1,[Define if the GD library has the GD_FONTCONFIG feature])
+AC_DEFINE_UNQUOTED(HAVE_LIBFONTCONFIG,1,[Define if you have the FONTCONFIG library])],
 AC_SUBST(FC_INCLUDES)
 AC_SUBST(FC_LIBS)
 fi
index 2894c0f7de9f762ddd4b9528330475cb322db071..bfff02b07f8b72a91df0478f8db9fc21e145be53 100644 (file)
@@ -23,7 +23,7 @@ libgvplugin_pango_C_la_SOURCES = \
 
 libgvplugin_pango_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined
 libgvplugin_pango_la_SOURCES = $(libgvplugin_pango_C_la_SOURCES)
-libgvplugin_pango_la_LIBADD = @PANGOCAIRO_LIBS@ @MATH_LIBS@
+libgvplugin_pango_la_LIBADD = @PANGOCAIRO_LIBS@ @FONTCONFIG_LIBS@ @MATH_LIBS@
 
 EXTRA_DIST = Makefile.old
 
index 2da0e54f07d9d8eb28bb5b570d48ca20d60794be..297c57ab9c436d8747649c7b80f070f1970d25ce 100644 (file)
 #endif
 
 #include <string.h>
-#ifdef HAVE_FONTCONFIG
-#include <fontconfig/fontconfig.h>
-#endif
 #include "gvplugin_textlayout.h"
 
 #ifdef HAVE_PANGOCAIRO
 #include <pango/pangocairo.h>
+#ifdef HAVE_FONTCONFIG
+#include <fontconfig/fontconfig.h>
+#endif
 
 static void pango_free_layout (void *layout)
 {
@@ -88,6 +88,7 @@ static boolean pango_textlayout(GVCOMMON_t *common, textpara_t * para, char **fo
        desc = pango_font_description_from_string(fnt);
 
         if (fontpath) {  /* -v support */
+#ifdef HAVE_FONTCONFIG
            FcPattern *pat, *match;
            FcFontSet *fs;
            FcResult result;
@@ -122,6 +123,9 @@ static boolean pango_textlayout(GVCOMMON_t *common, textpara_t * para, char **fo
            }
             *fontpath = buf;
            FcFontSetDestroy(fs);
+#else
+           *fontpath = fnt;
+#endif
         }
     }
     pango_font_description_set_size (desc, (gint)(para->fontsize * PANGO_SCALE));