Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
2398 craig 1
dnl Process this file with autoconf to produce a configure script.
2
 
779 fschmid 3
# Original Author was Kalle@kde.org
4
# I lifted it in some mater. (Stephan Kulow)
5
# I used much code from Janos Farkas
2398 craig 6
# Heavily tweaked and modified for Scribus by Craig Ringer
779 fschmid 7
 
2398 craig 8
dnl Quick `configure.in.in' survival guide:
9
dnl
10
dnl AC_MSG_WARN([warning message])
11
dnl     prints the warning and continues
12
dnl AC_MSG_ERROR([error message])
13
dnl     prints the error and stops configure
14
dnl AC_PATH_PROG([VARNAME],[programname],[failure message],[search path])
15
dnl     search path, failure message optional. Searches for programname
16
dnl     along search path or default path and sets VARNAME to the path
17
dnl     to the program, if found.
18
dnl AC_CHECK_LIB(lib_basename, lib_symbol, [command_if_success], [command_if_fail])
19
dnl     Looks for a library with basename lib_basename, ie libfreetype.so.3.0.0
20
dnl     might be found for lib_basename=libfreetype, and checks for the lib_symbol
21
dnl     symbol inside. The symbol is usually an important function, a version symbol,
22
dnl     etc. Runs the specified commands on failure (lib not found OR symbol not found)
23
dnl     or success, as appropriate.
24
dnl AC_CHECK_HEADER(headerfilename.h, [successcommand], [failcommand])
25
dnl     Search for headerfilename.h. If found, run successcommand, otherwise
26
dnl     run failcommand.
27
dnl AC_SUBST(VARNAME)
28
dnl     "export" VARNAME so that it's defined in the Makefile.in with the value
29
dnl     it was set to in this script. Thus:
30
dnl         LIBFRED=" -lfred "
31
dnl         AC_SUBST(LIBFRED)
32
dnl     will let you use $(LIBFRED) in the Makefile.am .
33
dnl AC_DEFINE_UNQUOTED(VARNAME, VALUE, [comment in config.h])
34
dnl     Sets VARNAME to VALUE in config.h, so it can be tested for in preprocessor
35
dnl     macros in the source. The supplied comment is included in config.h .
36
dnl
37
dnl configure.in.in is written in shell script, plus M4 macros that expand into
38
dnl yet more shell script. Some M4 macros are provided by autoconf and automake,
39
dnl some by libtool, and some are provided by KDE. In general, if its
40
dnl UPPER_CASE(WITH_BRACKETS) it'll be an M4 macro, and if it looks like shell
41
dnl script it probably is. Variables are boring old shell variables unless exported
42
dnl to somewhere using AC_SUBST(...) or AC_DEFINE_UNQUOTED(...) and friends.
43
dnl
44
dnl Blame any errors in the above entirely on Craig Ringer. Please see the
45
dnl autoconf documentation (ha!) for details on these and more.
779 fschmid 46
 
47
AC_INIT(acinclude.m4) dnl a source file from your sub dir
48
 
49
dnl This is so we can use kde-common
50
AC_CONFIG_AUX_DIR(admin)
51
 
52
AC_CANONICAL_SYSTEM
53
AC_ARG_PROGRAM
54
 
55
dnl Automake doc recommends to do this only here. (Janos)
56
AM_INIT_AUTOMAKE(scribus,1.3.0cvs)
57
 
58
dnl KDE_SET_PREFIX
59
 
60
AC_PREFIX_DEFAULT(/usr/local)
61
if test "x$prefix" = "xNONE"; then
62
  prefix=$ac_default_prefix
63
  ac_configure_args="$ac_configure_args --prefix $prefix"
64
fi
65
 
1592 craig 66
dnl Look for pkg-config, which we use to find fontconfig and
67
dnl will probably need for other things in future.
68
PKG_CONFIG=""
69
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
779 fschmid 70
 
71
LIBART_LIBS=""
72
LIBART_CFLAGS=""
73
LIBART_CONFIG=""
74
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])
75
])
76
if test -n "$LIBART_CONFIG"; then
77
  vers=`$LIBART_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
78
  if test -n "$vers" && test "$vers" -ge 2003008
79
  then
80
     LIBART_LIBS="`$LIBART_CONFIG --libs`"
81
     LIBART_CFLAGS="`$LIBART_CONFIG --cflags`"
82
     AC_DEFINE_UNQUOTED(HAVE_LIBART, 1, [Defines if your system has the libart library])
83
  else
84
     AC_MSG_ERROR([You need at least libart 2.3.8])
