Subversion Repositories Scribus

Rev

Rev 2839 | Rev 2971 | 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
2400 craig 14
dnl AC_PATH_PROG([VARNAME],[programname],[notfoundvalue],[search path])
15
dnl     Searches for programname along search path or default path and sets
16
dnl     VARNAME to the path to the program, if found. If not found and
17
dnl     notfoundvalue provided, sets VARNAME to notfoundvalue, otherwise "".
2398 craig 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
2399 craig 44
dnl `dnl' is an M4 comment, # is a shell comment. The only differences are that
45
dnl M4 macros in shell comments still get expanded so if you want to "comment out"
46
dnl code with M4 macros you must use dnl, and that dnl comments are omitted from
47
dnl configure.in .
48
dnl
49
dnl Note that you should NOT assume the user has bash. Ensure that you TEST YOUR CODE
50
dnl with ash or a similar "primitive" shell before committing.
51
dnl
2398 craig 52
dnl Blame any errors in the above entirely on Craig Ringer. Please see the
53
dnl autoconf documentation (ha!) for details on these and more.
779 fschmid 54
 
55
AC_INIT(acinclude.m4) dnl a source file from your sub dir
56
 
57
dnl This is so we can use kde-common
58
AC_CONFIG_AUX_DIR(admin)
59
 
60
AC_CANONICAL_SYSTEM
61
AC_ARG_PROGRAM
62
 
63
dnl Automake doc recommends to do this only here. (Janos)
2830 fschmid 64
AM_INIT_AUTOMAKE(scribus,1.3.1cvs)
779 fschmid 65
 
2962 craig 66
dnl Check for --enable-lib64
67
KDE_CHECK_LIB64
68
 
2839 craig 69
dnl Add the libs and includes from --with-extra-libs and --with-extra-includes
70
KDE_CHECK_EXTRA_LIBS
71
 
779 fschmid 72
dnl KDE_SET_PREFIX
73
 
74
AC_PREFIX_DEFAULT(/usr/local)
75
if test "x$prefix" = "xNONE"; then
76
  prefix=$ac_default_prefix
77
  ac_configure_args="$ac_configure_args --prefix $prefix"
78
fi
79
 
1592 craig 80
dnl Look for pkg-config, which we use to find fontconfig and
81
dnl will probably need for other things in future.
82
PKG_CONFIG=""
83
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
779 fschmid 84
 
2399 craig 85
dnl Define a handy function to print a message for when libraries
86
dnl can't be found. This can be called from configure.in.in, and from
87
dnl configure.in.bot (which is, after all, just tacked on the bottom
88
dnl during the generation of configure).
89
 
2405 craig 90
libmissing_text="\
91
You may need to install some additional libraries or packages (on Linux,
92
that may mean -dev or -devel packages too). Also check your environment
93
variables. See the BUILDING file for details and troubleshooting."
94
 
2399 craig 95
missing_libs=""
96
 
2405 craig 97
# Usage: libmissing libfreetype required
98
#        libmissing libfontconfig optional
99
# to report a missing library
2838 craig 100
libmissing() {
2405 craig 101
	# name of library
102
	libname="${1}"
103
	# one of "optional" or "required"
104
	liboptional="${2}"
105
 
106
	missing_libs="${libname} ${missing_libs}"
107
	if test "${liboptional}" = "required"; then
108
		reqword="required"
109
		endmsg="This library is required for Scribus to build. Configure will now terminate."
110
	elif test "${liboptional}" = "optional"; then
111
		reqword="optional"
112
		endmsg="This library is optional, and Scribus will build without it. Continuing."
113
	else
114
		endmsg=""
115
	fi
116
 
2400 craig 117
	AC_MSG_WARN([
118
-------------------------------------------------------------------------------
2405 craig 119
The ${reqword} library ${libname} could not be found. See the BUILDING file.
120
 
121
${libmissing_text}
122
${endmsg}
2400 craig 123
-------------------------------------------------------------------------------
124
])
2405 craig 125
 
2399 craig 126
}
2405 craig 127
# end libmissing()
2399 craig 128
 
129
 
779 fschmid 130
LIBART_LIBS=""
131
LIBART_CFLAGS=""
132
LIBART_CONFIG=""
2399 craig 133
 
134
AC_PATH_PROG(LIBART_CONFIG,
2401 craig 135
			 libart2-config,
2400 craig 136
			 [],
2399 craig 137
			 [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /usr/nekoware/bin /opt/local/bin])
138
 
779 fschmid 139
if test -n "$LIBART_CONFIG"; then
140
  vers=`$LIBART_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
