summaryrefslogtreecommitdiffstats
path: root/configure.in.in
blob: 01eed7827a4836e29d33d6e504fe43ab5b0fe520 (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
#MIN_CONFIG(3.3)

KDE_ENABLE_HIDDEN_VISIBILITY

# Remember to synchronize the version number with the file koffice/lib/kofficecore/kofficeversion.h
AM_INIT_AUTOMAKE(koffice, "1.6.3")

CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"

AC_CHECK_HEADERS(unistd.h sys/param.h floatingpoint.h paths.h)
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN

KDE_INIT_DOXYGEN([The KOffice API Reference], [Version $VERSION])

# Check for GraphicsMagick...

have_graphicsmagick=no
KDE_FIND_PATH(GraphicsMagick-config, GRAPHICS_MAGICK_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [
  AC_MSG_WARN([Could not find GraphicsMagick anywhere, check http://www.graphicsmagick.org/ for GraphicsMagick >= 1.1.7.])
])

if test -n "$GRAPHICS_MAGICK_CONFIG"; then
 vers=`$GRAPHICS_MAGICK_CONFIG --version 2>/dev/null | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
  if test -n "$vers" && test "$vers" -ge 1001007;  then
     LIBGMAGICK_LIBS="`$GRAPHICS_MAGICK_CONFIG --libs`"
     LIBGMAGICK_LDFLAGS="`$GRAPHICS_MAGICK_CONFIG --ldflags`"
     LIBGMAGICK_RPATH=
     for args in $LIBGMAGICK_LIBS; do
	  case $args in
	    -L*)
  	       LIBGMAGICK_RPATH="$LIBMAGICK_RPATH $args"
 	       ;;
          esac
     done
     LIBGMAGICK_RPATH=`echo $LIBGMAGICK_RPATH | $SED -e "s/-L/-R/g"`
     LIBGMAGICK_CPPFLAGS="`$GRAPHICS_MAGICK_CONFIG --cppflags`"
     AC_DEFINE(HAVE_GMAGICK,1, [GraphicsMagick is available])
     have_graphicsmagick=yes
  else
     AC_MSG_WARN([You need at least GraphicsMagick 1.1.7])
  fi

fi

if test ! "$USE_RPATH" = "yes"; then
    LIBGMAGICK_RPATH=
fi

AC_SUBST(LIBGMAGICK_LIBS)
AC_SUBST(LIBGMAGICK_LDFLAGS)
AC_SUBST(LIBGMAGICK_CPPFLAGS)
AC_SUBST(LIBGMAGICK_RPATH)
AM_CONDITIONAL(include_graphicsmagick_filter, test "$have_graphicsmagick" = "yes" -a HAVE_GMAGICK)

# End of GraphicsMagick check

# Check for ImageMagick...

have_imagemagick=no
KDE_FIND_PATH(Magick-config, MAGICK_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [
  AC_MSG_WARN([Could not find ImageMagick anywhere, check http://www.imagemagick.org/ for ImageMagick >= 5.5.2.])
])

if test -n "$MAGICK_CONFIG"; then
  vers=`$MAGICK_CONFIG --version 2>/dev/null | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
  if test -n "$vers" && test "$vers" -ge 5005002 
  then
     if test "$vers" -ge 6000003
     then
        AC_DEFINE(HAVE_MAGICK6, 1, [ImageMagick Version 6])
     fi
     if test "$vers" -ge 6001000
     then
        AC_DEFINE(HAVE_MAGICK61, 1, [ImageMagick Version 6.1])
     fi
     LIBMAGICK_LIBS="`$MAGICK_CONFIG --libs`"
     LIBMAGICK_LDFLAGS="`$MAGICK_CONFIG --ldflags`"
     LIBMAGICK_RPATH=
     for args in $LIBMAGICK_LIBS; do
	  case $args in
	    -L*)
  	       LIBMAGICK_RPATH="$LIBMAGICK_RPATH $args"
 	       ;;
          esac
     done
     LIBMAGICK_RPATH=`echo $LIBMAGICK_RPATH | $SED -e "s/-L/-R/g"`
     LIBMAGICK_CPPFLAGS="`$MAGICK_CONFIG --cppflags`"
     AC_DEFINE(HAVE_MAGICK,1, [ImageMagick is available])
     have_imagemagick=yes
  else
     AC_MSG_WARN([You need at least ImageMagick 5.5.2])
  fi
fi

if test ! "$USE_RPATH" = "yes"; then
    LIBMAGICK_RPATH=
fi

AC_SUBST(LIBMAGICK_LIBS)
AC_SUBST(LIBMAGICK_LDFLAGS)
AC_SUBST(LIBMAGICK_CPPFLAGS)
AC_SUBST(LIBMAGICK_RPATH)
AM_CONDITIONAL(include_imagemagick_filter, test "$have_imagemagick" = "yes" -a HAVE_MAGICK61 -a ! "$have_graphicsmagick" = "yes" -a ! HAVE_GMAGICK)

# End of ImageMagick check

##########################################################################
# This last check is copied from kdenonbeta/gsf/configure.in.in
##########################################################################
# KOFFICE_PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
# defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
# also defines GSTUFF_PKG_ERRORS on error
# Note: This is specially tweaked for karbon's fontconfig check. Please fix
# it before using it for other tests :-)
AC_DEFUN([KOFFICE_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."
     echo "***"
     echo "*** Due to that we can't perform the check for fontconfig..."    # added for karbon (Werner)
  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                           # removed for karbon (Werner)
#    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
])

# --- Check for KDE 3.2 or 3.3 ---

AC_MSG_CHECKING([for KDE version])

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
tdeversion_save_CXXFLAGS="$CXXFLAGS"
tdeversion_safe_LIBS="$LIBS"
LIBS="$LIBS $X_EXTRA_LIBS"
CXXFLAGS="$CXXFLAGS $all_includes"

AC_COMPILE_IFELSE([
#include <tdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 2, 90 ) )
#error KDE 3.2
#endif
],
	need_trinity2_compat="no"
,
	need_trinity2_compat="yes"
)

AC_COMPILE_IFELSE([
#include <tdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 3, 90 ) )
#error KDE 3.3
#endif
],
	need_trinity3_compat="no"
,
	need_trinity3_compat="yes"
)

AC_COMPILE_IFELSE([
#include <tdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 4, 90 ) )
#error KDE 3.4
#endif
],
	need_trinity4_compat="no"
,
	need_trinity4_compat="yes"
)

AC_COMPILE_IFELSE([
#include <tdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 5, 2 ) )
#error KDE 3.5.x (x < 2)
#endif
],
	need_trinity51_compat="no"
,
	need_trinity51_compat="yes"
)
CXXFLAGS="$tdeversion_save_CXXFLAGS"
LIBS="$tdeversion_safe_LIBS"
AC_LANG_RESTORE

if test "$need_trinity2_compat" = "yes"; then
	AC_MSG_RESULT([KDE 3.2.x])
else
	if test "$need_trinity3_compat" = "yes"; then
		AC_MSG_RESULT([KDE 3.3.x])
	else 
		if test "$need_trinity4_compat" = "yes"; then
			AC_MSG_RESULT([KDE 3.4.x])
                else
                        if test "$need_trinity51_compat" = "yes"; then
                                AC_MSG_RESULT([KDE 3.5.x (x < 2)])
                        else
			        AC_MSG_RESULT([KDE 3.5.x (x >=2) or SVN trunk])
                        fi
		fi
	fi
fi

AM_CONDITIONAL(need_trinity2_compatibility, test "$need_trinity2_compat" = "yes")
AM_CONDITIONAL(need_trinity3_compatibility, test "$need_trinity3_compat" = "yes")
AM_CONDITIONAL(need_trinity4_compatibility, test "$need_trinity4_compat" = "yes")
AM_CONDITIONAL(need_trinity51_compatibility, test "$need_trinity51_compat" = "yes")

# Keep the old KDE 3.1 test, as long as it is still used
AM_CONDITIONAL(need_trinity1_compatibility, test "supported" = "no")

# --- End KDE 3.2 check ---

# --- OpenEXR check ---

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 pkg-config])
])

