Subversion Repositories Scribus

Rev

Rev 1592 | Rev 1599 | 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
 
51
LIBFREETYPE_LIBS=""
52
LIBFREETYPE_CFLAGS=""
53
 
54
FREETYPE_CONFIG=""
55
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])
56
 
57
hafree=no
58
if test -n "$FREETYPE_CONFIG"; then
59
	LIBFREETYPE_LIBS="`$FREETYPE_CONFIG --libs`"
60
  LIBFREETYPE_CFLAGS="`$FREETYPE_CONFIG --cflags`"
61
	AC_CHECK_LIB(freetype, FT_Get_First_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
62
	AC_CHECK_LIB(freetype, FT_Get_Next_Char, [hafree=yes],[hafree=no], "$LIBFREETYPE_LIBS")
63
	if test $hafree = yes; then
64
		AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1, [Defines if your system has the libfreetype library])
65
	else
66
  	AC_MSG_ERROR([You need at least freetype 2.1.0])
67
	fi
68
	AC_SUBST(LIBFREETYPE_LIBS)
69
	AC_SUBST(LIBFREETYPE_CFLAGS)
70
else
71
  AC_MSG_ERROR([You need at least freetype 2.1.0])
72
fi
73
 
1592 craig 74
dnl Try to find fontconfig using fontconfig-config or pkg-config.
779 fschmid 75
LIBFONTCONFIG_LIBS=""
76
LIBFONTCONFIG_CFLAGS=""
77
FONTCONFIG_CONFIG=""
1592 craig 78
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 79
 
80
hafontconfig=no
81
if test -n "$FONTCONFIG_CONFIG"; then
1592 craig 82
	dnl found fontconfig-config, use it's results
779 fschmid 83
	LIBFONTCONFIG_LIBS="`$FONTCONFIG_CONFIG --libs`"
84
	LIBFONTCONFIG_CFLAGS="`$FONTCONFIG_CONFIG --cflags`"
1592 craig 85
elif test -n "$PKG_CONFIG"; then
86
	dnl Try to find fontconfig with pkg-config
87
	LIBFONTCONFIG_LIBS="`$PKG_CONFIG fontconfig --libs`"
88
	LIBFONTCONFIG_CFLAGS="`$PKG_CONFIG fontconfig --cflags`"
