summaryrefslogtreecommitdiffstats
path: root/kcontrol/tdefontinst/configure.in.in
blob: df6d3d34c8e7a8d2269bd9df4f2017ec4d70046c (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
FONTINST_SUBDIR=""
FONTINST_TN=""

# Check for FreeType...
KFI_FOUND_FREETYPE=0

KDE_FIND_PATH(freetype-config, FREETYPE_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin], [
              AC_MSG_WARN([Could not find libfreetype anywhere, check http://www.freetype.org/])
             ])

if test -n "$FREETYPE_CONFIG"; then
    vers=`$FREETYPE_CONFIG --version 2>/dev/null | sed -e 's/libfreetype //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
    if test -n "$vers" && test "$vers" -ge 9002003
    then
        LIBFREETYPE_LIBS="`$FREETYPE_CONFIG --libs`"
        LIBFREETYPE_RPATH=
        for args in $LIBFREETYPE_LIBS; do
            case $args in
                -L*)
                LIBFREETYPE_RPATH="$LIBFREETYPE_RPATH $args"
                ;;
            esac
        done
        LIBFREETYPE_RPATH=`echo $LIBFREETYPE_RPATH | sed -e "s/-L/-R/g"`
        LIBFREETYPE_CFLAGS="`$FREETYPE_CONFIG --cflags`"
        KFI_FOUND_FREETYPE=1
    else
        AC_MSG_WARN([You need at least FreeType 2.1.3])
    fi
fi

if test "$KFI_FOUND_FREETYPE" -eq 1; then
    AC_SUBST(LIBFREETYPE_LIBS)
    AC_SUBST(LIBFREETYPE_CFLAGS)
    AC_SUBST(LIBFREETYPE_RPATH)

    KFI_FOUND_FONTCONFIG=0
    # check for fontconfig...
    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 2000000 ; 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`"
            KFI_FOUND_FONTCONFIG=1
        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 2000000 ; 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`"
            KFI_FOUND_FONTCONFIG=1
        fi
    fi

    if test "$KFI_FOUND_FONTCONFIG" -eq 1; then
        AC_SUBST(LIBFONTCONFIG_LIBS)
        AC_SUBST(LIBFONTCONFIG_CFLAGS)
        AC_SUBST(LIBFONTCONFIG_RPATH)

        # Check OS...
        AC_MSG_CHECKING([OS])
        case "$host" in
            *-*-linux*) UNAME='Linux' ;;
            *-*-freebsd*) UNAME='FreeBSD' ;;
            *-*-kfreebsd-gnu*) UNAME='GNU/kFreeBSD' ;;
            *-*-netbsd*) UNAME='NetBSD' ;;
            *-*-solaris*) UNAME='Solaris' ;;
            *-*-irix*) UNAME='Irix' ;;
            *-*-aix*) UNAME='AIX' ;;
            *-*-hpux*) UNAME='HPUX' ;;
            *-*-darwin*) UNAME='Darwin' ;;
            *) UNAME='Unknown' ;;
            esac
                AC_MSG_RESULT($UNAME)
        AC_SUBST(UNAME)

        # Check for fontenc...
        ac_font_enc_headers=0
        KDE_CHECK_HEADER(X11/fonts/fontenc.h,[ac_font_enc_headers=1])
        if test "$ac_font_enc_headers" = "0"; then
            AC_MSG_WARN(FontEnc headers not found. FontEnc support disabled)
        else
            ac_LDFLAGS_save="$LDFLAGS"
            ld_shared_flag=
            KDE_CHECK_COMPILER_FLAG(shared, [ld_shared_flag="-shared"])
            LDFLAGS="$LDFLAGS $ld_shared_flag $all_libraries -lz"
            KDE_CHECK_LIB(fontenc,FontEncDirectory,ac_font_enc_lib=1,ac_font_enc_lib=0)
            if test "$ac_font_enc_lib" = "1"; then
                LIB_FONT_ENC="-lfontenc"
                AC_DEFINE(HAVE_FONT_ENC, 1, [Defines if you have FontEnc])
            fi
            LDFLAGS="$ac_LDFLAGS_save"
        fi
        AC_SUBST(LIB_FONT_ENC)

        FONTINST_SUBDIR="kfontinst"
        # Check for Xft...
        ac_xft_headers=0
        ac_CXXFLAGS_save="$CXXFLAGS"
        ac_CFLAGS_save="$CFLAGS"
        ac_CPPFLAGS_save="$CPPFLAGS"
        CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $LIBFREETYPE_CFLAGS"
        CFLAGS="$CXXFLAGS"
        CPPFLAGS="$CXXFLAGS"
        
        AC_CHECK_HEADER(X11/Xft/Xft.h, [ac_xft_headers=1])
        if test "$ac_xft_headers" -eq 1 ; then
            LIBXFT_LIB=-lXft
            AC_SUBST(LIBXFT_LIB)
        else
            AC_MSG_WARN([Missing Xft headers - disabling font previews!])
        fi
        CXXFLAGS="$ac_CXXFLAGS_save"
        CFLAGS="$ac_CFLAGS_save"
        CPPFLAGS="$ac_CPPFLAGS_save"
    else
        AC_MSG_WARN([Missing FontConfig - disabling kfontinst!])
    fi
else
    AC_MSG_WARN([Missing FreeType2 - disabling kfontinst!])
fi

AM_CONDITIONAL(include_fontinst_tn, test "$ac_xft_headers" -eq 1)

if test "$ac_xft_headers" -eq 1 ; then
    AC_DEFINE(HAVE_XFT, 1, [Defines if you have Xft])
fi

AM_CONDITIONAL(include_kcontrol_kfontinst, test -n "$FONTINST_SUBDIR")