85
  fi
86
fi
87
AC_SUBST(LIBART_LIBS)
88
AC_SUBST(LIBART_CFLAGS)
89
AC_C_BIGENDIAN
90
 
1599 craig 91
dnl Check for freetype, which Scribus *requires* to build
779 fschmid 92
LIBFREETYPE_LIBS=""
93
LIBFREETYPE_CFLAGS=""
94
 
95
FREETYPE_CONFIG=""
96
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])
97
 
98
hafree=no
2312 craig 99
hafree_post219=
779 fschmid 100
if test -n "$FREETYPE_CONFIG"; then
101
	LIBFREETYPE_LIBS="`$FREETYPE_CONFIG --libs`"
1599 craig 102
	LIBFREETYPE_CFLAGS="`$FREETYPE_CONFIG --cflags`"
779 fschmid 103
	AC_CHECK_LIB(freetype, FT_Get_First_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
104
	AC_CHECK_LIB(freetype, FT_Get_Next_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
105
	if test $hafree = yes; then
106
		AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1, [Defines if your system has the libfreetype library])
107
	else
1599 craig 108
		AC_MSG_ERROR([You need at least freetype 2.1.0])
779 fschmid 109
	fi
1599 craig 110
 
2312 craig 111
	dnl Warn the user if they have less than freetype 2.1.9
112
	dnl Changed to fatal error
113
	AC_MSG_CHECKING(freetype version > 2.1.9)
1599 craig 114
	SAVE_CFLAGS="${CFLAGS}"
115
	CFLAGS=" ${LIBFREETYPE_CFLAGS} "
116
	AC_TRY_COMPILE([
117
	#include <ft2build.h>
118
	#include FT_FREETYPE_H
119
	],[
2312 craig 120
	#if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 1 && FREETYPE_PATCH < 9
121
	#error freetype 2.1 older than 2.1.9
1599 craig 122
	#endif
2312 craig 123
	], [hafree_post219=yes], [hafree_post219=no])
1599 craig 124
	CFLAGS="${SAVE_CFLAGS}"
2312 craig 125
	AC_MSG_RESULT($hafree_post219)
126
	if test hafree_post219 = no; then
127
		AC_MSG_WARN([Your libfreetype is too old - version 2.1.9 or newer strongly recommended])
1599 craig 128
	fi
129
 
130
	dnl Export the includes and lib path settings required to build with freetype.
779 fschmid 131
	AC_SUBST(LIBFREETYPE_LIBS)
132
	AC_SUBST(LIBFREETYPE_CFLAGS)
133
else
134
  AC_MSG_ERROR([You need at least freetype 2.1.0])
135
fi
136
 
1592 craig 137
dnl Try to find fontconfig using fontconfig-config or pkg-config.
1920 craig 138
hafontconfig=no
779 fschmid 139
LIBFONTCONFIG_LIBS=""
140
LIBFONTCONFIG_CFLAGS=""
141
FONTCONFIG_CONFIG=""
142
 
1920 craig 143
dnl Try to find fontconfig with pkg-config if we have pkg-config
144
AC_MSG_CHECKING([Checking for fontconfig with pkg-config])
145
if test -n "$PKG_CONFIG"; then
1592 craig 146
	LIBFONTCONFIG_LIBS="`$PKG_CONFIG fontconfig --libs`"
147
	LIBFONTCONFIG_CFLAGS="`$PKG_CONFIG fontconfig --cflags`"
1920 craig 148
	if test -n "$LIBFONTCONFIG_LIBS" || test -n "$LIBFONTCONFIG_CFLAGS"; then
149
		AC_MSG_RESULT([found])
150
	else
151
		AC_MSG_RESULT([not found])
152
	fi
779 fschmid 153
else
1920 craig 154
	AC_MSG_RESULT([failed: pkg-config not found])
779 fschmid 155
fi
1635 craig 156
 
1920 craig 157
dnl If fontconfig not found with pkg-config, try to find fontconfig-config
158
dnl and use that to look for fontconfig.
159
if test -z "$LIBFONTCONFIG_LIBS" && test -z "$LIBFONTCONFIG_CFLAGS"; then
160
	dnl Seems we didn't find fontconfig with pkg-config...
161
	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])
162
	if test -n "$FONTCONFIG_CONFIG"; then
163
		dnl found fontconfig-config, use it's results
164
		LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
165
		LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"
166
	else
