freesci-develop
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freesci-develop] Xft & autoconf trouble


From: Bas Zoetekouw
Subject: [freesci-develop] Xft & autoconf trouble
Date: Sat, 17 May 2003 22:30:18 +0200
User-agent: Mutt/1.4i
User-agent: Mutt/1.5.4i

Hi guys!

[I sent this message last week, too, but it seems it didn't arrive]

I had some problems building freesci against the latest libxft (see [1]
for an example).  It turns out that freesci doesn't use the correct
flags, and doesn't link against libfontconfig, for example.  

The patch below should solve this;  it introduces a new autoconf macro
PRG_CHECK_MODULES, which uses pkg-config to find the correct CFLAGS and
LDFLAGS.  It could probably be used for other things than just Xft, too.

I've only tested it on Debian, but as pkg-config seems to be a general
tool, this should work on all linux distributions at least.

[1] 
http://buildd.debian.org/fetch.php?&pkg=freesci&ver=0.3.4a-6&arch=s390&stamp=1052661084&file=log&as=raw

-- 
Kind regards,
+--------------------------------------------------------------------+
| Bas Zoetekouw              | GPG key: 0644fab7                     |
|----------------------------| Fingerprint: c1f5 f24c d514 3fec 8bf6 |
| address@hidden, address@hidden |              a2b1 2bae e41f 0644 fab7 |
+--------------------------------------------------------------------+ 

--- freesci-0.3.4a/acinclude.m4 2003-01-13 02:14:57.000000000 +0100
+++ freesci-0.3.4a.new/acinclude.m4     2003-05-11 21:12:53.000000000 +0200
@@ -930,3 +930,60 @@
   AC_MSG_RESULT(yes)
 fi], [AC_MSG_RESULT(yes)])
 ])
+
+
+## find flags to use for a certain library
+## taken from libxft2
+AC_DEFUN(PKG_CHECK_MODULES, [
+  succeeded=no
+
+  if test -z "$PKG_CONFIG"; then
+    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+  fi
+
+  if test "$PKG_CONFIG" = "no" ; then
+     echo "*** The pkg-config script could not be found. Make sure it is"
+     echo "*** in your path, or set the PKG_CONFIG environment variable"
+     echo "*** to the full path to pkg-config."
+     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get 
pkg-config."
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        AC_MSG_CHECKING(for $2)
+
+        if $PKG_CONFIG --exists "$2" ; then
+            AC_MSG_RESULT(yes)
+            succeeded=yes
+
+            AC_MSG_CHECKING($1_CFLAGS)
+            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+            AC_MSG_RESULT($$1_CFLAGS)
+
+            AC_MSG_CHECKING($1_LIBS)
+            $1_LIBS=`$PKG_CONFIG --libs "$2"`
+            AC_MSG_RESULT($$1_LIBS)
+        else
+            $1_CFLAGS=""
+            $1_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but 
+            ## do set a variable so people can do so.
+            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+            ifelse([$4], ,echo $$1_PKG_ERRORS,)
+        fi
+
+        AC_SUBST($1_CFLAGS)
+        AC_SUBST($1_LIBS)
+     else
+        echo "*** Your version of pkg-config is too old. You need version 
$PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig";
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     ifelse([$3], , :, [$3])
+  else
+     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider 
adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a 
nonstandard prefix so pkg-config can find them.]), [$4])
+  fi
+])
+
+
--- freesci-0.3.4a/configure.in 2003-01-27 01:07:59.000000000 +0100
+++ freesci-0.3.4a.new/configure.in     2003-05-11 21:40:31.000000000 +0200
@@ -136,9 +136,15 @@
 AC_PATH_XTRA
 
 if test x"$have_x" = xyes; then
-       AC_CHECK_HEADERS(X11/Xft/Xft.h)
-       AC_CHECK_HEADERS(X11/extensions/Xrender.h, [X_LIBS="$XLIBS -lXrender 
-lXft"])
        AC_CHECK_XSHM
+       AC_CHECK_HEADERS(X11/extensions/Xrender.h, [X_LIBS="$XLIBS -lXrender 
-lXft"])
+
+        PKG_CHECK_MODULES(XFT, xft)
+        X_LIBS="$X_LIBS $XFT_LIBS"
+        CFLAGS="$CFLAGS $XFT_CFLAGS"
+        CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
+
+       AC_CHECK_HEADERS(X11/Xft/Xft.h)
 fi
 
 AC_MSG_CHECKING(for Alpha hardware and gcc or ccc style __asm__)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]