Subversion Repositories Scribus

Rev

Rev 2310 | Rev 2312 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
779 fschmid 1
# Original Author was Kalle@kde.org
2
# I lifted it in some mater. (Stephan Kulow)
3
# I used much code from Janos Farkas
4
 
5
dnl Process this file with autoconf to produce a configure script.
6
 
7
AC_INIT(acinclude.m4) dnl a source file from your sub dir
8
 
9
dnl This is so we can use kde-common
10
AC_CONFIG_AUX_DIR(admin)
11
 
12
AC_CANONICAL_SYSTEM
13
AC_ARG_PROGRAM
14
 
15
dnl Automake doc recommends to do this only here. (Janos)
16
AM_INIT_AUTOMAKE(scribus,1.3.0cvs)
17
 
18
dnl KDE_SET_PREFIX
19
 
20
AC_PREFIX_DEFAULT(/usr/local)
21
if test "x$prefix" = "xNONE"; then
22
  prefix=$ac_default_prefix
23
  ac_configure_args="$ac_configure_args --prefix $prefix"
24
fi
25
 
1592 craig 26
dnl Look for pkg-config, which we use to find fontconfig and
27
dnl will probably need for other things in future.
28
PKG_CONFIG=""
29
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
779 fschmid 30
 
31
LIBART_LIBS=""
32
LIBART_CFLAGS=""
33
LIBART_CONFIG=""
34
AC_PATH_PROG(LIBART_CONFIG, libart2-config,[AC_MSG_ERROR([Could not find libart anywhere, check http://www.levien.com/libart/], [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /usr/nekoware/bin /opt/local/bin])
35
])
36
if test -n "$LIBART_CONFIG"; then
37
  vers=`$LIBART_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
38
  if test -n "$vers" && test "$vers" -ge 2003008
39
  then
40
     LIBART_LIBS="`$LIBART_CONFIG --libs`"
41
     LIBART_CFLAGS="`$LIBART_CONFIG --cflags`"
42
     AC_DEFINE_UNQUOTED(HAVE_LIBART, 1, [Defines if your system has the libart library])
43
  else
44
     AC_MSG_ERROR([You need at least libart 2.3.8])
45
  fi
46
fi
47
AC_SUBST(LIBART_LIBS)
48
AC_SUBST(LIBART_CFLAGS)
49
AC_C_BIGENDIAN
50
 
1599 craig 51
dnl Check for freetype, which Scribus *requires* to build
779 fschmid 52
LIBFREETYPE_LIBS=""
53
LIBFREETYPE_CFLAGS=""
54
 
55
FREETYPE_CONFIG=""
56
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, [AC_MSG_ERROR([Could not find libfreetype anywhere, check http://www.freetype.org/])], [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
57
 
58
hafree=no
1599 craig 59
hafree_post213=
779 fschmid 60
if test -n "$FREETYPE_CONFIG"; then
61
	LIBFREETYPE_LIBS="`$FREETYPE_CONFIG --libs`"
1599 craig 62
	LIBFREETYPE_CFLAGS="`$FREETYPE_CONFIG --cflags`"
779 fschmid 63
	AC_CHECK_LIB(freetype, FT_Get_First_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
64
	AC_CHECK_LIB(freetype, FT_Get_Next_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
65
	if test $hafree = yes; then
66
		AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1, [Defines if your system has the libfreetype library])
67
	else
1599 craig 68
		AC_MSG_ERROR([You need at least freetype 2.1.0])
779 fschmid 69
	fi
1599 craig 70
 
71
	dnl Warn the user if they have less than freetype 2.1.3
72
	AC_MSG_CHECKING(freetype version > 2.1.3)
73
	SAVE_CFLAGS="${CFLAGS}"
74
	CFLAGS=" ${LIBFREETYPE_CFLAGS} "
75
	AC_TRY_COMPILE([
76
	#include <ft2build.h>
77
	#include FT_FREETYPE_H
78
	],[
79
	#if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 1 && FREETYPE_PATCH < 3
80
	#error freetype 2.1 older than 2.1.3
81
	#endif
82
	], [hafree_post213=yes], [hafree_post213=no])
83
	CFLAGS="${SAVE_CFLAGS}"
84
	AC_MSG_RESULT($hafree_post213)
85
	if test hafree_post213 = no; then
86
		AC_MSG_WARN([Freetype is older than 2.1.3])
87
	fi
88
 
89
	dnl Export the includes and lib path settings required to build with freetype.
779 fschmid 90
	AC_SUBST(LIBFREETYPE_LIBS)
91
	AC_SUBST(LIBFREETYPE_CFLAGS)
92
else
93
  AC_MSG_ERROR([You need at least freetype 2.1.0])
94
fi
95
 
1592 craig 96
dnl Try to find fontconfig using fontconfig-config or pkg-config.
1920 craig 97
hafontconfig=no
779 fschmid 98
LIBFONTCONFIG_LIBS=""
99
LIBFONTCONFIG_CFLAGS=""
100
FONTCONFIG_CONFIG=""
101
 
1920 craig 102
dnl Try to find fontconfig with pkg-config if we have pkg-config
103
AC_MSG_CHECKING([Checking for fontconfig with pkg-config])
104
if test -n "$PKG_CONFIG"; then
1592 craig 105
	LIBFONTCONFIG_LIBS="`$PKG_CONFIG fontconfig --libs`"
106
	LIBFONTCONFIG_CFLAGS="`$PKG_CONFIG fontconfig --cflags`"
1920 craig 107
	if test -n "$LIBFONTCONFIG_LIBS" || test -n "$LIBFONTCONFIG_CFLAGS"; then
108
		AC_MSG_RESULT([found])
109
	else
110
		AC_MSG_RESULT([not found])
111
	fi
779 fschmid 112
else
1920 craig 113
	AC_MSG_RESULT([failed: pkg-config not found])
779 fschmid 114
fi
1635 craig 115
 
1920 craig 116
dnl If fontconfig not found with pkg-config, try to find fontconfig-config
117
dnl and use that to look for fontconfig.
118
if test -z "$LIBFONTCONFIG_LIBS" && test -z "$LIBFONTCONFIG_CFLAGS"; then
119
	dnl Seems we didn't find fontconfig with pkg-config...
120
	AC_PATH_PROG(FONTCONFIG_CONFIG, fontconfig-config, [], [$PATH ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
121
	if test -n "$FONTCONFIG_CONFIG"; then
122
		dnl found fontconfig-config, use it's results
123
		LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
124
		LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"
125
	else
126
		AC_MSG_WARN([Couldn't find fontconfig-config or find fontconfig with pkg-config])
127
	fi
128
fi
129
 
1635 craig 130
dnl Check to see if we can compile fontconfig
131
SAVE_CFLAGS="${CFLAGS}"
132
SAVE_LDFLAGS="${LDFLAGS}"
133
CFLAGS="${CFLAGS} ${LIBFONTCONFIG_CFLAGS}"
134
LDFLAGS="${LDFLAGS} ${LIBFONTCONFIG_LIBS}"
1592 craig 135
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
1635 craig 136
CFLAGS="${SAVE_CFLAGS}"
137
LDFLAGS="${SAVE_LDFLAGS}"
1592 craig 138
if test $hafontconfig = yes; then
139
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
140
else
141
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
142
fi
143
AC_SUBST(LIBFONTCONFIG_LIBS)
144
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 145
 
1592 craig 146
 
779 fschmid 147
XML_LIBS=""
148
XML_CFLAGS=""
149
 
150
XML_CONFIG=""
151
AC_PATH_PROG(XML_CONFIG, xml2-config, [AC_MSG_ERROR([Could not find libxml2 anywhere, check http://www.xmlsoft.org/])], [${PATH} ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin])
152
 
1599 craig 153
dnl check for LibXML2
779 fschmid 154
haxml=no
155
if test -n "$XML_CONFIG"; then
156
	XML_LIBS="`$XML_CONFIG --libs`"
157
	XML_CFLAGS="`$XML_CONFIG --cflags`"
158
	AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
159
	if test $haxml = yes; then
160
		AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
161
		AC_SUBST(XML_LIBS)
162
		AC_SUBST(XML_CFLAGS)
163
	fi
164
	vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
165
  	if test -n "$vers" && test "$vers" -ge 2006000
166
	then
167
		AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
168
	fi
169
fi
170
 
1599 craig 171
dnl check for -lsocket
779 fschmid 172
AC_CHECK_LIB(socket,socket,
173
if test "$uname" != "IRIX"; then
174
	LIBS="-lsocket $LIBS"
175
else
176
	echo "Not using -lsocket since you are running IRIX."
177
fi)
178
AC_CHECK_LIB(nsl,gethostbyaddr,
179
if test "$uname" != "IRIX"; then
180
	LIBS="-lnsl $LIBS"
181
else
182
	echo "Not using -lnsl since you are running IRIX."
183
fi)
184
 
1595 craig 185
dnl Check for lcms
186
dnl TODO look for lcms using pkg-config too
2310 craig 187
dnl TODO: convert to use --with-lcms= and AC_ARG_WITH(...)
779 fschmid 188
LIBLCMS=""
189
hacms=
2310 craig 190
AC_ARG_ENABLE(lcms, [  --disable-lcms     Don't use colour management (default=no)], [disable_lcms="yes"])
191
 
192
# If lcms hasn't been explicitly disabled, look for it and see
193
# if we can use it.
194
if test "$disable_lcms" != "yes"; then
195
	# See if liblcms.so is on our search path and looks vaguely valid
196
	AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
197
	hacmsh=
198
	lcms_h=
199
	# and search for lcms.h, which may or may not be in an lcms/ subdir
200
	AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
201
	if test $hacmsh = no; then
202
		AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
203
		if test $hacmsh = yes; then
204
			AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
205
			lcms_h="lcms/lcms.h"
206
		fi
207
	else
208
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
209
		lcms_h="lcms.h"
779 fschmid 210
	fi
2310 craig 211
	if test $hacmsh = no; then
212
		# There's not much point finding -llcms if we can't find the header file...
213
		hacms=no
214
	fi
779 fschmid 215
fi
1595 craig 216
dnl Attempt to check that lcms is new enough
217
if test $hacms = yes; then
218
	AC_MSG_CHECKING(liblcms version > 1.1.2)
219
	AC_TRY_COMPILE([
220
	#include "$lcms_h"
1599 craig 221
	],[
1595 craig 222
	#if LCMS_VERSION < 112
223
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
224
	#endif
1599 craig 225
	], [], [hacms=pre112])
1595 craig 226
	AC_MSG_RESULT($hacms)
227
fi
228
 
779 fschmid 229
AC_SUBST(LIBLCMS)
230
if test $hacms = yes && test $hacmsh = yes; then
231
 AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
232
fi
1580 craig 233
 
234
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 235
LIBTIFF=""
236
hastif=
1580 craig 237
dnl Check if we have libtiff
779 fschmid 238
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 239
if test $hastif = yes; then
240
	dnl Check for tiffvers.h
241
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
242
	if test $hastif = yes; then
243
		dnl Now attempt to check if libtiff is new enough
244
		AC_MSG_CHECKING(libtiff version > 3.6.0)
245
		AC_TRY_COMPILE([
246
		#include "tiffvers.h"
1599 craig 247
		],[
1585 craig 248
		#if TIFFLIB_VERSION < 20031007
249
		#error libtiff is too old, need libtiff 3.6.0 or newer.
250
		#endif
1599 craig 251
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 252
		AC_MSG_RESULT($hastif)
253
	fi
254
fi
779 fschmid 255
AC_SUBST(LIBTIFF)
256
if test $hastif = yes; then
257
 AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
258
fi
1580 craig 259
 
779 fschmid 260
LIBDL2=""
261
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
262
AC_SUBST(LIBDL2)
263
 
264
dnl generate the config header
265
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
266
 
267
dnl Checks for programs.
268
AC_CHECK_COMPILERS
269
AC_ENABLE_SHARED(yes)
270
AC_ENABLE_STATIC(no)
271
KDE_PROG_LIBTOOL
272
 
273
hapython=yes
274
kde_python_link_found=no
275
KDE_CHECK_PYTHON(1.5)
276
COMPILE_PYTHON=no
277
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
278
if test $kde_python_link_found = no; then
279
	COMPILE_PYTHON=no
280
fi
281
if test $kde_python_link_found = yes; then
282
  AC_CHECK_HEADER(python2.3/Python.h, [foo=""],[hapython=no])
283
   if test $hapython = yes; then
284
    AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
285
   fi
286
fi
287
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
288
 
2311 craig 289
AC_ARG_ENABLE(cups, [  --disable-cups        Do not compile support for CUPS printing],[disable_cups=yes])
290
LIBCUPS=""
291
hacups=no
292
if test "$disable_cups" != "yes" ; then
293
	# Look for cups.h
294
	AC_CHECK_HEADER(cups/cups.h, [hacups_h=yes],[hacups_h=no])
295
	AC_CHECK_PROG(hacups_cfg, cups-config, yes, no)
296
	echo "'$hacups_cfg' '$hacups_h'" >/tmp/cfg
297
	if test "x$hacups_h" = "xyes" && test "x$hacups_cfg" = "xyes"; then
298
		# We have the CUPS libs and headers, so enable
299
		# the use of CUPS and tell the build where to
300
		# find it.
301
		LIBCUPS="`cups-config --libs`"
302
		AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
303
		AC_SUBST(LIBCUPS)
304
		hacups=yes
305
	else
306
		AC_MSG_WARN([libcups could not be found. Printing functionality will be limited.])
307
		hacups=no
308
	fi
309
else
310
	hacups=no
779 fschmid 311
fi
312
 
313
COMPILE_DEBUG=no
2311 craig 314
AC_ARG_ENABLE(debug, [  --enable-debug     Enables debugging information (recommended for snapshots)],
1634 craig 315
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 316
	COMPILE_DEBUG=yes
317
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
318
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
319
fi])
320
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
321
 
1689 craig 322
dnl Compile and link the gdk-pixbuf sources unless building
323
dnl a Mac-native build.
324
AM_CONDITIONAL(LINK_PIXBUF, test "$enable_mac" != "yes" )
325
 
1699 craig 326
build_mac_bundle=no
2311 craig 327
AC_ARG_ENABLE(bundle, [  --enable-bundle     Make an executable suitable for use in a .app bundle (INCOMPLETE)],
1699 craig 328
[if test "$enable_bundle" = "yes"; then
329
	build_mac_bundle=yes
330
	AC_DEFINE_UNQUOTED(BUILD_MAC_BUNDLE, 1, [Are we building an executable to be included in MacOS/X .app bundle?])
331
fi])
332
AM_CONDITIONAL(BUILD_MAC_BUNDLE, test "$build_mac_bundle" = "yes")
333
 
1732 craig 334
dnl Some platforms require special libtool flags to build dynamically loadable
335
dnl modules or plugins correctly. While libtool should take care of this with
336
dnl a fixed set of arguments, in case we need to change it later this is being
337
dnl made a configure-time substitution.
338
MODULE_LINK_FLAGS=" -module "
339
AC_SUBST(MODULE_LINK_FLAGS)
340
 
779 fschmid 341
all_libraries="$all_libraries $USER_LDFLAGS"
342
all_includes="$all_includes $USER_INCLUDES"
343
AC_SUBST(all_includes)
344
AC_SUBST(all_libraries)
345
 
346
AC_PATH_QT
347