Subversion Repositories Scribus

Rev

Rev 1599 | Rev 1635 | 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
1592 craig 114
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
115
if test $hafontconfig = yes; then
116
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
117
else
118
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
119
fi
120
AC_SUBST(LIBFONTCONFIG_LIBS)
121
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 122
 
1592 craig 123
 
779 fschmid 124
XML_LIBS=""
125
XML_CFLAGS=""
126
 
127
XML_CONFIG=""
128
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])
129
 
1599 craig 130
dnl check for LibXML2
779 fschmid 131
haxml=no
132
if test -n "$XML_CONFIG"; then
133
	XML_LIBS="`$XML_CONFIG --libs`"
134
	XML_CFLAGS="`$XML_CONFIG --cflags`"
135
	AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
136
	if test $haxml = yes; then
137
		AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
138
		AC_SUBST(XML_LIBS)
139
		AC_SUBST(XML_CFLAGS)
140
	fi
141
	vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
142
  	if test -n "$vers" && test "$vers" -ge 2006000
143
	then
144
		AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
145
	fi
146
fi
147
 
1599 craig 148
dnl check for -lsocket
779 fschmid 149
AC_CHECK_LIB(socket,socket,
150
if test "$uname" != "IRIX"; then
151
	LIBS="-lsocket $LIBS"
152
else
153
	echo "Not using -lsocket since you are running IRIX."
154
fi)
155
AC_CHECK_LIB(nsl,gethostbyaddr,
156
if test "$uname" != "IRIX"; then
157
	LIBS="-lnsl $LIBS"
158
else
159
	echo "Not using -lnsl since you are running IRIX."
160
fi)
161
LIBCUPS=""
162
hacups=
163
AC_CHECK_PROG(hacups, cups-config, yes)
164
if test x"$hacups" = x"yes"
165
then
166
	LIBCUPS="`cups-config --libs`"
167
	AC_SUBST(LIBCUPS)
168
fi
169
 
1595 craig 170
dnl Check for lcms
171
dnl TODO look for lcms using pkg-config too
779 fschmid 172
LIBLCMS=""
173
hacms=
174
AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
175
hacmsh=
1595 craig 176
lcms_h=
779 fschmid 177
AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
178
if test $hacmsh = no; then
179
	AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
180
	if test $hacmsh = yes; then
1595 craig 181
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
182
		lcms_h="lcms/lcms.h"
779 fschmid 183
	fi
184
else
1595 craig 185
	AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
186
	lcms_h="lcms.h"
779 fschmid 187
fi
1595 craig 188
if test $hacmsh = no; then
189
	dnl There's not much point finding -llcms if we can't find the header file...
190
	hacms=no
191
fi
192
dnl Attempt to check that lcms is new enough
193
if test $hacms = yes; then
194
	AC_MSG_CHECKING(liblcms version > 1.1.2)
195
	AC_TRY_COMPILE([
196
	#include "$lcms_h"
1599 craig 197
	],[
1595 craig 198
	#if LCMS_VERSION < 112
199
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
200
	#endif
1599 craig 201
	], [], [hacms=pre112])
1595 craig 202
	AC_MSG_RESULT($hacms)
203
fi
204
 
779 fschmid 205
AC_SUBST(LIBLCMS)
206
if test $hacms = yes && test $hacmsh = yes; then
207
 AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
208
fi
1580 craig 209
 
210
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 211
LIBTIFF=""
212
hastif=
1580 craig 213
dnl Check if we have libtiff
779 fschmid 214
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 215
if test $hastif = yes; then
216
	dnl Check for tiffvers.h
217
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
218
	if test $hastif = yes; then
219
		dnl Now attempt to check if libtiff is new enough
220
		AC_MSG_CHECKING(libtiff version > 3.6.0)
221
		AC_TRY_COMPILE([
222
		#include "tiffvers.h"
1599 craig 223
		],[
1585 craig 224
		#if TIFFLIB_VERSION < 20031007
225
		#error libtiff is too old, need libtiff 3.6.0 or newer.
226
		#endif
1599 craig 227
		], [], [LIBTIFF="";hastif=pre36])
1585 craig 228
		AC_MSG_RESULT($hastif)
229
	fi
230
fi
779 fschmid 231
AC_SUBST(LIBTIFF)
232
if test $hastif = yes; then
233
 AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
234
fi
1580 craig 235
 
779 fschmid 236
LIBDL2=""
237
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
238
AC_SUBST(LIBDL2)
239
 
240
dnl generate the config header
241
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
242
 
243
dnl Checks for programs.
244
AC_CHECK_COMPILERS
245
AC_ENABLE_SHARED(yes)
246
AC_ENABLE_STATIC(no)
247
KDE_PROG_LIBTOOL
248
 
249
hapython=yes
250
kde_python_link_found=no
251
KDE_CHECK_PYTHON(1.5)
252
COMPILE_PYTHON=no
253
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
254
if test $kde_python_link_found = no; then
255
	COMPILE_PYTHON=no
256
fi
257
if test $kde_python_link_found = yes; then
258
  AC_CHECK_HEADER(python2.3/Python.h, [foo=""],[hapython=no])
259
   if test $hapython = yes; then
260
    AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
261
   fi
262
fi
263
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
264
 
265
AC_CHECK_HEADER(cups/cups.h, [foo=""],[hacups=no])
266
if test $hacups = yes; then
267
 AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
268
fi
269
 
270
COMPILE_DEBUG=no
271
AC_ARG_ENABLE(debug, [  --enable-debug     Enables Debug-Code],
1634 craig 272
[if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xfull"; then
779 fschmid 273
	COMPILE_DEBUG=yes
274
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
275
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
276
fi])
277
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
278
 
279
all_libraries="$all_libraries $USER_LDFLAGS"
280
all_includes="$all_includes $USER_INCLUDES"
281
AC_SUBST(all_includes)
282
AC_SUBST(all_libraries)
283
 
284
AC_PATH_QT
285