summaryrefslogtreecommitdiffstats
path: root/kcontrol/fonts/configure.in.in
blob: 0ecc46d9138e0d4e144377970b52987a7d083ec1 (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
KDE_FIND_PATH(fontconfig-config, FONTCONFIG_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin], [
        KDE_FIND_PATH(pkg-config, PKGCONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin], [
            AC_MSG_WARN([Could not find neither pkg-config nor fontconfig-config, check http://www.fontconfig.org/ ])
        ])
])

if test -n "$PKGCONFIG"; then
  vers=`$PKGCONFIG fontconfig --modversion 2>/dev/null | sed -e 's/libfontconfig //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
  if test -n "$vers" && test "$vers" -ge 1000000
  then
     LIBFONTCONFIG_LIBS="`$PKGCONFIG fontconfig --libs`"
     LIBFONTCONFIG_RPATH=
     for args in $LIBFONTCONFIG_LIBS; do
          case $args in
            -L*)
               LIBFONTCONFIG_RPATH="$LIBFONTCONFIG_RPATH $args"
               ;;
          esac
     done
     LIBFONTCONFIG_RPATH=`echo $LIBFONTCONFIG_RPATH | sed -e "s/-L/-R/g"`
     LIBFONTCONFIG_CFLAGS="`$PKGCONFIG fontconfig --cflags`"

     AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
  fi
fi

if test -n "$FONTCONFIG_CONFIG"; then
  vers=`$FONTCONFIG_CONFIG --version 2>/dev/null | sed -e 's/libfontconfig //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
  if test -n "$vers" && test "$vers" -ge 1000000
  then
     LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
     LIBFONTCONFIG_RPATH=
     for args in $LIBFONTCONFIG_LIBS; do
          case $args in
            -L*)
               LIBFONTCONFIG_RPATH="$LIBFONTCONFIG_RPATH $args"
               ;;
          esac
     done
     LIBFONTCONFIG_RPATH=`echo $LIBFONTCONFIG_RPATH | sed -e "s/-L/-R/g"`
     LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"

     AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
  fi
fi

AC_SUBST(LIBFONTCONFIG_LIBS)
AC_SUBST(LIBFONTCONFIG_CFLAGS)
AC_SUBST(LIBFONTCONFIG_RPATH)

if pkg-config --exists freetype2 2>/dev/null; then
    FREETYPE2_CFLAGS=`pkg-config --cflags freetype2`
    FREETYPE2_LDFLAGS=`pkg-config --libs freetype2`
    AC_DEFINE(HAVE_FREETYPE2, 1, [Define if you have FreeType2 library])
fi
AC_SUBST(FREETYPE2_CFLAGS)
AC_SUBST(FREETYPE2_LDFLAGS)