Subversion Repositories Scribus

Rev

Rev 1699 | Rev 1920 | 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.
779 fschmid 97
LIBFONTCONFIG_LIBS=""
98
LIBFONTCONFIG_CFLAGS=""
99
FONTCONFIG_CONFIG=""
1592 craig 100
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])
779 fschmid 101
 
102
hafontconfig=no
103
if test -n "$FONTCONFIG_CONFIG"; then
1592 craig 104
	dnl found fontconfig-config, use it's results
779 fschmid 105
	LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
106
	LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"
1592 craig 107
elif test -n "$PKG_CONFIG"; then
108
	dnl Try to find fontconfig with pkg-config
109
	LIBFONTCONFIG_LIBS="`$PKG_CONFIG fontconfig --libs`"
110
	LIBFONTCONFIG_CFLAGS="`$PKG_CONFIG fontconfig --cflags`"
779 fschmid 111
else
1592 craig 112
	AC_MSG_WARN([Couldn't find fontconfig-config or pkg-config])
779 fschmid 113
fi
1635 craig 114
 
115
dnl Check to see if we can compile fontconfig
116
SAVE_CFLAGS="${CFLAGS}"
117
SAVE_LDFLAGS="${LDFLAGS}"
118
CFLAGS="${CFLAGS} ${LIBFONTCONFIG_CFLAGS}"
119
LDFLAGS="${LDFLAGS} ${LIBFONTCONFIG_LIBS}"
1592 craig 120
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
1635 craig 121
CFLAGS="${SAVE_CFLAGS}"
122
LDFLAGS="${SAVE_LDFLAGS}"
1592 craig 123
if test $hafontconfig = yes; then
124
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
125
else
126
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
127
fi
128
AC_SUBST(LIBFONTCONFIG_LIBS)
129
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 130
 
1592 craig 131
 
779 fschmid 132
XML_LIBS=""
133
XML_CFLAGS=""
134
 
135
XML_CONFIG=""
136
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])
137
 
1599 craig 138
dnl check for LibXML2
779 fschmid 139
haxml=no
140
if test -n "$XML_CONFIG"; then
141
	XML_LIBS="`$XML_CONFIG --libs`"
142
	XML_CFLAGS="`$XML_CONFIG --cflags`"
143
	AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
144
	if test $haxml = yes; then
145
		AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
146
		AC_SUBST(XML_LIBS)
147
		AC_SUBST(XML_CFLAGS)
148
	fi
149
	vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
150
  	if test -n "$vers" && test "$vers" -ge 2006000
151
	then
152
		AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
153
	fi
154
fi
155
 
1599 craig 156
dnl check for -lsocket
779 fschmid 157
AC_CHECK_LIB(socket,socket,
158
if test "$uname" != "IRIX"; then
159
	LIBS="-lsocket $LIBS"
160
else
161
	echo "Not using -lsocket since you are running IRIX."
162
fi)
163
AC_CHECK_LIB(nsl,gethostbyaddr,
164
if test "$uname" != "IRIX"; then
165
	LIBS="-lnsl $LIBS"
166
else
167
	echo "Not using -lnsl since you are running IRIX."
168
fi)
169
LIBCUPS=""
170
hacups=
171
AC_CHECK_PROG(hacups, cups-config, yes)
172
if test x"$hacups" = x"yes"
173
then
174
	LIBCUPS="`cups-config --libs`"
175
	AC_SUBST(LIBCUPS)
176
fi
177
 
1595 craig 178
dnl Check for lcms
179
dnl TODO look for lcms using pkg-config too
779 fschmid 180
LIBLCMS=""
181
hacms=
182
AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
183
hacmsh=
1595 craig 184
lcms_h=
779 fschmid 185
AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
186
if test $hacmsh = no; then
187
	AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
188
	if test $hacmsh = yes; then
1595 craig 189
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
190
		lcms_h="lcms/lcms.h"
779 fschmid 191
	fi
192
else
1595 craig 193
	AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
194
	lcms_h="lcms.h"
779 fschmid 195
fi
1595 craig 196
if test $hacmsh = no; then
197
	dnl There's not much point finding -llcms if we can't find the header file...
198
	hacms=no
199
fi
200
dnl Attempt to check that lcms is new enough
201
if test $hacms = yes; then
202
	AC_MSG_CHECKING(liblcms version > 1.1.2)
