Subversion Repositories Scribus

Rev

Rev 2312 | Rev 2398 | 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
2312 craig 59
hafree_post219=
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
 
2312 craig 71
	dnl Warn the user if they have less than freetype 2.1.9
72
	dnl Changed to fatal error
73
	AC_MSG_CHECKING(freetype version > 2.1.9)
1599 craig 74
	SAVE_CFLAGS="${CFLAGS}"
75
	CFLAGS=" ${LIBFREETYPE_CFLAGS} "
76
	AC_TRY_COMPILE([
77
	#include <ft2build.h>
78
	#include FT_FREETYPE_H
79
	],[
2312 craig 80
	#if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 1 && FREETYPE_PATCH < 9
81
	#error freetype 2.1 older than 2.1.9
1599 craig 82
	#endif
2312 craig 83
	], [hafree_post219=yes], [hafree_post219=no])
1599 craig 84
	CFLAGS="${SAVE_CFLAGS}"
2312 craig 85
	AC_MSG_RESULT($hafree_post219)
86
	if test hafree_post219 = no; then
87
		AC_MSG_WARN([Your libfreetype is too old - version 2.1.9 or newer strongly recommended])
1599 craig 88
	fi
89
 
90
	dnl Export the includes and lib path settings required to build with freetype.
779 fschmid 91
	AC_SUBST(LIBFREETYPE_LIBS)
92
	AC_SUBST(LIBFREETYPE_CFLAGS)
93
else
94
  AC_MSG_ERROR([You need at least freetype 2.1.0])
95
fi
96
 
1592 craig 97
dnl Try to find fontconfig using fontconfig-config or pkg-config.
1920 craig 98
hafontconfig=no
779 fschmid 99
LIBFONTCONFIG_LIBS=""
100
LIBFONTCONFIG_CFLAGS=""
101
FONTCONFIG_CONFIG=""
102
 
1920 craig 103
dnl Try to find fontconfig with pkg-config if we have pkg-config
104
AC_MSG_CHECKING([Checking for fontconfig with pkg-config])
105
if test -n "$PKG_CONFIG"; then
1592 craig 106
	LIBFONTCONFIG_LIBS="`$PKG_CONFIG fontconfig --libs`"
107
	LIBFONTCONFIG_CFLAGS="`$PKG_CONFIG fontconfig --cflags`"
1920 craig 108
	if test -n "$LIBFONTCONFIG_LIBS" || test -n "$LIBFONTCONFIG_CFLAGS"; then
109
		AC_MSG_RESULT([found])
110
	else
111
		AC_MSG_RESULT([not found])
112
	fi
779 fschmid 113
else
1920 craig 114
	AC_MSG_RESULT([failed: pkg-config not found])
779 fschmid 115
fi
1635 craig 116
 
1920 craig 117
dnl If fontconfig not found with pkg-config, try to find fontconfig-config
118
dnl and use that to look for fontconfig.
119
if test -z "$LIBFONTCONFIG_LIBS" && test -z "$LIBFONTCONFIG_CFLAGS"; then
120
	dnl Seems we didn't find fontconfig with pkg-config...
121
	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])
122
	if test -n "$FONTCONFIG_CONFIG"; then
123
		dnl found fontconfig-config, use it's results
124
		LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
125
		LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"
126
	else
127
		AC_MSG_WARN([Couldn't find fontconfig-config or find fontconfig with pkg-config])
128
	fi
129
fi
130
 
1635 craig 131
dnl Check to see if we can compile fontconfig
132
SAVE_CFLAGS="${CFLAGS}"
133
SAVE_LDFLAGS="${LDFLAGS}"
134
CFLAGS="${CFLAGS} ${LIBFONTCONFIG_CFLAGS}"
135
LDFLAGS="${LDFLAGS} ${LIBFONTCONFIG_LIBS}"
1592 craig 136
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
1635 craig 137
CFLAGS="${SAVE_CFLAGS}"
138
LDFLAGS="${SAVE_LDFLAGS}"
1592 craig 139
if test $hafontconfig = yes; then
140
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
141
else
142
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
143
fi
144
AC_SUBST(LIBFONTCONFIG_LIBS)
145
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 146
 
1592 craig 147
 
779 fschmid 148
XML_LIBS=""
149
XML_CFLAGS=""
150
 
151
XML_CONFIG=""
152
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])
153
 