167
		AC_MSG_WARN([Couldn't find fontconfig-config or find fontconfig with pkg-config])
168
	fi
169
fi
170
 
1635 craig 171
dnl Check to see if we can compile fontconfig
172
SAVE_CFLAGS="${CFLAGS}"
173
SAVE_LDFLAGS="${LDFLAGS}"
174
CFLAGS="${CFLAGS} ${LIBFONTCONFIG_CFLAGS}"
175
LDFLAGS="${LDFLAGS} ${LIBFONTCONFIG_LIBS}"
1592 craig 176
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
1635 craig 177
CFLAGS="${SAVE_CFLAGS}"
178
LDFLAGS="${SAVE_LDFLAGS}"
1592 craig 179
if test $hafontconfig = yes; then
180
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
181
else
182
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
183
fi
184
AC_SUBST(LIBFONTCONFIG_LIBS)
185
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 186
 
1592 craig 187
 
779 fschmid 188
XML_LIBS=""
189
XML_CFLAGS=""
190
 
191
XML_CONFIG=""
192
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])
193
 
1599 craig 194
dnl check for LibXML2
779 fschmid 195
haxml=no
2314 craig 196
haxml26=no
197
AC_ARG_ENABLE(xml, [  --disable-xml       Don't use libxml2 and turn off some Scribus features.], [disable_xml2="yes"])
198
if test "$disable_xml2" != "yes"; then
199
	if test -n "$XML_CONFIG"; then
200
		XML_LIBS="`$XML_CONFIG --libs`"
201
		XML_CFLAGS="`$XML_CONFIG --cflags`"
202
		AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
203
		if test $haxml = yes; then
204
			AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
205
			AC_SUBST(XML_LIBS)
206
			AC_SUBST(XML_CFLAGS)
207
		fi
208
		vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
209
		if test -n "$vers" && test "$vers" -ge 2006000
210
		then
211
			AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
212
			haxml26=yes
213
		fi
779 fschmid 214
	fi
215
fi
216
 
1599 craig 217
dnl check for -lsocket
779 fschmid 218
AC_CHECK_LIB(socket,socket,
219
if test "$uname" != "IRIX"; then
220
	LIBS="-lsocket $LIBS"
221
else
222
	echo "Not using -lsocket since you are running IRIX."
223
fi)
224
AC_CHECK_LIB(nsl,gethostbyaddr,
225
if test "$uname" != "IRIX"; then
226
	LIBS="-lnsl $LIBS"
227
else
228
	echo "Not using -lnsl since you are running IRIX."
229
fi)
230
 
1595 craig 231
dnl Check for lcms
232
dnl TODO look for lcms using pkg-config too
2310 craig 233
dnl TODO: convert to use --with-lcms= and AC_ARG_WITH(...)
779 fschmid 234
LIBLCMS=""
235
hacms=
2310 craig 236
AC_ARG_ENABLE(lcms, [  --disable-lcms     Don't use colour management (default=no)], [disable_lcms="yes"])
237
 
238
# If lcms hasn't been explicitly disabled, look for it and see
239
# if we can use it.
240
if test "$disable_lcms" != "yes"; then
241
	# See if liblcms.so is on our search path and looks vaguely valid
242
	AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
243
	hacmsh=
244
	lcms_h=
245
	# and search for lcms.h, which may or may not be in an lcms/ subdir
246
	AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
247
	if test $hacmsh = no; then
248
		AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
249
		if test $hacmsh = yes; then
250
			AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
251
			lcms_h="lcms/lcms.h"
252
		fi
253
	else
254
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
255
		lcms_h="lcms.h"
779 fschmid 256
	fi
2310 craig 257
	if test $hacmsh = no; then
258
		# There's not much point finding -llcms if we can't find the header file...
259
		hacms=no
260
	fi
779 fschmid 261
fi
1595 craig 262
dnl Attempt to check that lcms is new enough
263
if test $hacms = yes; then
264
	AC_MSG_CHECKING(liblcms version > 1.1.2)
265
	AC_TRY_COMPILE([
266
	#include "$lcms_h"
1599 craig 267
	],[
1595 craig 268
	#if LCMS_VERSION < 112
269
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
270
	#endif
1599 craig 271
	], [], [hacms=pre112])
1595 craig 272
	AC_MSG_RESULT($hacms)
273
fi
274
 
779 fschmid 275
AC_SUBST(LIBLCMS)
276
if test $hacms = yes && test $hacmsh = yes; then
277
 AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
278
fi
1580 craig 279
 
280
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 281
LIBTIFF=""
282
hastif=
1580 craig 283
dnl Check if we have libtiff
779 fschmid 284
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 285
if test $hastif = yes; then
286
	dnl Check for tiffvers.h
287
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
288
	if test $hastif = yes; then
289
		dnl Now attempt to check if libtiff is new enough
290
		AC_MSG_CHECKING(libtiff version > 3.6.0)
291
		AC_TRY_COMPILE([
292
		#include "tiffvers.h"
1599 craig 293
		],[
1585 craig 294
		#if TIFFLIB_VERSION < 20031007
295
		#error libtiff is too old, need libtiff 3.6.0 or newer.
296
		#endif
1599 craig 297
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 298
		AC_MSG_RESULT($hastif)
299
	fi
300
fi
779 fschmid 301
AC_SUBST(LIBTIFF)
302
if test $hastif = yes; then
303
 AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
304
fi
1580 craig 305
 
779 fschmid 306
LIBDL2=""
307
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
308
AC_SUBST(LIBDL2)
309
 
310
dnl generate the config header
311
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
312
 
313
dnl Checks for programs.
314
AC_CHECK_COMPILERS
315
AC_ENABLE_SHARED(yes)
316
AC_ENABLE_STATIC(no)
317
KDE_PROG_LIBTOOL
318
 
319
hapython=yes
320
kde_python_link_found=no
321
KDE_CHECK_PYTHON(1.5)
322
COMPILE_PYTHON=no
323
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
324
if test $kde_python_link_found = no; then
325
	COMPILE_PYTHON=no
326
fi
327
if test $kde_python_link_found = yes; then
328
  AC_CHECK_HEADER(python2.3/Python.h, [foo=""],[hapython=no])
329
   if test $hapython = yes; then
330
    AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
331
   fi
332
fi
333
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
334
 
2311 craig 335
AC_ARG_ENABLE(cups, [  --disable-cups        Do not compile support for CUPS printing],[disable_cups=yes])
336
LIBCUPS=""
337
hacups=no
338
if test "$disable_cups" != "yes" ; then
339
	# Look for cups.h
340
	AC_CHECK_HEADER(cups/cups.h, [hacups_h=yes],[hacups_h=no])
341
	AC_CHECK_PROG(hacups_cfg, cups-config, yes, no)
342
	echo "'$hacups_cfg' '$hacups_h'" >/tmp/cfg
343
	if test "x$hacups_h" = "xyes" && test "x$hacups_cfg" = "xyes"; then
344
		# We have the CUPS libs and headers, so enable
345
		# the use of CUPS and tell the build where to
346
		# find it.
347
		LIBCUPS="`cups-config --libs`"
348
		AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
349
		AC_SUBST(LIBCUPS)
350
		hacups=yes
351
	else
352
		AC_MSG_WARN([libcups could not be found. Printing functionality will be limited.])
353
		hacups=no
354
	fi
355
else
356
	hacups=no
779 fschmid 357
fi
358
 
359
COMPILE_DEBUG=no
2311 craig 360
AC_ARG_ENABLE(debug, [  --enable-debug     Enables debugging information (recommended for snapshots)],
1634 craig 361
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 362
	COMPILE_DEBUG=yes
363
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
364
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
365
fi])
366
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
367
 
1689 craig 368
dnl Compile and link the gdk-pixbuf sources unless building
369
dnl a Mac-native build.
370
AM_CONDITIONAL(LINK_PIXBUF, test "$enable_mac" != "yes" )
371
 
1699 craig 372
build_mac_bundle=no
2311 craig 373
AC_ARG_ENABLE(bundle, [  --enable-bundle     Make an executable suitable for use in a .app bundle (INCOMPLETE)],
1699 craig 374
[if test "$enable_bundle" = "yes"; then
375
	build_mac_bundle=yes
376
	AC_DEFINE_UNQUOTED(BUILD_MAC_BUNDLE, 1, [Are we building an executable to be included in MacOS/X .app bundle?])
377
fi])
378
AM_CONDITIONAL(BUILD_MAC_BUNDLE, test "$build_mac_bundle" = "yes")
379
 
1732 craig 380
dnl Some platforms require special libtool flags to build dynamically loadable
381
dnl modules or plugins correctly. While libtool should take care of this with
382
dnl a fixed set of arguments, in case we need to change it later this is being
383
dnl made a configure-time substitution.
384
MODULE_LINK_FLAGS=" -module "
385
AC_SUBST(MODULE_LINK_FLAGS)
386
 
779 fschmid 387
all_libraries="$all_libraries $USER_LDFLAGS"
388
all_includes="$all_includes $USER_INCLUDES"
389
AC_SUBST(all_includes)
390
AC_SUBST(all_libraries)
391
 
392
AC_PATH_QT
393