AC_MSG_CHECKING([for OpenEXR])

if test -n "$PKGCONFIG"; then
  vers=`$PKGCONFIG OpenEXR --modversion 2>/dev/null`
  if test -n "$vers"
  then
     OPENEXR_LIBS="`$PKGCONFIG OpenEXR --libs`"
     OPENEXR_RPATH=
     for args in $OPENEXR_LIBS; do
          case $args in
            -L*)
               OPENEXR_RPATH="$OPENEXR_RPATH $args"
               ;;
          esac
     done
     OPENEXR_RPATH=`echo $OPENEXR_RPATH | $SED -e "s/-L/-R/g"`
     OPENEXR_CFLAGS="`$PKGCONFIG OpenEXR --cflags`"

     AC_DEFINE_UNQUOTED(HAVE_OPENEXR, 1, [Defines if your system has the OpenEXR library])
  fi
fi

if test ! "$USE_RPATH" = "yes"; then
    OPENEXR_RPATH=
fi

if test -n "$OPENEXR_LIBS"
then
  AC_MSG_RESULT([yes])
else
  AC_MSG_RESULT([not found])
fi

AC_SUBST(OPENEXR_LIBS)
AC_SUBST(OPENEXR_CFLAGS)
AC_SUBST(OPENEXR_RPATH)

AM_CONDITIONAL(have_openexr, test -n "$OPENEXR_LIBS")

# --- End of OpenEXR check ---