Subversion Repositories Scribus

Rev

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