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