Subversion Repositories Scribus

Rev

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