Subversion Repositories Scribus

Rev

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