Subversion Repositories Scribus

Rev

Rev 1732 | Rev 2310 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
779 fschmid 1
# Original Author was Kalle@kde.org
2
# I lifted it in some mater. (Stephan Kulow)
3
# I used much code from Janos Farkas
4
 
5
dnl Process this file with autoconf to produce a configure script.
6
 
7
AC_INIT(acinclude.m4) dnl a source file from your sub dir
8
 
9
dnl This is so we can use kde-common
10
AC_CONFIG_AUX_DIR(admin)
11
 
12
AC_CANONICAL_SYSTEM
13
AC_ARG_PROGRAM
14
 
15
dnl Automake doc recommends to do this only here. (Janos)
16
AM_INIT_AUTOMAKE(scribus,1.3.0cvs)
17
 
18
dnl KDE_SET_PREFIX
19
 
20
AC_PREFIX_DEFAULT(/usr/local)
21
if test "x$prefix" = "xNONE"; then
22
  prefix=$ac_default_prefix
23
  ac_configure_args="$ac_configure_args --prefix $prefix"
24
fi
25
 
1592 craig 26
dnl Look for pkg-config, which we use to find fontconfig and
27
dnl will probably need for other things in future.
28
PKG_CONFIG=""
29
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
779 fschmid 30
 
31
LIBART_LIBS=""
32
LIBART_CFLAGS=""
33
LIBART_CONFIG=""
34
AC_PATH_PROG(LIBART_CONFIG, libart2-config,[AC_MSG_ERROR([Could not find libart anywhere, check http://www.levien.com/libart/], [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /usr/nekoware/bin /opt/local/bin])
35
])
36
if test -n "$LIBART_CONFIG"; then
37
  vers=`$LIBART_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
38
  if test -n "$vers" && test "$vers" -ge 2003008
39
  then
40
     LIBART_LIBS="`$LIBART_CONFIG --libs`"
41
     LIBART_CFLAGS="`$LIBART_CONFIG --cflags`"
42
     AC_DEFINE_UNQUOTED(HAVE_LIBART, 1, [Defines if your system has the libart library])
43
  else
44
     AC_MSG_ERROR([You need at least libart 2.3.8])
45
  fi
46
fi
47
AC_SUBST(LIBART_LIBS)
48
AC_SUBST(LIBART_CFLAGS)
49
AC_C_BIGENDIAN
50
 
1599 craig 51
dnl Check for freetype, which Scribus *requires* to build
779 fschmid 52
LIBFREETYPE_LIBS=""
53
LIBFREETYPE_CFLAGS=""
54
 
55
FREETYPE_CONFIG=""
56
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, [AC_MSG_ERROR([Could not find libfreetype anywhere, check http://www.freetype.org/])], [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
57
 
58
hafree=no
1599 craig 59
hafree_post213=
779 fschmid 60
if test -n "$FREETYPE_CONFIG"; then
61
	LIBFREETYPE_LIBS="`$FREETYPE_CONFIG --libs`"
1599 craig 62
	LIBFREETYPE_CFLAGS="`$FREETYPE_CONFIG --cflags`"
779 fschmid 63
	AC_CHECK_LIB(freetype, FT_Get_First_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
64
	AC_CHECK_LIB(freetype, FT_Get_Next_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
65
	if test $hafree = yes; then
66
		AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1, [Defines if your system has the libfreetype library])
67
	else
1599 craig 68
		AC_MSG_ERROR([You need at least freetype 2.1.0])
779 fschmid 69
	fi
1599 craig 70
 
71
	dnl Warn the user if they have less than freetype 2.1.3
72
	AC_MSG_CHECKING(freetype version > 2.1.3)
73
	SAVE_CFLAGS="${CFLAGS}"
74
	CFLAGS=" ${LIBFREETYPE_CFLAGS} "
75
	AC_TRY_COMPILE([
76
	#include <ft2build.h>
77
	#include FT_FREETYPE_H
78
	],[
79
	#if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 1 && FREETYPE_PATCH < 3
80
	#error freetype 2.1 older than 2.1.3
81
	#endif
82
	], [hafree_post213=yes], [hafree_post213=no])
83
	CFLAGS="${SAVE_CFLAGS}"
84
	AC_MSG_RESULT($hafree_post213)
85
	if test hafree_post213 = no; then
86
		AC_MSG_WARN([Freetype is older than 2.1.3])
87
	fi
88
 
89
	dnl Export the includes and lib path settings required to build with freetype.
779 fschmid 90
	AC_SUBST(LIBFREETYPE_LIBS)
91
	AC_SUBST(LIBFREETYPE_CFLAGS)
92
else
93
  AC_MSG_ERROR([You need at least freetype 2.1.0])
94
fi
95
 
1592 craig 96
dnl Try to find fontconfig using fontconfig-config or pkg-config.
1920 craig 97
hafontconfig=no
779 fschmid 98
LIBFONTCONFIG_LIBS=""
99
LIBFONTCONFIG_CFLAGS=""
100
FONTCONFIG_CONFIG=""
101
 
1920 craig 102
dnl Try to find fontconfig with pkg-config if we have pkg-config
103
AC_MSG_CHECKING([Checking for fontconfig with pkg-config])
104
if test -n "$PKG_CONFIG"; then
1592 craig 105
	LIBFONTCONFIG_LIBS="`$PKG_CONFIG fontconfig --libs`"
106
	LIBFONTCONFIG_CFLAGS="`$PKG_CONFIG fontconfig --cflags`"
1920 craig 107
	if test -n "$LIBFONTCONFIG_LIBS" || test -n "$LIBFONTCONFIG_CFLAGS"; then
108
		AC_MSG_RESULT([found])
109
	else
110
		AC_MSG_RESULT([not found])
111
	fi
779 fschmid 112
else
1920 craig 113
	AC_MSG_RESULT([failed: pkg-config not found])
779 fschmid 114
fi
1635 craig 115
 
1920 craig 116
dnl If fontconfig not found with pkg-config, try to find fontconfig-config
117
dnl and use that to look for fontconfig.
118
if test -z "$LIBFONTCONFIG_LIBS" && test -z "$LIBFONTCONFIG_CFLAGS"; then
119
	dnl Seems we didn't find fontconfig with pkg-config...
120
	AC_PATH_PROG(FONTCONFIG_CONFIG, fontconfig-config, [], [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
121
	if test -n "$FONTCONFIG_CONFIG"; then
122
		dnl found fontconfig-config, use it's results
123
		LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
124
		LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"
125
	else
126
		AC_MSG_WARN([Couldn't find fontconfig-config or find fontconfig with pkg-config])
127
	fi
128
fi
129
 
1635 craig 130
dnl Check to see if we can compile fontconfig
131
SAVE_CFLAGS="${CFLAGS}"
132
SAVE_LDFLAGS="${LDFLAGS}"
133
CFLAGS="${CFLAGS} ${LIBFONTCONFIG_CFLAGS}"
134
LDFLAGS="${LDFLAGS} ${LIBFONTCONFIG_LIBS}"
1592 craig 135
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
1635 craig 136
CFLAGS="${SAVE_CFLAGS}"
137
LDFLAGS="${SAVE_LDFLAGS}"
1592 craig 138
if test $hafontconfig = yes; then
139
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
140
else
141
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
142
fi
143
AC_SUBST(LIBFONTCONFIG_LIBS)
144
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 145
 
1592 craig 146
 
779 fschmid 147
XML_LIBS=""
148
XML_CFLAGS=""
149
 
150
XML_CONFIG=""
151
AC_PATH_PROG(XML_CONFIG, xml2-config, [AC_MSG_ERROR([Could not find libxml2 anywhere, check http://www.xmlsoft.org/])], [${PATH} ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
152
 
1599 craig 153
dnl check for LibXML2
779 fschmid 154
haxml=no
155
if test -n "$XML_CONFIG"; then
156
	XML_LIBS="`$XML_CONFIG --libs`"
157
	XML_CFLAGS="`$XML_CONFIG --cflags`"
158
	AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
159
	if test $haxml = yes; then
160
		AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
161
		AC_SUBST(XML_LIBS)
162
		AC_SUBST(XML_CFLAGS)
163
	fi
164
	vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
165
  	if test -n "$vers" && test "$vers" -ge 2006000
166
	then
167
		AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
168
	fi
169
fi
170
 
1599 craig 171
dnl check for -lsocket
779 fschmid 172
AC_CHECK_LIB(socket,socket,
173
if test "$uname" != "IRIX"; then
174
	LIBS="-lsocket $LIBS"
175
else
176
	echo "Not using -lsocket since you are running IRIX."
177
fi)
178
AC_CHECK_LIB(nsl,gethostbyaddr,
179
if test "$uname" != "IRIX"; then
180
	LIBS="-lnsl $LIBS"
181
else
182
	echo "Not using -lnsl since you are running IRIX."
183
fi)
184
LIBCUPS=""
185
hacups=
186
AC_CHECK_PROG(hacups, cups-config, yes)
187
if test x"$hacups" = x"yes"
188
then
189
	LIBCUPS="`cups-config --libs`"
190
	AC_SUBST(LIBCUPS)
191
fi
192
 
1595 craig 193
dnl Check for lcms
194
dnl TODO look for lcms using pkg-config too
779 fschmid 195
LIBLCMS=""
196
hacms=
197
AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
198
hacmsh=
1595 craig 199
lcms_h=
779 fschmid 200
AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
201
if test $hacmsh = no; then
202
	AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
203
	if test $hacmsh = yes; then
1595 craig 204
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
205
		lcms_h="lcms/lcms.h"
779 fschmid 206
	fi
207
else
1595 craig 208
	AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
209
	lcms_h="lcms.h"
779 fschmid 210
fi
1595 craig 211
if test $hacmsh = no; then
212
	dnl There's not much point finding -llcms if we can't find the header file...
213
	hacms=no
214
fi
215
dnl Attempt to check that lcms is new enough
216
if test $hacms = yes; then
217
	AC_MSG_CHECKING(liblcms version > 1.1.2)
218
	AC_TRY_COMPILE([
219
	#include "$lcms_h"
1599 craig 220
	],[
1595 craig 221
	#if LCMS_VERSION < 112
222
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
223
	#endif
1599 craig 224
	], [], [hacms=pre112])
1595 craig 225
	AC_MSG_RESULT($hacms)
226
fi
227
 
779 fschmid 228
AC_SUBST(LIBLCMS)
229
if test $hacms = yes && test $hacmsh = yes; then
230
 AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
231
fi
1580 craig 232
 
233
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 234
LIBTIFF=""
235
hastif=
1580 craig 236
dnl Check if we have libtiff
779 fschmid 237
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 238
if test $hastif = yes; then
239
	dnl Check for tiffvers.h
240
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
241
	if test $hastif = yes; then
242
		dnl Now attempt to check if libtiff is new enough
243
		AC_MSG_CHECKING(libtiff version > 3.6.0)
244
		AC_TRY_COMPILE([
245
		#include "tiffvers.h"
1599 craig 246
		],[
1585 craig 247
		#if TIFFLIB_VERSION < 20031007
248
		#error libtiff is too old, need libtiff 3.6.0 or newer.
249
		#endif
1599 craig 250
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 251
		AC_MSG_RESULT($hastif)
252
	fi
253
fi
779 fschmid 254
AC_SUBST(LIBTIFF)
255
if test $hastif = yes; then
256
 AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
257
fi
1580 craig 258
 
779 fschmid 259
LIBDL2=""
260
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
261
AC_SUBST(LIBDL2)
262
 
263
dnl generate the config header
264
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
265
 
266
dnl Checks for programs.
267
AC_CHECK_COMPILERS
268
AC_ENABLE_SHARED(yes)
269
AC_ENABLE_STATIC(no)
270
KDE_PROG_LIBTOOL
271
 
272
hapython=yes
273
kde_python_link_found=no
274
KDE_CHECK_PYTHON(1.5)
275
COMPILE_PYTHON=no
276
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
277
if test $kde_python_link_found = no; then
278
	COMPILE_PYTHON=no
279
fi
280
if test $kde_python_link_found = yes; then
281
  AC_CHECK_HEADER(python2.3/Python.h, [foo=""],[hapython=no])
282
   if test $hapython = yes; then
283
    AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
284
   fi
285
fi
286
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
287
 
288
AC_CHECK_HEADER(cups/cups.h, [foo=""],[hacups=no])
289
if test $hacups = yes; then
290
 AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
291
fi
292
 
293
COMPILE_DEBUG=no
294
AC_ARG_ENABLE(debug, [  --enable-debug     Enables Debug-Code],
1634 craig 295
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 296
	COMPILE_DEBUG=yes
297
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
298
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
299
fi])
300
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
301
 
1689 craig 302
dnl Compile and link the gdk-pixbuf sources unless building
303
dnl a Mac-native build.
304
AM_CONDITIONAL(LINK_PIXBUF, test "$enable_mac" != "yes" )
305
 
1699 craig 306
build_mac_bundle=no
307
AC_ARG_ENABLE(bundle, [  --enable-bundle     Make an executable suitable for use in a .app bundle],
308
[if test "$enable_bundle" = "yes"; then
309
	build_mac_bundle=yes
310
	AC_DEFINE_UNQUOTED(BUILD_MAC_BUNDLE, 1, [Are we building an executable to be included in MacOS/X .app bundle?])
311
fi])
312
AM_CONDITIONAL(BUILD_MAC_BUNDLE, test "$build_mac_bundle" = "yes")
313
 
1732 craig 314
dnl Some platforms require special libtool flags to build dynamically loadable
315
dnl modules or plugins correctly. While libtool should take care of this with
316
dnl a fixed set of arguments, in case we need to change it later this is being
317
dnl made a configure-time substitution.
318
MODULE_LINK_FLAGS=" -module "
319
AC_SUBST(MODULE_LINK_FLAGS)
320
 
779 fschmid 321
all_libraries="$all_libraries $USER_LDFLAGS"
322
all_includes="$all_includes $USER_INCLUDES"
323
AC_SUBST(all_includes)
324
AC_SUBST(all_libraries)
325
 
326
AC_PATH_QT
327