141
  if test -n "$vers" && test "$vers" -ge 2003008
142
  then
143
     LIBART_LIBS="`$LIBART_CONFIG --libs`"
144
     LIBART_CFLAGS="`$LIBART_CONFIG --cflags`"
145
     AC_DEFINE_UNQUOTED(HAVE_LIBART, 1, [Defines if your system has the libart library])
146
  else
2405 craig 147
     libmissing libart required
2401 craig 148
	 AC_MSG_ERROR([You need at least libart 2.3.8 . See the BUILDING file.])
779 fschmid 149
  fi
2400 craig 150
else
2405 craig 151
  libmissing libart required
2401 craig 152
  AC_MSG_ERROR([You need at least libart 2.3.8 . See the BUILDING file.])
779 fschmid 153
fi
154
AC_SUBST(LIBART_LIBS)
155
AC_SUBST(LIBART_CFLAGS)
156
AC_C_BIGENDIAN
157
 
1599 craig 158
dnl Check for freetype, which Scribus *requires* to build
779 fschmid 159
LIBFREETYPE_LIBS=""
160
LIBFREETYPE_CFLAGS=""
161
 
162
FREETYPE_CONFIG=""
2399 craig 163
AC_PATH_PROG(FREETYPE_CONFIG,
2403 craig 164
			 freetype-config,
2402 craig 165
			 [],
2399 craig 166
			 [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
779 fschmid 167
 
168
hafree=no
2312 craig 169
hafree_post219=
779 fschmid 170
if test -n "$FREETYPE_CONFIG"; then
171
	LIBFREETYPE_LIBS="`$FREETYPE_CONFIG --libs`"
1599 craig 172
	LIBFREETYPE_CFLAGS="`$FREETYPE_CONFIG --cflags`"
779 fschmid 173
	AC_CHECK_LIB(freetype, FT_Get_First_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
174
	AC_CHECK_LIB(freetype, FT_Get_Next_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
175
	if test $hafree = yes; then
176
		AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1, [Defines if your system has the libfreetype library])
177
	else
2405 craig 178
		libmissing libfreetype required
1599 craig 179
		AC_MSG_ERROR([You need at least freetype 2.1.0])
779 fschmid 180
	fi
1599 craig 181
 
2312 craig 182
	dnl Warn the user if they have less than freetype 2.1.9
183
	dnl Changed to fatal error
184
	AC_MSG_CHECKING(freetype version > 2.1.9)
1599 craig 185
	SAVE_CFLAGS="${CFLAGS}"
186
	CFLAGS=" ${LIBFREETYPE_CFLAGS} "
187
	AC_TRY_COMPILE([
188
	#include <ft2build.h>
189
	#include FT_FREETYPE_H
190
	],[
2312 craig 191
	#if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 1 && FREETYPE_PATCH < 9
192
	#error freetype 2.1 older than 2.1.9
1599 craig 193
	#endif
2312 craig 194
	], [hafree_post219=yes], [hafree_post219=no])
1599 craig 195
	CFLAGS="${SAVE_CFLAGS}"
2312 craig 196
	AC_MSG_RESULT($hafree_post219)
197
	if test hafree_post219 = no; then
198
		AC_MSG_WARN([Your libfreetype is too old - version 2.1.9 or newer strongly recommended])
1599 craig 199
	fi
200
 
201
	dnl Export the includes and lib path settings required to build with freetype.
779 fschmid 202
	AC_SUBST(LIBFREETYPE_LIBS)
203
	AC_SUBST(LIBFREETYPE_CFLAGS)
204
else
2405 craig 205
	libmissing libfreetype required
2401 craig 206
	AC_MSG_ERROR([You need at least freetype 2.1.0])
779 fschmid 207
fi
208
 
1592 craig 209
dnl Try to find fontconfig using fontconfig-config or pkg-config.
1920 craig 210
hafontconfig=no
779 fschmid 211
LIBFONTCONFIG_LIBS=""
212
LIBFONTCONFIG_CFLAGS=""
213
FONTCONFIG_CONFIG=""
214
 
1920 craig 215
dnl Try to find fontconfig with pkg-config if we have pkg-config
216
AC_MSG_CHECKING([Checking for fontconfig with pkg-config])
217
if test -n "$PKG_CONFIG"; then
1592 craig 218
	LIBFONTCONFIG_LIBS="`$PKG_CONFIG fontconfig --libs`"
219
	LIBFONTCONFIG_CFLAGS="`$PKG_CONFIG fontconfig --cflags`"
1920 craig 220
	if test -n "$LIBFONTCONFIG_LIBS" || test -n "$LIBFONTCONFIG_CFLAGS"; then
221
		AC_MSG_RESULT([found])
222
	else
223
		AC_MSG_RESULT([not found])
224
	fi
779 fschmid 225
else
1920 craig 226
	AC_MSG_RESULT([failed: pkg-config not found])
779 fschmid 227
fi
1635 craig 228
 
1920 craig 229
dnl If fontconfig not found with pkg-config, try to find fontconfig-config
230
dnl and use that to look for fontconfig.
231
if test -z "$LIBFONTCONFIG_LIBS" && test -z "$LIBFONTCONFIG_CFLAGS"; then
2399 craig 232
	dnl Seems we didn't find fontconfig with pkg-config, so search for the old
233
	dnl fontconfig-config program instead.
234
	AC_PATH_PROG(FONTCONFIG_CONFIG,
235
				 fontconfig-config,
236
				 [],
237
				 [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
1920 craig 238
	if test -n "$FONTCONFIG_CONFIG"; then
239
		dnl found fontconfig-config, use it's results
240
		LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
241
		LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"
242
	else
243
		AC_MSG_WARN([Couldn't find fontconfig-config or find fontconfig with pkg-config])
244
	fi
245
fi
246
 
1635 craig 247
dnl Check to see if we can compile fontconfig
248
SAVE_CFLAGS="${CFLAGS}"
249
SAVE_LDFLAGS="${LDFLAGS}"
250
CFLAGS="${CFLAGS} ${LIBFONTCONFIG_CFLAGS}"
251
LDFLAGS="${LDFLAGS} ${LIBFONTCONFIG_LIBS}"
1592 craig 252
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
1635 craig 253
CFLAGS="${SAVE_CFLAGS}"
254
LDFLAGS="${SAVE_LDFLAGS}"
1592 craig 255
if test $hafontconfig = yes; then
256
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
257
else
2405 craig 258
	libmissing libfontconfig optional
1592 craig 259
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
260
fi
261
AC_SUBST(LIBFONTCONFIG_LIBS)
262
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 263
 
1592 craig 264
 
779 fschmid 265
XML_LIBS=""
266
XML_CFLAGS=""
267
 
268
XML_CONFIG=""
2399 craig 269
AC_PATH_PROG(XML_CONFIG,
270
			 xml2-config,
2403 craig 271
			 [],
2399 craig 272
			 [${PATH} ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
779 fschmid 273
 
1599 craig 274
dnl check for LibXML2
779 fschmid 275
haxml=no
2314 craig 276
haxml26=no
277
AC_ARG_ENABLE(xml, [  --disable-xml       Don't use libxml2 and turn off some Scribus features.], [disable_xml2="yes"])
278
if test "$disable_xml2" != "yes"; then
279
	if test -n "$XML_CONFIG"; then
280
		XML_LIBS="`$XML_CONFIG --libs`"
281
		XML_CFLAGS="`$XML_CONFIG --cflags`"
282
		AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
283
		if test $haxml = yes; then
284
			AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
285
			AC_SUBST(XML_LIBS)
286
			AC_SUBST(XML_CFLAGS)
2403 craig 287
		else
288
			libmising libxml2
289
			AC_MSG_WARN([Couldn't find a usable libxml2])
2314 craig 290
		fi
291
		vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
292
		if test -n "$vers" && test "$vers" -ge 2006000
293
		then
294
			AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
295
			haxml26=yes
296
		fi
2403 craig 297
	else
2405 craig 298
		libmissing libxml2 optional
2403 craig 299
		AC_MSG_WARN([Couldn't find a usable libxml2])
779 fschmid 300
	fi
301
fi
302
 
1599 craig 303
dnl check for -lsocket
779 fschmid 304
AC_CHECK_LIB(socket,socket,
305
if test "$uname" != "IRIX"; then
306
	LIBS="-lsocket $LIBS"
307
else
308
	echo "Not using -lsocket since you are running IRIX."
309
fi)
310
AC_CHECK_LIB(nsl,gethostbyaddr,
311
if test "$uname" != "IRIX"; then
312
	LIBS="-lnsl $LIBS"
313
else
314
	echo "Not using -lnsl since you are running IRIX."
315
fi)
316
 
1595 craig 317
dnl Check for lcms
318
dnl TODO look for lcms using pkg-config too
2310 craig 319
dnl TODO: convert to use --with-lcms= and AC_ARG_WITH(...)
779 fschmid 320
LIBLCMS=""
321
hacms=
2310 craig 322
AC_ARG_ENABLE(lcms, [  --disable-lcms     Don't use colour management (default=no)], [disable_lcms="yes"])
323
 
324
# If lcms hasn't been explicitly disabled, look for it and see
325
# if we can use it.
326
if test "$disable_lcms" != "yes"; then
327
	# See if liblcms.so is on our search path and looks vaguely valid
2962 craig 328
	SAVE_LDFLAGS="$LDFLAGS"
329
	LDFLAGS="$all_ldflags $LDFLAGS"
330
	export LDFLAGS
2310 craig 331
	AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
332
	hacmsh=
333
	lcms_h=
334
	# and search for lcms.h, which may or may not be in an lcms/ subdir
335
	AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
336
	if test $hacmsh = no; then
337
		AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
338
		if test $hacmsh = yes; then
339
			AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
340
			lcms_h="lcms/lcms.h"
341
		fi
342
	else
343
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
344
		lcms_h="lcms.h"
779 fschmid 345
	fi
2310 craig 346
	if test $hacmsh = no; then
347
		# There's not much point finding -llcms if we can't find the header file...
348
		hacms=no
349
	fi
2962 craig 350
	LDFLAGS="$SAVE_LDFLAGS"
779 fschmid 351
fi
1595 craig 352
dnl Attempt to check that lcms is new enough
353
if test $hacms = yes; then
354
	AC_MSG_CHECKING(liblcms version > 1.1.2)
355
	AC_TRY_COMPILE([
356
	#include "$lcms_h"
1599 craig 357
	],[
1595 craig 358
	#if LCMS_VERSION < 112
359
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
360
	#endif
1599 craig 361
	], [], [hacms=pre112])
1595 craig 362
	AC_MSG_RESULT($hacms)
363
fi
364
 
779 fschmid 365
AC_SUBST(LIBLCMS)
366
if test $hacms = yes && test $hacmsh = yes; then
2406 craig 367
	AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
368
else
369
	libmissing liblcms optional
779 fschmid 370
fi
1580 craig 371
 
372
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 373
LIBTIFF=""
374
hastif=
1580 craig 375
dnl Check if we have libtiff
779 fschmid 376
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 377
if test $hastif = yes; then
378
	dnl Check for tiffvers.h
379
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
380
	if test $hastif = yes; then
381
		dnl Now attempt to check if libtiff is new enough
382
		AC_MSG_CHECKING(libtiff version > 3.6.0)
383
		AC_TRY_COMPILE([
384
		#include "tiffvers.h"
1599 craig 385
		],[
1585 craig 386
		#if TIFFLIB_VERSION < 20031007
387
		#error libtiff is too old, need libtiff 3.6.0 or newer.
388
		#endif
1599 craig 389
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 390
		AC_MSG_RESULT($hastif)
391
	fi
392
fi
2406 craig 393
if test "${hastif}" != "yes"; then
394
	libmissing libtiff optional
395
fi
779 fschmid 396
AC_SUBST(LIBTIFF)
397
if test $hastif = yes; then
2406 craig 398
	AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
779 fschmid 399
fi
1580 craig 400
 
779 fschmid 401
LIBDL2=""
402
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
403
AC_SUBST(LIBDL2)
404
 
405
dnl generate the config header
406
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
407
 
408
dnl Checks for programs.
409
AC_CHECK_COMPILERS
410
AC_ENABLE_SHARED(yes)
411
AC_ENABLE_STATIC(no)
412
KDE_PROG_LIBTOOL
413
 
414
kde_python_link_found=no
2512 craig 415
KDE_CHECK_PYTHON(2.3)
2511 craig 416
COMPILE_PYTHON=
779 fschmid 417
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
2511 craig 418
if test "$COMPILE_PYTHON" != "no"; then
419
	if test "$enable_mac" = yes ; then
420
		dnl Mac OS X always has Python, but the KDE config scripts don't know
421
		dnl how to find it. We just hardcode the values here.
422
		AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
423
		PYTHONINC='-I/System/Library/Frameworks/Python.framework/Headers'
2527 craig 424
		PYTHONLIB='-L/System/Library/Frameworks/Python.framework -framework Python'
2511 craig 425
		PYTHONMODDIR='/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3'
426
		COMPILE_PYTHON=yes
427
	elif test "$kde_python_link_found" = yes; then
428
		dnl Configure found the Python libs
429
		COMPILE_PYTHON=yes
430
	else
431
		dnl Configure didn't find python libs
432
		COMPILE_PYTHON=no
433
	fi
779 fschmid 434
fi
435
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
436
 
2311 craig 437
AC_ARG_ENABLE(cups, [  --disable-cups        Do not compile support for CUPS printing],[disable_cups=yes])
438
LIBCUPS=""
439
hacups=no
440
if test "$disable_cups" != "yes" ; then
441
	# Look for cups.h
442
	AC_CHECK_HEADER(cups/cups.h, [hacups_h=yes],[hacups_h=no])
443
	AC_CHECK_PROG(hacups_cfg, cups-config, yes, no)
444
	echo "'$hacups_cfg' '$hacups_h'" >/tmp/cfg
445
	if test "x$hacups_h" = "xyes" && test "x$hacups_cfg" = "xyes"; then
446
		# We have the CUPS libs and headers, so enable
447
		# the use of CUPS and tell the build where to
448
		# find it.
449
		LIBCUPS="`cups-config --libs`"
450
		AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
451
		AC_SUBST(LIBCUPS)
452
		hacups=yes
453
	else
2406 craig 454
		libmissing libcups optional
2311 craig 455
		AC_MSG_WARN([libcups could not be found. Printing functionality will be limited.])
456
		hacups=no
457
	fi
458
else
459
	hacups=no
779 fschmid 460
fi
461
 
2409 craig 462
dnl While we don't use GhostScript during compilation - at least not
463
dnl currently - and can run without it, we check for it in configure
464
dnl to give users an early warning if it's missing.
465
AC_PATH_PROG(GS_PATH, gs)
2410 craig 466
AC_MSG_CHECKING([GhostScript version])
2409 craig 467
if test -z "${GS_PATH}" ; then
2410 craig 468
	AC_MSG_RESULT([gs not found])
2409 craig 469
	AC_MSG_WARN("GhostScript not found - gs 8.x is required for full features.")
2410 craig 470
else
471
	GS_VER_MAJOR=`gs --version | cut -d . -f 1`
472
	GS_VER_MINOR=`gs --version | cut -d . -f 2`
473
	AC_MSG_RESULT([${GS_VER_MAJOR}.${GS_VER_MINOR}])
474
	if (( "${GS_VER_MAJOR}" < 7 )) ; then
475
		AC_MSG_WARN("GhostScript found, but older than v7. v8 recommended.")
476
	elif (( "${GS_VER_MAJOR}" < 8 )) ; then
477
		AC_MSG_WARN("GhostScript v7 found. v8 recommended.")
478
	fi
2409 craig 479
fi
480
 
779 fschmid 481
COMPILE_DEBUG=no
2311 craig 482
AC_ARG_ENABLE(debug, [  --enable-debug     Enables debugging information (recommended for snapshots)],
1634 craig 483
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 484
	COMPILE_DEBUG=yes
485
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
486
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
487
fi])
488
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
489
 
1689 craig 490
dnl Compile and link the gdk-pixbuf sources unless building
491
dnl a Mac-native build.
492
AM_CONDITIONAL(LINK_PIXBUF, test "$enable_mac" != "yes" )
493
 
1699 craig 494
build_mac_bundle=no
2509 craig 495
AC_ARG_ENABLE(bundle, [  --enable-bundle     Make an executable suitable for use in a .app bundle (INCOMPLETE)], [build_mac_bundle=yes])
496
if test "$build_mac_bundle" = "yes"; then
1699 craig 497
	AC_DEFINE_UNQUOTED(BUILD_MAC_BUNDLE, 1, [Are we building an executable to be included in MacOS/X .app bundle?])
2509 craig 498
fi
499
if test "$enable_mac" != "yes" && test "$build_mac_bundle" = "yes"; then
500
	AC_MSG_ERROR([--enable-bundle only makes sense with --enable-mac])
501
fi
1699 craig 502
AM_CONDITIONAL(BUILD_MAC_BUNDLE, test "$build_mac_bundle" = "yes")
503
 
2509 craig 504
dnl On Mac OS X and Darwin we need to link the final binary to CoreFoundation.
505
if test "$enable_mac" = "yes"; then
506
	COREFOUNDATION_LIBS="-framework CoreFoundation"
507
else
508
	COREFOUNDATION_LIBS=
509
fi
510
AC_SUBST(COREFOUNDATION_LIBS)
511
 
1732 craig 512
dnl Some platforms require special libtool flags to build dynamically loadable
513
dnl modules or plugins correctly. While libtool should take care of this with
514
dnl a fixed set of arguments, in case we need to change it later this is being
515
dnl made a configure-time substitution.
516
MODULE_LINK_FLAGS=" -module "
517
AC_SUBST(MODULE_LINK_FLAGS)
518
 
779 fschmid 519
all_libraries="$all_libraries $USER_LDFLAGS"
520
all_includes="$all_includes $USER_INCLUDES"
521
AC_SUBST(all_includes)
522
AC_SUBST(all_libraries)
523
 
2689 craig 524
AH_TOP([
525
/*
526
 * Prevent code from including config.h directly. You should include
527
 * scconfig.h instead. This lets us handle win-config.h correctly, and
528
 * may do more later.
529
 */
530
#ifndef _SCCONFIG_H
531
#error "Include <scconfig.h> rather than using <config.h> directly"
532
#endif
533
])
534
 
779 fschmid 535
AC_PATH_QT
536
 
2787 craig 537
dnl We have to do our Qt version check only after KDE's magic has found Qt
2788 craig 538
AC_MSG_CHECKING([if we're trying to compile against Qt 4])
2787 craig 539
SAVE_CFLAGS="${CFLAGS}"
540
CFLAGS="${QT_INCLUDES} ${CFLAGS}"
541
dnl If this snippet compiles correctly, we're using an older Qt and are fine.
542
dnl If it fails, we know we're using Qt 4. We don't need to test for Qt 3.3
543
dnl here, AC_PATH_QT has done that for us.
544
AC_TRY_COMPILE([
545
#include <qglobal.h>
546
],[
547
#if QT_VERSION >= 0x040000
548
#error Scribus does not support Qt 4
549
#endif
550
], [using_qt4=no], [using_qt4=yes])
551
CFLAGS="${SAVE_CFLAGS}"
552
if test "${using_qt4}" = "yes"; then
553
	AC_MSG_RESULT([Qt 4 found])
554
	AC_MSG_ERROR([Scribus does not yet support Qt 4])
555
else
2788 craig 556
	AC_MSG_RESULT([Usable Qt 3.x found])
2787 craig 557
fi