779 fschmid 89
else
1592 craig 90
	AC_MSG_WARN([Couldn't find fontconfig-config or pkg-config])
779 fschmid 91
fi
1592 craig 92
AC_CHECK_LIB(fontconfig, FcPatternBuild, [hafontconfig=yes],[hafontconfig=no])
93
if test $hafontconfig = yes; then
94
	AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1, [Defines if your system has the libfontconfig library])
95
else
96
	AC_MSG_WARN([Couldn't find a usable libfontconfig])
97
fi
98
AC_SUBST(LIBFONTCONFIG_LIBS)
99
AC_SUBST(LIBFONTCONFIG_CFLAGS)
779 fschmid 100
 
1592 craig 101
 
779 fschmid 102
XML_LIBS=""
103
XML_CFLAGS=""
104
 
105
XML_CONFIG=""
106
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])
107
 
108
haxml=no
109
if test -n "$XML_CONFIG"; then
110
	XML_LIBS="`$XML_CONFIG --libs`"
111
	XML_CFLAGS="`$XML_CONFIG --cflags`"
112
	AC_CHECK_LIB(xml2, attribute, [haxml=yes],[haxml=no])
113
	if test $haxml = yes; then
114
		AC_DEFINE_UNQUOTED(HAVE_XML, 1, [Defines if your system has the libxml2 library])
115
		AC_SUBST(XML_LIBS)
116
		AC_SUBST(XML_CFLAGS)
117
	fi
118
	vers=`$XML_CONFIG --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
119
  	if test -n "$vers" && test "$vers" -ge 2006000
120
	then
121
		AC_DEFINE_UNQUOTED(HAVE_XML26, 1, [Defines if your system has the libxml2 library6])
122
	fi
123
fi
124
 
125
AC_CHECK_LIB(socket,socket,
126
if test "$uname" != "IRIX"; then
127
	LIBS="-lsocket $LIBS"
128
else
129
	echo "Not using -lsocket since you are running IRIX."
130
fi)
131
AC_CHECK_LIB(nsl,gethostbyaddr,
132
if test "$uname" != "IRIX"; then
133
	LIBS="-lnsl $LIBS"
134
else
135
	echo "Not using -lnsl since you are running IRIX."
136
fi)
137
LIBCUPS=""
138
hacups=
139
AC_CHECK_PROG(hacups, cups-config, yes)
140
if test x"$hacups" = x"yes"
141
then
142
	LIBCUPS="`cups-config --libs`"
143
	AC_SUBST(LIBCUPS)
144
fi
145
 
1595 craig 146
dnl Check for lcms
147
dnl TODO look for lcms using pkg-config too
779 fschmid 148
LIBLCMS=""
149
hacms=
150
AC_CHECK_LIB(lcms, _cmsChannelsOf, [LIBLCMS="-llcms";hacms=yes],[LIBLCMS="";hacms=no],[-lm])
151
hacmsh=
1595 craig 152
lcms_h=
779 fschmid 153
AC_CHECK_HEADER(lcms.h, [hacmsh=yes],[hacmsh=no])
154
if test $hacmsh = no; then
155
	AC_CHECK_HEADER(lcms/lcms.h, [hacmsh=yes],[hacmsh=no])
156
	if test $hacmsh = yes; then
1595 craig 157
		AC_DEFINE_UNQUOTED(CMS_INC, "lcms/lcms.h", [ColorManagementInclude])
158
		lcms_h="lcms/lcms.h"
779 fschmid 159
	fi
160
else
1595 craig 161
	AC_DEFINE_UNQUOTED(CMS_INC, "lcms.h", [ColorManagementInclude])
162
	lcms_h="lcms.h"
779 fschmid 163
fi
1595 craig 164
if test $hacmsh = no; then
165
	dnl There's not much point finding -llcms if we can't find the header file...
166
	hacms=no
167
fi
168
dnl Attempt to check that lcms is new enough
169
if test $hacms = yes; then
170
	AC_MSG_CHECKING(liblcms version > 1.1.2)
171
	AC_TRY_COMPILE([
172
	#include "$lcms_h"
173
	#if LCMS_VERSION < 112
174
	#error liblcms is too old, need LittleCMS 1.1.2 or newer
175
	#endif
176
	], [], [], [hacms=pre112])
177
	AC_MSG_RESULT($hacms)
178
fi
179
 
779 fschmid 180
AC_SUBST(LIBLCMS)
181
if test $hacms = yes && test $hacmsh = yes; then
182
 AC_DEFINE_UNQUOTED(HAVE_CMS, 1, [ColorManagement])
183
fi
1580 craig 184
 
185
dnl Checks for libtiff - library exists, tiffvers.h can be found, and new enough.
779 fschmid 186
LIBTIFF=""
187
hastif=
1580 craig 188
dnl Check if we have libtiff
779 fschmid 189
AC_CHECK_LIB(tiff, TIFFOpen, [LIBTIFF="-ltiff";hastif=yes],[LIBTIFF="";hastif=no],[-lm])
1585 craig 190
if test $hastif = yes; then
191
	dnl Check for tiffvers.h
192
	AC_CHECK_HEADER(tiffvers.h, [], [LIBTIFF="";hastif=no])
193
	if test $hastif = yes; then
194
		dnl Now attempt to check if libtiff is new enough
195
		AC_MSG_CHECKING(libtiff version > 3.6.0)
196
		AC_TRY_COMPILE([
197
		#include "tiffvers.h"
198
		#if TIFFLIB_VERSION < 20031007
199
		#error libtiff is too old, need libtiff 3.6.0 or newer.
200
		#endif
201
		], [], [], [LIBTIFF="";hastif=pre36])
202
		AC_MSG_RESULT($hastif)
203
	fi
204
fi
779 fschmid 205
AC_SUBST(LIBTIFF)
206
if test $hastif = yes; then
207
 AC_DEFINE_UNQUOTED(HAVE_TIFF, 1, [Tifflib])
208
fi
1580 craig 209
 
779 fschmid 210
LIBDL2=""
211
AC_CHECK_LIB(c, dlopen, [LIBDL2="-lc"],[LIBDL2=""])
212
AC_SUBST(LIBDL2)
213
 
214
dnl generate the config header
215
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
216
 
217
dnl Checks for programs.
218
AC_CHECK_COMPILERS
219
AC_ENABLE_SHARED(yes)
220
AC_ENABLE_STATIC(no)
221
KDE_PROG_LIBTOOL
222
 
223
hapython=yes
224
kde_python_link_found=no
225
KDE_CHECK_PYTHON(1.5)
226
COMPILE_PYTHON=no
227
AC_ARG_WITH(python, [  --without-python     Do not compile the Scripter Plugin],[ COMPILE_PYTHON=no ],[ COMPILE_PYTHON=yes ])
228
if test $kde_python_link_found = no; then
229
	COMPILE_PYTHON=no
230
fi
231
if test $kde_python_link_found = yes; then
232
  AC_CHECK_HEADER(python2.3/Python.h, [foo=""],[hapython=no])
233
   if test $hapython = yes; then
234
    AC_DEFINE_UNQUOTED(HAVE_PYTHON_23, 1, [Python])
235
   fi
236
fi
237
AM_CONDITIONAL(COMPILE_PYTHON, test x$COMPILE_PYTHON = xyes)
238
 
239
AC_CHECK_HEADER(cups/cups.h, [foo=""],[hacups=no])
240
if test $hacups = yes; then
241
 AC_DEFINE_UNQUOTED(HAVE_CUPS, 1, [Cups])
242
fi
243
 
244
COMPILE_DEBUG=no
245
AC_ARG_ENABLE(debug, [  --enable-debug     Enables Debug-Code],
246
[if test "x$enable_debug" = "xyes"; then
247
	COMPILE_DEBUG=yes
248
    CXXFLAGS="$CXXFLAGS -g3 -fno-inline -O0 "
249
    CFLAGS="$CFLAGS -g3 -fno-inline -O0 "
250
fi])
251
AM_CONDITIONAL(COMPILE_DEBUG, test x$COMPILE_DEBUG = xyes)
252
 
253
all_libraries="$all_libraries $USER_LDFLAGS"
254
all_includes="$all_includes $USER_INCLUDES"
255
AC_SUBST(all_includes)
256
AC_SUBST(all_libraries)
257
 
258
AC_PATH_QT
259