Subversion Repositories Scribus

Rev

Rev 2971 | Rev 3211 | 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
3113 fschmid 154
 
155
hacairo=no
156
LIBCAIRO_LIBS=""
157
LIBCAIRO_CFLAGS=""
158
COMPILE_CAIRO=no
159
AC_ARG_ENABLE(cairo, [  --enable-cairo     Enables building with cairo support],
160
[if test "x$enable_cairo" = "xyes" || test "x$enable_cairo" = "xfull"; then
161
	COMPILE_CAIRO=yes
162
	AC_MSG_CHECKING([Checking for cairo with pkg-config])
163
	if test -n "$PKG_CONFIG"; then
164
		LIBCAIRO_LIBS="`$PKG_CONFIG cairo --libs`"
165
		LIBCAIRO_CFLAGS="`$PKG_CONFIG cairo --cflags`"
166
		if test -n "$LIBCAIRO_LIBS" || test -n "$LIBCAIRO_CFLAGS"; then
167
			AC_MSG_RESULT([found])
168
			hacairo=yes
169
		else
170
			AC_MSG_RESULT([not found])
171
		fi
172
	else
173
		AC_MSG_RESULT([failed: pkg-config not found])
174
	fi
175
	if test $hacairo = yes; then
176
		AC_DEFINE_UNQUOTED(HAVE_CAIRO, 1, [Defines if your system has the cairo library])
177
	else
178
		libmissing cairo optional
179
		AC_MSG_WARN([Couldn't find a usable cairo])
180
	fi
181
fi])
182
AM_CONDITIONAL(COMPILE_CAIRO, test x$COMPILE_CAIRO = xyes)
183
AC_SUBST(LIBCAIRO_LIBS)
184
AC_SUBST(LIBCAIRO_CFLAGS)
185
 
779 fschmid 186
AC_SUBST(LIBART_LIBS)
187
AC_SUBST(LIBART_CFLAGS)
188
AC_C_BIGENDIAN
189
 
1599 craig 190
dnl Check for freetype, which Scribus *requires* to build
779 fschmid 191
LIBFREETYPE_LIBS=""
192
LIBFREETYPE_CFLAGS=""
193
 
194
FREETYPE_CONFIG=""
2399 craig 195
AC_PATH_PROG(FREETYPE_CONFIG,
2403 craig 196
			 freetype-config,
2402 craig 197
			 [],
2399 craig 198
			 [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
779 fschmid 199
 
200
hafree=no
2312 craig 201
hafree_post219=
779 fschmid 202
if test -n "$FREETYPE_CONFIG"; then
203
	LIBFREETYPE_LIBS="`$FREETYPE_CONFIG --libs`"
1599 craig 204
	LIBFREETYPE_CFLAGS="`$FREETYPE_CONFIG --cflags`"
779 fschmid 205
	AC_CHECK_LIB(freetype, FT_Get_First_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
206
	AC_CHECK_LIB(freetype, FT_Get_Next_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
207
	if test $hafree = yes; then
208
		AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1, [Defines if your system has the libfreetype library])
209
	else
2405 craig 210
		libmissing libfreetype required
1599 craig 211
		AC_MSG_ERROR([You need at least freetype 2.1.0])
779 fschmid 212
	fi
1599 craig 213
 
2312 craig 214
	dnl Warn the user if they have less than freetype 2.1.9
215
	dnl Changed to fatal error
216
	AC_MSG_CHECKING(freetype version > 2.1.9)
1599 craig 217
	SAVE_CFLAGS="${CFLAGS}"
218
	CFLAGS=" ${LIBFREETYPE_CFLAGS} "
219
	AC_TRY_COMPILE([
220
	#include <ft2build.h>
221
	#include FT_FREETYPE_H
222
	],[
2312 craig 223
	#if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 1 && FREETYPE_PATCH < 9
224
	#error freetype 2.1 older than 2.1.9
1599 craig 225
	#endif
2312 craig 226
	], [hafree_post219=yes], [hafree_post219=no])
1599 craig 227
	CFLAGS="${SAVE_CFLAGS}"
2312 craig 228
	AC_MSG_RESULT($hafree_post219)
229
	if test hafree_post219 = no; then
230
		AC_MSG_WARN([Your libfreetype is too old - version 2.1.9 or newer strongly recommended])
1599 craig 231
	fi
232
 
233
	dnl Export the includes and lib path settings required to build with freetype.
779 fschmid 234
	AC_SUBST(LIBFREETYPE_LIBS)
235
	AC_SUBST(LIBFREETYPE_CFLAGS)
236
else
2405 craig 237
	libmissing libfreetype required
2401 craig 238
	AC_MSG_ERROR([You need at least freetype 2.1.0])
779 fschmid 239
fi
240
 
1592 craig 241
dnl Try to find fontconfig using fontconfig-config or pkg-config.
1920 craig 242
hafontconfig=no
779 fschmid 243
LIBFONTCONFIG_LIBS=""
244
LIBFONTCONFIG_CFLAGS=""
245
FONTCONFIG_CONFIG=""
246
 
1920 craig 247
dnl Try to find fontconfig with pkg-config if we have pkg-config
248
AC_MSG_CHECKING([Checking for fontconfig with pkg-config])
249
if test -n "$PKG_CONFIG"; then
1592 craig 250
	LIBFONTCONFIG_LIBS="`$PKG_CONFIG fontconfig --libs`"
251
	LIBFONTCONFIG_CFLAGS="`$PKG_CONFIG fontconfig --cflags`"
1920 craig 252
	if test -n "$LIBFONTCONFIG_LIBS" || test -n "$LIBFONTCONFIG_CFLAGS"; then
253
		AC_MSG_RESULT([found])
254
	else
255
		AC_MSG_RESULT([not found])
256
	fi
779 fschmid 257
else
1920 craig 258
	AC_MSG_RESULT([failed: pkg-config not found])
779 fschmid 259
fi
1635 craig 260
 
1920 craig 261
dnl If fontconfig not found with pkg-config, try to find fontconfig-config
262
dnl and use that to look for fontconfig.
263
if test -z "$LIBFONTCONFIG_LIBS" && test -z "$LIBFONTCONFIG_CFLAGS"; then
2399 craig 264
	dnl Seems we didn't find fontconfig with pkg-config, so search for the old
265
	dnl fontconfig-config program instead.
266
	AC_PATH_PROG(FONTCONFIG_CONFIG,
267
				 fontconfig-config,
268
				 [],
269
				 [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
1920 craig 270
	if test -n "$FONTCONFIG_CONFIG"; then
271
		dnl found fontconfig-config, use it's results
272
		LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
273
		LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"
274
	else
275
		AC_MSG_WARN([Couldn't find fontconfig-config or find fontconfig with pkg-config])
276
	fi
277
fi
278
 
1635 craig 279
dnl Check to see if we can compile fontconfig
280
SAVE_CFLAGS="${CFLAGS}"
281
SAVE_LDFLAGS="${LDFLAGS}"
282
CFLAGS="${CFLAGS} ${LIBFONTCONFIG_CFLAGS}"
283
LDFLAGS="${LDFLAGS} ${LIBFONTCONFIG_LIBS}"
1592 craig 284
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
1635 craig 285
CFLAGS="${SAVE_CFLAGS}"
286
LDFLAGS="${SAVE_LDFLAGS}"
1592 craig 287
if test $hafontconfig = yes; then
288
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
289
else
2405 craig 290
	libmissing libfontconfig optional
1592 craig 291
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
292
fi
293
AC_SUBST(LIBFONTCONFIG_LIBS)
294
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 295
 
1592 craig 296
 
779 fschmid 297
XML_LIBS=""
298
XML_CFLAGS=""
299
 
300
XML_CONFIG=""
2399 craig 301
AC_PATH_PROG(XML_CONFIG,
302
			 xml2-config,
2403 craig 303
			 [],
2399 craig 304
			 [${PATH} ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
779 fschmid 305
 
1599 craig 306
dnl check for LibXML2
779 fschmid 307
haxml=no
2314 craig 308
haxml26=no
309
AC_ARG_ENABLE(xml, [  --disable-xml       Don't use libxml2 and turn off some Scribus features.], [disable_xml2="yes"])
310
if test "$disable_xml2" != "yes"; then
311
	if test -n "$XML_CONFIG"; then
312
		XML_LIBS="`$XML_CONFIG --libs`"
313
		XML_CFLAGS="`$XML_CONFIG --cflags`"
314
		AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
315
		if test $haxml = yes; then
316
			AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
317
			AC_SUBST(XML_LIBS)
318
			AC_SUBST(XML_CFLAGS)
2403 craig 319
		else
320
			libmising libxml2
321
			AC_MSG_WARN([Couldn't find a usable libxml2])
2314 craig 322
		fi
323
		vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
324
		if test -n "$vers" && test "$vers" -ge 2006000
325
		then
326
			AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
327
			haxml26=yes
328
		fi
2403 craig 329
	else
2405 craig 330
		libmissing libxml2 optional
2403 craig 331
		AC_MSG_WARN([Couldn't find a usable libxml2])
779 fschmid 332
	fi
333
fi
334
 
1599 craig 335
dnl check for -lsocket
779 fschmid 336
AC_CHECK_LIB(socket,socket,
337
if test "$uname" != "IRIX"; then
338
	LIBS="-lsocket $LIBS"
339
else
340
	echo "Not using -lsocket since you are running IRIX."
341
fi)
342
AC_CHECK_LIB(nsl,gethostbyaddr,
343
if test "$uname" != "IRIX"; then
344
	LIBS="-lnsl $LIBS"
345
else
346
	echo "Not using -lnsl since you are running IRIX."
347
fi)
348
 
1595 craig 349
dnl Check for lcms
350
dnl TODO look for lcms using pkg-config too
2310 craig 351
dnl TODO: convert to use --with-lcms= and AC_ARG_WITH(...)
779 fschmid 352
LIBLCMS=""
353
hacms=
2310 craig 354
AC_ARG_ENABLE(lcms, [  --disable-lcms     Don't use colour management (default=no)], [disable_lcms="yes"])
355
 
356
# If lcms hasn't been explicitly disabled, look for it and see
357
# if we can use it.
358
if test "$disable_lcms" != "yes"; then
359
	# See if liblcms.so is on our search path and looks vaguely valid
2962 craig 360
	SAVE_LDFLAGS="$LDFLAGS"
361
	LDFLAGS="$all_ldflags $LDFLAGS"
362
	export LDFLAGS
2310 craig 363
	AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
364
	hacmsh=
365
	lcms_h=
366
	# and search for lcms.h, which may or may not be in an lcms/ subdir
367
	AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
368
	if test $hacmsh = no; then
369
		AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
370
		if test $hacmsh = yes; then
371
			AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
372
			lcms_h="lcms/lcms.h"
373
		fi
374
	else
375
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
376
		lcms_h="lcms.h"
779 fschmid 377
	fi
2310 craig 378
	if test $hacmsh = no; then
379
		# There's not much point finding -llcms if we can't find the header file...
380
		hacms=no
381
	fi
2962 craig 382
	LDFLAGS="$SAVE_LDFLAGS"
779 fschmid 383
fi
1595 craig 384
dnl Attempt to check that lcms is new enough
385
if test $hacms = yes; then
386
	AC_MSG_CHECKING(liblcms version > 1.1.2)
387
	AC_TRY_COMPILE([
388
	#include "$lcms_h"
1599 craig 389
	],[
1595 craig 390
	#if LCMS_VERSION < 112
391
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
392
	#endif
1599 craig 393
	], [], [hacms=pre112])
1595 craig 394
	AC_MSG_RESULT($hacms)
395
fi
396
 
779 fschmid 397
AC_SUBST(LIBLCMS)
398
if test $hacms = yes && test $hacmsh = yes; then
2406 craig 399
	AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
400
else
401
	libmissing liblcms optional
779 fschmid 402
fi
1580 craig 403
 
404
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 405
LIBTIFF=""
406
hastif=
1580 craig 407
dnl Check if we have libtiff
779 fschmid 408
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 409
if test $hastif = yes; then
410
	dnl Check for tiffvers.h
411
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
412
	if test $hastif = yes; then
413
		dnl Now attempt to check if libtiff is new enough
414
		AC_MSG_CHECKING(libtiff version > 3.6.0)
415
		AC_TRY_COMPILE([
416
		#include "tiffvers.h"
1599 craig 417
		],[
1585 craig 418
		#if TIFFLIB_VERSION < 20031007
419
		#error libtiff is too old, need libtiff 3.6.0 or newer.
420
		#endif
1599 craig 421
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 422
		AC_MSG_RESULT($hastif)
423
	fi
424
fi
2406 craig 425
if test "${hastif}" != "yes"; then
426
	libmissing libtiff optional
427
fi
779 fschmid 428
AC_SUBST(LIBTIFF)
429
if test $hastif = yes; then
2406 craig 430
	AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
779 fschmid 431
fi
1580 craig 432
 
779 fschmid 433
LIBDL2=""
434
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
435
AC_SUBST(LIBDL2)
436
 
437
dnl generate the config header
438
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
439
 
440
dnl Checks for programs.
441
AC_CHECK_COMPILERS
442
AC_ENABLE_SHARED(yes)
443
AC_ENABLE_STATIC(no)
444
KDE_PROG_LIBTOOL
445
 
446
kde_python_link_found=no
2512 craig 447
KDE_CHECK_PYTHON(2.3)
2511 craig 448
COMPILE_PYTHON=
779 fschmid 449
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
2511 craig 450
if test "$COMPILE_PYTHON" != "no"; then
451
	if test "$enable_mac" = yes ; then
452
		dnl Mac OS X always has Python, but the KDE config scripts don't know
453
		dnl how to find it. We just hardcode the values here.
454
		AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
455
		PYTHONINC='-I/System/Library/Frameworks/Python.framework/Headers'
2527 craig 456
		PYTHONLIB='-L/System/Library/Frameworks/Python.framework -framework Python'
2511 craig 457
		PYTHONMODDIR='/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3'
458
		COMPILE_PYTHON=yes
459
	elif test "$kde_python_link_found" = yes; then
460
		dnl Configure found the Python libs
461
		COMPILE_PYTHON=yes
462
	else
463
		dnl Configure didn't find python libs
464
		COMPILE_PYTHON=no
465
	fi
779 fschmid 466
fi
467
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
468
 
2311 craig 469
AC_ARG_ENABLE(cups, [  --disable-cups        Do not compile support for CUPS printing],[disable_cups=yes])
470
LIBCUPS=""
471
hacups=no
472
if test "$disable_cups" != "yes" ; then
473
	# Look for cups.h
474
	AC_CHECK_HEADER(cups/cups.h, [hacups_h=yes],[hacups_h=no])
475
	AC_CHECK_PROG(hacups_cfg, cups-config, yes, no)
476
	echo "'$hacups_cfg' '$hacups_h'" >/tmp/cfg
477
	if test "x$hacups_h" = "xyes" && test "x$hacups_cfg" = "xyes"; then
478
		# We have the CUPS libs and headers, so enable
479
		# the use of CUPS and tell the build where to
480
		# find it.
481
		LIBCUPS="`cups-config --libs`"
482
		AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
483
		AC_SUBST(LIBCUPS)
484
		hacups=yes
485
	else
2406 craig 486
		libmissing libcups optional
2311 craig 487
		AC_MSG_WARN([libcups could not be found. Printing functionality will be limited.])
488
		hacups=no
489
	fi
490
else
491
	hacups=no
779 fschmid 492
fi
493
 
2409 craig 494
dnl While we don't use GhostScript during compilation - at least not
495
dnl currently - and can run without it, we check for it in configure
496
dnl to give users an early warning if it's missing.
497
AC_PATH_PROG(GS_PATH, gs)
2410 craig 498
AC_MSG_CHECKING([GhostScript version])
2409 craig 499
if test -z "${GS_PATH}" ; then
2410 craig 500
	AC_MSG_RESULT([gs not found])
2409 craig 501
	AC_MSG_WARN("GhostScript not found - gs 8.x is required for full features.")
2410 craig 502
else
503
	GS_VER_MAJOR=`gs --version | cut -d . -f 1`
504
	GS_VER_MINOR=`gs --version | cut -d . -f 2`
505
	AC_MSG_RESULT([${GS_VER_MAJOR}.${GS_VER_MINOR}])
506
	if (( "${GS_VER_MAJOR}" < 7 )) ; then
507
		AC_MSG_WARN("GhostScript found, but older than v7. v8 recommended.")
508
	elif (( "${GS_VER_MAJOR}" < 8 )) ; then
509
		AC_MSG_WARN("GhostScript v7 found. v8 recommended.")
510
	fi
2409 craig 511
fi
512
 
779 fschmid 513
COMPILE_DEBUG=no
2311 craig 514
AC_ARG_ENABLE(debug, [  --enable-debug     Enables debugging information (recommended for snapshots)],
1634 craig 515
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 516
	COMPILE_DEBUG=yes
517
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
518
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
519
fi])
520
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
521
 
1689 craig 522
dnl Compile and link the gdk-pixbuf sources unless building
523
dnl a Mac-native build.
524
AM_CONDITIONAL(LINK_PIXBUF, test "$enable_mac" != "yes" )
525
 
1699 craig 526
build_mac_bundle=no
2509 craig 527
AC_ARG_ENABLE(bundle, [  --enable-bundle     Make an executable suitable for use in a .app bundle (INCOMPLETE)], [build_mac_bundle=yes])
528
if test "$build_mac_bundle" = "yes"; then
1699 craig 529
	AC_DEFINE_UNQUOTED(BUILD_MAC_BUNDLE, 1, [Are we building an executable to be included in MacOS/X .app bundle?])
2509 craig 530
fi
531
if test "$enable_mac" != "yes" && test "$build_mac_bundle" = "yes"; then
532
	AC_MSG_ERROR([--enable-bundle only makes sense with --enable-mac])
533
fi
1699 craig 534
AM_CONDITIONAL(BUILD_MAC_BUNDLE, test "$build_mac_bundle" = "yes")
535
 
2509 craig 536
dnl On Mac OS X and Darwin we need to link the final binary to CoreFoundation.
537
if test "$enable_mac" = "yes"; then
538
	COREFOUNDATION_LIBS="-framework CoreFoundation"
539
else
540
	COREFOUNDATION_LIBS=
541
fi
542
AC_SUBST(COREFOUNDATION_LIBS)
543
 
1732 craig 544
dnl Some platforms require special libtool flags to build dynamically loadable
545
dnl modules or plugins correctly. While libtool should take care of this with
546
dnl a fixed set of arguments, in case we need to change it later this is being
547
dnl made a configure-time substitution.
548
MODULE_LINK_FLAGS=" -module "
549
AC_SUBST(MODULE_LINK_FLAGS)
550
 
779 fschmid 551
all_libraries="$all_libraries $USER_LDFLAGS"
552
all_includes="$all_includes $USER_INCLUDES"
553
AC_SUBST(all_includes)
554
AC_SUBST(all_libraries)
555
 
2689 craig 556
AH_TOP([
557
/*
558
 * Prevent code from including config.h directly. You should include
559
 * scconfig.h instead. This lets us handle win-config.h correctly, and
560
 * may do more later.
561
 */
562
#ifndef _SCCONFIG_H
563
#error "Include <scconfig.h> rather than using <config.h> directly"
564
#endif
565
])
566
 
779 fschmid 567
AC_PATH_QT
568
 
2971 craig 569
dnl Use gcc symbol visibility?
570
AC_ARG_ENABLE(gcc_symbol_visibility,
571
			  [  --enable-gcc-symbol-visibility   Limit visibility of exported symbols.],
572
			  [gcc_symbol_visibility="yes"])
573
if test "$gcc_symbol_visibilty" = "yes"; then
574
	AC_DEFINE_UNQUOTED(HAVE_GCC_SYMBOL_VISIBILITY, 1, [Enable declaration of export symbols])
575
	CFLAGS="$CFLAGS -fvisibility=hidden"
576
	CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
577
fi
578
 
2787 craig 579
dnl We have to do our Qt version check only after KDE's magic has found Qt
2788 craig 580
AC_MSG_CHECKING([if we're trying to compile against Qt 4])
2787 craig 581
SAVE_CFLAGS="${CFLAGS}"
582
CFLAGS="${QT_INCLUDES} ${CFLAGS}"
583
dnl If this snippet compiles correctly, we're using an older Qt and are fine.
584
dnl If it fails, we know we're using Qt 4. We don't need to test for Qt 3.3
585
dnl here, AC_PATH_QT has done that for us.
586
AC_TRY_COMPILE([
587
#include <qglobal.h>
588
],[
589
#if QT_VERSION >= 0x040000
590
#error Scribus does not support Qt 4
591
#endif
592
], [using_qt4=no], [using_qt4=yes])
593
CFLAGS="${SAVE_CFLAGS}"
594
if test "${using_qt4}" = "yes"; then
595
	AC_MSG_RESULT([Qt 4 found])
596
	AC_MSG_ERROR([Scribus does not yet support Qt 4])
597
else
2788 craig 598
	AC_MSG_RESULT([Usable Qt 3.x found])
2787 craig 599
fi