203
	AC_TRY_COMPILE([
204
	#include "$lcms_h"
1599 craig 205
	],[
1595 craig 206
	#if LCMS_VERSION < 112
207
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
208
	#endif
1599 craig 209
	], [], [hacms=pre112])
1595 craig 210
	AC_MSG_RESULT($hacms)
211
fi
212
 
779 fschmid 213
AC_SUBST(LIBLCMS)
214
if test $hacms = yes && test $hacmsh = yes; then
215
 AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
216
fi
1580 craig 217
 
218
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 219
LIBTIFF=""
220
hastif=
1580 craig 221
dnl Check if we have libtiff
779 fschmid 222
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 223
if test $hastif = yes; then
224
	dnl Check for tiffvers.h
225
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
226
	if test $hastif = yes; then
227
		dnl Now attempt to check if libtiff is new enough
228
		AC_MSG_CHECKING(libtiff version > 3.6.0)
229
		AC_TRY_COMPILE([
230
		#include "tiffvers.h"
1599 craig 231
		],[
1585 craig 232
		#if TIFFLIB_VERSION < 20031007
233
		#error libtiff is too old, need libtiff 3.6.0 or newer.
234
		#endif
1599 craig 235
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 236
		AC_MSG_RESULT($hastif)
237
	fi
238
fi
779 fschmid 239
AC_SUBST(LIBTIFF)
240
if test $hastif = yes; then
241
 AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
242
fi
1580 craig 243
 
779 fschmid 244
LIBDL2=""
245
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
246
AC_SUBST(LIBDL2)
247
 
248
dnl generate the config header
249
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
250
 
251
dnl Checks for programs.
252
AC_CHECK_COMPILERS
253
AC_ENABLE_SHARED(yes)
254
AC_ENABLE_STATIC(no)
255
KDE_PROG_LIBTOOL
256
 
257
hapython=yes
258
kde_python_link_found=no
259
KDE_CHECK_PYTHON(1.5)
260
COMPILE_PYTHON=no
261
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
262
if test $kde_python_link_found = no; then
263
	COMPILE_PYTHON=no
264
fi
265
if test $kde_python_link_found = yes; then
266
  AC_CHECK_HEADER(python2.3/Python.h, [foo=""],[hapython=no])
267
   if test $hapython = yes; then
268
    AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
269
   fi
270
fi
271
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
272
 
273
AC_CHECK_HEADER(cups/cups.h, [foo=""],[hacups=no])
274
if test $hacups = yes; then
275
 AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
276
fi
277
 
278
COMPILE_DEBUG=no
279
AC_ARG_ENABLE(debug, [  --enable-debug     Enables Debug-Code],
1634 craig 280
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 281
	COMPILE_DEBUG=yes
282
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
283
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
284
fi])
285
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
286
 
1689 craig 287
dnl Compile and link the gdk-pixbuf sources unless building
288
dnl a Mac-native build.
289
AM_CONDITIONAL(LINK_PIXBUF, test "$enable_mac" != "yes" )
290
 
1699 craig 291
build_mac_bundle=no
292
AC_ARG_ENABLE(bundle, [  --enable-bundle     Make an executable suitable for use in a .app bundle],
293
[if test "$enable_bundle" = "yes"; then
294
	build_mac_bundle=yes
295
	AC_DEFINE_UNQUOTED(BUILD_MAC_BUNDLE, 1, [Are we building an executable to be included in MacOS/X .app bundle?])
296
fi])
297
AM_CONDITIONAL(BUILD_MAC_BUNDLE, test "$build_mac_bundle" = "yes")
298
 
1732 craig 299
dnl Some platforms require special libtool flags to build dynamically loadable
300
dnl modules or plugins correctly. While libtool should take care of this with
301
dnl a fixed set of arguments, in case we need to change it later this is being
302
dnl made a configure-time substitution.
303
MODULE_LINK_FLAGS=" -module "
304
AC_SUBST(MODULE_LINK_FLAGS)
305
 
779 fschmid 306
all_libraries="$all_libraries $USER_LDFLAGS"
307
all_includes="$all_includes $USER_INCLUDES"
308
AC_SUBST(all_includes)
309
AC_SUBST(all_libraries)
310
 
311
AC_PATH_QT
312