1599 craig 154
dnl check for LibXML2
779 fschmid 155
haxml=no
2314 craig 156
haxml26=no
157
AC_ARG_ENABLE(xml, [  --disable-xml       Don't use libxml2 and turn off some Scribus features.], [disable_xml2="yes"])
158
if test "$disable_xml2" != "yes"; then
159
	if test -n "$XML_CONFIG"; then
160
		XML_LIBS="`$XML_CONFIG --libs`"
161
		XML_CFLAGS="`$XML_CONFIG --cflags`"
162
		AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
163
		if test $haxml = yes; then
164
			AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
165
			AC_SUBST(XML_LIBS)
166
			AC_SUBST(XML_CFLAGS)
167
		fi
168
		vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
169
		if test -n "$vers" && test "$vers" -ge 2006000
170
		then
171
			AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
172
			haxml26=yes
173
		fi
779 fschmid 174
	fi
175
fi
176
 
1599 craig 177
dnl check for -lsocket
779 fschmid 178
AC_CHECK_LIB(socket,socket,
179
if test "$uname" != "IRIX"; then
180
	LIBS="-lsocket $LIBS"
181
else
182
	echo "Not using -lsocket since you are running IRIX."
183
fi)
184
AC_CHECK_LIB(nsl,gethostbyaddr,
185
if test "$uname" != "IRIX"; then
186
	LIBS="-lnsl $LIBS"
187
else
188
	echo "Not using -lnsl since you are running IRIX."
189
fi)
190
 
1595 craig 191
dnl Check for lcms
192
dnl TODO look for lcms using pkg-config too
2310 craig 193
dnl TODO: convert to use --with-lcms= and AC_ARG_WITH(...)
779 fschmid 194
LIBLCMS=""
195
hacms=
2310 craig 196
AC_ARG_ENABLE(lcms, [  --disable-lcms     Don't use colour management (default=no)], [disable_lcms="yes"])
197
 
198
# If lcms hasn't been explicitly disabled, look for it and see
199
# if we can use it.
200
if test "$disable_lcms" != "yes"; then
201
	# See if liblcms.so is on our search path and looks vaguely valid
202
	AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
203
	hacmsh=
204
	lcms_h=
205
	# and search for lcms.h, which may or may not be in an lcms/ subdir
206
	AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
207
	if test $hacmsh = no; then
208
		AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
209
		if test $hacmsh = yes; then
210
			AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
211
			lcms_h="lcms/lcms.h"
212
		fi
213
	else
214
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
215
		lcms_h="lcms.h"
779 fschmid 216
	fi
2310 craig 217
	if test $hacmsh = no; then
218
		# There's not much point finding -llcms if we can't find the header file...
219
		hacms=no
220
	fi
779 fschmid 221
fi
1595 craig 222
dnl Attempt to check that lcms is new enough
223
if test $hacms = yes; then
224
	AC_MSG_CHECKING(liblcms version > 1.1.2)
225
	AC_TRY_COMPILE([
226
	#include "$lcms_h"
1599 craig 227
	],[
1595 craig 228
	#if LCMS_VERSION < 112
229
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
230
	#endif
1599 craig 231
	], [], [hacms=pre112])
1595 craig 232
	AC_MSG_RESULT($hacms)
233
fi
234
 
779 fschmid 235
AC_SUBST(LIBLCMS)
236
if test $hacms = yes && test $hacmsh = yes; then
237
 AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
238
fi
1580 craig 239
 
240
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 241
LIBTIFF=""
242
hastif=
1580 craig 243
dnl Check if we have libtiff
779 fschmid 244
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 245
if test $hastif = yes; then
246
	dnl Check for tiffvers.h
247
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
248
	if test $hastif = yes; then
249
		dnl Now attempt to check if libtiff is new enough
250
		AC_MSG_CHECKING(libtiff version > 3.6.0)
251
		AC_TRY_COMPILE([
252
		#include "tiffvers.h"
1599 craig 253
		],[
1585 craig 254
		#if TIFFLIB_VERSION < 20031007
255
		#error libtiff is too old, need libtiff 3.6.0 or newer.
256
		#endif
1599 craig 257
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 258
		AC_MSG_RESULT($hastif)
259
	fi
260
fi
779 fschmid 261
AC_SUBST(LIBTIFF)
262
if test $hastif = yes; then
263
 AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
264
fi
1580 craig 265
 
779 fschmid 266
LIBDL2=""
267
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
268
AC_SUBST(LIBDL2)
269
 
270
dnl generate the config header
271
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
272
 
273
dnl Checks for programs.
274
AC_CHECK_COMPILERS
275
AC_ENABLE_SHARED(yes)
276
AC_ENABLE_STATIC(no)
277
KDE_PROG_LIBTOOL
278
 
279
hapython=yes
280
kde_python_link_found=no
281
KDE_CHECK_PYTHON(1.5)
282
COMPILE_PYTHON=no
283
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
284
if test $kde_python_link_found = no; then
285
	COMPILE_PYTHON=no
286
fi
287
if test $kde_python_link_found = yes; then
288
  AC_CHECK_HEADER(python2.3/Python.h, [foo=""],[hapython=no])
289
   if test $hapython = yes; then
290
    AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
291
   fi
292
fi
293
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
294
 
2311 craig 295
AC_ARG_ENABLE(cups, [  --disable-cups        Do not compile support for CUPS printing],[disable_cups=yes])
296
LIBCUPS=""
297
hacups=no
298
if test "$disable_cups" != "yes" ; then
299
	# Look for cups.h
300
	AC_CHECK_HEADER(cups/cups.h, [hacups_h=yes],[hacups_h=no])
301
	AC_CHECK_PROG(hacups_cfg, cups-config, yes, no)
302
	echo "'$hacups_cfg' '$hacups_h'" >/tmp/cfg
303
	if test "x$hacups_h" = "xyes" && test "x$hacups_cfg" = "xyes"; then
304
		# We have the CUPS libs and headers, so enable
305
		# the use of CUPS and tell the build where to
306
		# find it.
307
		LIBCUPS="`cups-config --libs`"
308
		AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
309
		AC_SUBST(LIBCUPS)
310
		hacups=yes
311
	else
312
		AC_MSG_WARN([libcups could not be found. Printing functionality will be limited.])
313
		hacups=no
314
	fi
315
else
316
	hacups=no
779 fschmid 317
fi
318
 
319
COMPILE_DEBUG=no
2311 craig 320
AC_ARG_ENABLE(debug, [  --enable-debug     Enables debugging information (recommended for snapshots)],
1634 craig 321
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 322
	COMPILE_DEBUG=yes
323
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
324
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
325
fi])
326
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
327
 
1689 craig 328
dnl Compile and link the gdk-pixbuf sources unless building
329
dnl a Mac-native build.
330
AM_CONDITIONAL(LINK_PIXBUF, test "$enable_mac" != "yes" )
331
 
1699 craig 332
build_mac_bundle=no
2311 craig 333
AC_ARG_ENABLE(bundle, [  --enable-bundle     Make an executable suitable for use in a .app bundle (INCOMPLETE)],
1699 craig 334
[if test "$enable_bundle" = "yes"; then
335
	build_mac_bundle=yes
336
	AC_DEFINE_UNQUOTED(BUILD_MAC_BUNDLE, 1, [Are we building an executable to be included in MacOS/X .app bundle?])
337
fi])
338
AM_CONDITIONAL(BUILD_MAC_BUNDLE, test "$build_mac_bundle" = "yes")
339
 
1732 craig 340
dnl Some platforms require special libtool flags to build dynamically loadable
341
dnl modules or plugins correctly. While libtool should take care of this with
342
dnl a fixed set of arguments, in case we need to change it later this is being
343
dnl made a configure-time substitution.
344
MODULE_LINK_FLAGS=" -module "
345
AC_SUBST(MODULE_LINK_FLAGS)
346
 
779 fschmid 347
all_libraries="$all_libraries $USER_LDFLAGS"
348
all_includes="$all_includes $USER_INCLUDES"
349
AC_SUBST(all_includes)
350
AC_SUBST(all_libraries)
351
 
352
AC_PATH_QT
353