Subversion Repositories Scribus

Rev

Rev 2311 | Rev 2314 | 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
156
if test -n "$XML_CONFIG"; then
157
	XML_LIBS="`$XML_CONFIG --libs`"
158
	XML_CFLAGS="`$XML_CONFIG --cflags`"
159
	AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
160
	if test $haxml = yes; then
161
		AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
162
		AC_SUBST(XML_LIBS)
163
		AC_SUBST(XML_CFLAGS)
164
	fi
165
	vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
166
  	if test -n "$vers" && test "$vers" -ge 2006000
167
	then
168
		AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
169
	fi
170
fi
171
 
1599 craig 172
dnl check for -lsocket
779 fschmid 173
AC_CHECK_LIB(socket,socket,
174
if test "$uname" != "IRIX"; then
175
	LIBS="-lsocket $LIBS"
176
else
177
	echo "Not using -lsocket since you are running IRIX."
178
fi)
179
AC_CHECK_LIB(nsl,gethostbyaddr,
180
if test "$uname" != "IRIX"; then
181
	LIBS="-lnsl $LIBS"
182
else
183
	echo "Not using -lnsl since you are running IRIX."
184
fi)
185
 
1595 craig 186
dnl Check for lcms
187
dnl TODO look for lcms using pkg-config too
2310 craig 188
dnl TODO: convert to use --with-lcms= and AC_ARG_WITH(...)
779 fschmid 189
LIBLCMS=""
190
hacms=
2310 craig 191
AC_ARG_ENABLE(lcms, [  --disable-lcms     Don't use colour management (default=no)], [disable_lcms="yes"])
192
 
193
# If lcms hasn't been explicitly disabled, look for it and see
194
# if we can use it.
195
if test "$disable_lcms" != "yes"; then
196
	# See if liblcms.so is on our search path and looks vaguely valid
197
	AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
198
	hacmsh=
199
	lcms_h=
200
	# and search for lcms.h, which may or may not be in an lcms/ subdir
201
	AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
202
	if test $hacmsh = no; then
203
		AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
204
		if test $hacmsh = yes; then
205
			AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
206
			lcms_h="lcms/lcms.h"
207
		fi
208
	else
209
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
210
		lcms_h="lcms.h"
779 fschmid 211
	fi
2310 craig 212
	if test $hacmsh = no; then
213
		# There's not much point finding -llcms if we can't find the header file...
214
		hacms=no
215
	fi
779 fschmid 216
fi
1595 craig 217
dnl Attempt to check that lcms is new enough
218
if test $hacms = yes; then
219
	AC_MSG_CHECKING(liblcms version > 1.1.2)
220
	AC_TRY_COMPILE([
221
	#include "$lcms_h"
1599 craig 222
	],[
1595 craig 223
	#if LCMS_VERSION < 112
224
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
225
	#endif
1599 craig 226
	], [], [hacms=pre112])
1595 craig 227
	AC_MSG_RESULT($hacms)
228
fi
229
 
779 fschmid 230
AC_SUBST(LIBLCMS)
231
if test $hacms = yes && test $hacmsh = yes; then
232
 AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
233
fi
1580 craig 234
 
235
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 236
LIBTIFF=""
237
hastif=
1580 craig 238
dnl Check if we have libtiff
779 fschmid 239
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 240
if test $hastif = yes; then
241
	dnl Check for tiffvers.h
242
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
243
	if test $hastif = yes; then
244
		dnl Now attempt to check if libtiff is new enough
245
		AC_MSG_CHECKING(libtiff version > 3.6.0)
246
		AC_TRY_COMPILE([
247
		#include "tiffvers.h"
1599 craig 248
		],[
1585 craig 249
		#if TIFFLIB_VERSION < 20031007
250
		#error libtiff is too old, need libtiff 3.6.0 or newer.
251
		#endif
1599 craig 252
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 253
		AC_MSG_RESULT($hastif)
254
	fi
255
fi
779 fschmid 256
AC_SUBST(LIBTIFF)
257
if test $hastif = yes; then
258
 AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
259
fi
1580 craig 260
 
779 fschmid 261
LIBDL2=""
262
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
263
AC_SUBST(LIBDL2)
264
 
265
dnl generate the config header
266
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
267
 
268
dnl Checks for programs.
269
AC_CHECK_COMPILERS
270
AC_ENABLE_SHARED(yes)
271
AC_ENABLE_STATIC(no)
272
KDE_PROG_LIBTOOL
273
 
274
hapython=yes
275
kde_python_link_found=no
276
KDE_CHECK_PYTHON(1.5)
277
COMPILE_PYTHON=no
278
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
279
if test $kde_python_link_found = no; then
280
	COMPILE_PYTHON=no
281
fi
282
if test $kde_python_link_found = yes; then
283
  AC_CHECK_HEADER(python2.3/Python.h, [foo=""],[hapython=no])
284
   if test $hapython = yes; then
285
    AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
286
   fi
287
fi
288
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
289
 
2311 craig 290
AC_ARG_ENABLE(cups, [  --disable-cups        Do not compile support for CUPS printing],[disable_cups=yes])
291
LIBCUPS=""
292
hacups=no
293
if test "$disable_cups" != "yes" ; then
294
	# Look for cups.h
295
	AC_CHECK_HEADER(cups/cups.h, [hacups_h=yes],[hacups_h=no])
296
	AC_CHECK_PROG(hacups_cfg, cups-config, yes, no)
297
	echo "'$hacups_cfg' '$hacups_h'" >/tmp/cfg
298
	if test "x$hacups_h" = "xyes" && test "x$hacups_cfg" = "xyes"; then
299
		# We have the CUPS libs and headers, so enable
300
		# the use of CUPS and tell the build where to
301
		# find it.
302
		LIBCUPS="`cups-config --libs`"
303
		AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
304
		AC_SUBST(LIBCUPS)
305
		hacups=yes
306
	else
307
		AC_MSG_WARN([libcups could not be found. Printing functionality will be limited.])
308
		hacups=no
309
	fi
310
else
311
	hacups=no
779 fschmid 312
fi
313
 
314
COMPILE_DEBUG=no
2311 craig 315
AC_ARG_ENABLE(debug, [  --enable-debug     Enables debugging information (recommended for snapshots)],
1634 craig 316
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 317
	COMPILE_DEBUG=yes
318
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
319
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
320
fi])
321
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
322
 
1689 craig 323
dnl Compile and link the gdk-pixbuf sources unless building
324
dnl a Mac-native build.
325
AM_CONDITIONAL(LINK_PIXBUF, test "$enable_mac" != "yes" )
326
 
1699 craig 327
build_mac_bundle=no
2311 craig 328
AC_ARG_ENABLE(bundle, [  --enable-bundle     Make an executable suitable for use in a .app bundle (INCOMPLETE)],
1699 craig 329
[if test "$enable_bundle" = "yes"; then
330
	build_mac_bundle=yes
331
	AC_DEFINE_UNQUOTED(BUILD_MAC_BUNDLE, 1, [Are we building an executable to be included in MacOS/X .app bundle?])
332
fi])
333
AM_CONDITIONAL(BUILD_MAC_BUNDLE, test "$build_mac_bundle" = "yes")
334
 
1732 craig 335
dnl Some platforms require special libtool flags to build dynamically loadable
336
dnl modules or plugins correctly. While libtool should take care of this with
337
dnl a fixed set of arguments, in case we need to change it later this is being
338
dnl made a configure-time substitution.
339
MODULE_LINK_FLAGS=" -module "
340
AC_SUBST(MODULE_LINK_FLAGS)
341
 
779 fschmid 342
all_libraries="$all_libraries $USER_LDFLAGS"
343
all_includes="$all_includes $USER_INCLUDES"
344
AC_SUBST(all_includes)
345
AC_SUBST(all_libraries)
346
 
347
AC_PATH_QT
348