]> granicus.if.org Git - imagemagick/blob - configure.ac
(no commit message)
[imagemagick] / configure.ac
1 #  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
2 #  dedicated to making software imaging solutions freely available.
3 #
4 #  You may not use this file except in compliance with the License.  You may
5 #  obtain a copy of the License at
6 #
7 #    http://www.imagemagick.org/script/license.php
8 #
9 #  Unless required by applicable law or agreed to in writing, software
10 #  distributed under the License is distributed on an "AS IS" BASIS,
11 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #  See the License for the specific language governing permissions and
13 #  limitations under the License.
14 #
15 #  Copyright (C) 2003 - 2008 GraphicsMagick Group
16 #
17 #  Copying and distribution of this file, with or without modification,
18 #  are permitted in any medium without royalty provided the copyright
19 #  notice and this notice are preserved.
20
21 AC_PREREQ(2.69)
22
23 m4_define([magick_major_version], [7])
24 m4_define([magick_minor_version], [0])
25 m4_define([magick_micro_version], [0])
26 m4_define([magick_patchlevel_version], [0])
27 m4_define([magick_version],
28           [magick_major_version.magick_minor_version.magick_micro_version-magick_patchlevel_version])
29 m4_define([magick_svn_revision], esyscmd([sh -c "(svnversion .) | awk '{ print \$1 }' | tr -d '\n'"]))
30
31 AC_INIT([ImageMagick],[magick_version],[http://www.imagemagick.org],[ImageMagick])
32 AC_CONFIG_SRCDIR([MagickCore/MagickCore.h])
33 AC_CONFIG_AUX_DIR([config])
34 AC_REQUIRE_AUX_FILE([tap-driver.sh])
35 AC_CONFIG_MACRO_DIR([m4])
36 AC_CONFIG_HEADERS([config/config.h])
37 AX_PREFIX_CONFIG_H([MagickCore/magick-baseconfig.h],[MagickCore])
38 AC_CONFIG_FILES([\
39     common.shi \
40     config/configure.xml \
41     config/delegates.xml \
42     config/ImageMagick.rdf \
43     config/MagickCore.dox \
44     config/MagickWand.dox \
45     config/Magick++.dox \
46     config/type-dejavu.xml \
47     config/type-ghostscript.xml \
48     config/type-windows.xml \
49     config/type.xml \
50     ImageMagick.spec \
51     Magick++/bin/Magick++-config \
52     MagickCore/ImageMagick.pc \
53     Magick++/lib/ImageMagick++.pc \
54     Magick++/lib/Magick++.pc \
55     MagickCore/MagickCore-config \
56     MagickCore/MagickCore.pc \
57     MagickCore/version.h \
58     Makefile \
59     magick.sh \
60     PerlMagick/Magick.pm \
61     PerlMagick/Makefile.PL \
62     PerlMagick/check.sh \
63     utilities/animate.1 \
64     utilities/compare.1 \
65     utilities/composite.1 \
66     utilities/conjure.1 \
67     utilities/convert.1 \
68     utilities/display.1 \
69     utilities/identify.1 \
70     utilities/ImageMagick.1 \
71     utilities/import.1 \
72     utilities/mogrify.1 \
73     utilities/montage.1 \
74     utilities/stream.1 \
75     MagickWand/MagickWand-config \
76     MagickWand/MagickWand.pc ])
77
78 #
79 # Save initial user-tunable values
80 #
81 USER_LIBS=$LIBS
82 for var in CC CFLAGS CPPFLAGS CXX CXXCPP LDFLAGS LIBS ; do
83   eval isset=\${$var+set}
84     if test "$isset" = 'set'; then
85         eval val=$`echo $var`
86         DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS}'${var}=${val}' "
87     fi
88 done
89 AC_SUBST(DISTCHECK_CONFIG_FLAGS)
90
91 CONFIGURE_ARGS="$0 ${ac_configure_args}"
92 AC_SUBST(CONFIGURE_ARGS)
93
94 # Source file containing package/library versioning information.
95 . ${srcdir}/version.sh
96
97 echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}${PACKAGE_VERSION_ADDENDUM}"
98 AC_CANONICAL_SYSTEM
99 AC_CANONICAL_BUILD
100 AC_CANONICAL_HOST
101 AC_CANONICAL_TARGET
102
103 MAGICK_TARGET_CPU=$host_cpu
104 AC_SUBST(MAGICK_TARGET_CPU)
105 AC_DEFINE_UNQUOTED(MAGICK_TARGET_CPU,$MAGICK_TARGET_CPU,[Target Host CPU])
106
107 MAGICK_TARGET_VENDOR=$host_vendor
108 AC_SUBST(MAGICK_TARGET_VENDOR)
109 AC_DEFINE_UNQUOTED(MAGICK_TARGET_VENDOR,$MAGICK_TARGET_VENDOR,[Target Host Vendor])
110
111 MAGICK_TARGET_OS=$host_os
112 AC_SUBST(MAGICK_TARGET_OS)
113 AC_DEFINE_UNQUOTED(MAGICK_TARGET_OS,$MAGICK_TARGET_OS,[Target Host OS])
114
115 # Substitute library versioning
116 AC_SUBST(MAGICK_LIBRARY_CURRENT)dnl
117 AC_SUBST(MAGICK_LIBRARY_REVISION)dnl
118 AC_SUBST(MAGICK_LIBRARY_AGE)dnl
119 AC_SUBST([MAGICK_LIBRARY_CURRENT_MIN],
120          [`expr $MAGICK_LIBRARY_CURRENT - $MAGICK_LIBRARY_AGE`])
121 AC_SUBST([MAGICK_LIBRARY_VERSION_INFO],
122          [$MAGICK_LIBRARY_CURRENT:$MAGICK_LIBRARY_REVISION:$MAGICK_LIBRARY_AGE])
123 AC_SUBST([MAGICK_SVN_REVISION],[magick_svn_revision])
124
125 AC_SUBST(PACKAGE_NAME)dnl
126 AC_SUBST(PACKAGE_VERSION)dnl
127 AC_SUBST(PACKAGE_PERL_VERSION)dnl
128 AC_SUBST(PACKAGE_RELEASE)dnl
129 AC_SUBST(PACKAGE_CHANGE_DATE)dnl
130 AC_SUBST(PACKAGE_LIB_VERSION)dnl
131 AC_SUBST(PACKAGE_LIB_VERSION_NUMBER)dnl
132 AC_SUBST(PACKAGE_RELEASE_DATE)dnl
133 AC_SUBST(PACKAGE_VERSION_ADDENDUM)dnl
134
135 # Ensure that make can run correctly
136 AM_SANITY_CHECK
137
138 AM_INIT_AUTOMAKE([1.11 color-tests foreign parallel-tests silent-rules subdir-objects dist-bzip2 dist-lzip dist-xz dist-zip])
139
140 # Enable support for silent build rules
141 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
142
143 MAGICK_LIB_VERSION="0x"
144 if test ${MAGICK_LIBRARY_CURRENT} -lt 10 ; then
145   MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
146 fi
147 MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_CURRENT}
148 if test ${MAGICK_LIBRARY_AGE} -lt 10 ; then
149   MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
150 fi
151 MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_AGE}
152 if test ${MAGICK_LIBRARY_REVISION} -lt 10 ; then
153   MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
154 fi
155 MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_REVISION}
156 AC_SUBST(MAGICK_LIB_VERSION)
157
158 # Definition used to define MagickLibVersionText in version.h
159 MAGICK_LIB_VERSION_TEXT="${PACKAGE_VERSION}"
160 AC_SUBST(MAGICK_LIB_VERSION_TEXT)
161
162 # Definition used to define MagickLibVersionNumber in version.h
163 MAGICK_LIB_VERSION_NUMBER="${MAGICK_LIBRARY_CURRENT},${MAGICK_LIBRARY_AGE},${MAGICK_LIBRARY_REVISION}"
164 AC_SUBST(MAGICK_LIB_VERSION_NUMBER)
165
166 # Regenerate config.status if ChangeLog or version.sh is updated.
167 AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/version.sh'])
168
169 PERLMAINCC=$CC
170
171 MAGICK_CFLAGS=''
172 MAGICK_CPPFLAGS=$CPPFLAGS_USER
173 MAGICK_PCFLAGS=$CPPFLAGS_USER
174 MAGICK_LDFLAGS=''
175 MAGICK_LIBS=''
176 MAGICK_FEATURES=''
177
178 #
179 # Evaluate shell variable equivalents to Makefile directory variables
180 #
181 if test "x$prefix" = xNONE; then
182     prefix=$ac_default_prefix
183 fi
184 # Let make expand exec_prefix.
185 if test "x$exec_prefix" = xNONE; then
186     exec_prefix='${prefix}'
187 fi
188
189 #
190 eval "eval PREFIX_DIR=${prefix}"
191 AC_SUBST(PREFIX_DIR)
192 eval "eval EXEC_PREFIX_DIR=${exec_prefix}"
193 AC_SUBST(EXEC_PREFIX_DIR)
194 eval "eval BIN_DIR=$bindir"
195 AC_SUBST(BIN_DIR)
196 eval "eval SBIN_DIR=$sbindir"
197 AC_SUBST(SBIN_DIR)
198 eval "eval LIBEXEC_DIR=$libexecdir"
199 AC_SUBST(LIBEXEC_DIR)
200 eval "eval DATA_DIR=$datadir"
201 AC_SUBST(DATA_DIR)
202 eval "eval DOC_DIR=$datadir/doc"
203 AC_SUBST(DOC_DIR)
204 eval "eval SYSCONF_DIR=$sysconfdir"
205 AC_SUBST(SYSCONF_DIR)
206 eval "eval SHAREDSTATE_DIR=$sharedstatedir"
207 AC_SUBST(SHAREDSTATE_DIR)
208 eval "eval LOCALSTATE_DIR=$localstatedir"
209 AC_SUBST(LOCALSTATE_DIR)
210 eval "eval LIB_DIR=$libdir"
211 AC_SUBST(LIB_DIR)
212 eval "eval INCLUDE_DIR=$includedir"
213 AC_SUBST(INCLUDE_DIR)
214 eval "eval PERSISTINCLUDE_DIR=$oldincludedir"
215 AC_SUBST(PERSISTINCLUDE_DIR)
216 eval "eval INFO_DIR=$infodir"
217 AC_SUBST(INFO_DIR)
218 eval "eval MAN_DIR=$mandir"
219 AC_SUBST(MAN_DIR)
220
221 # Get full paths to source and build directories
222 srcdirfull="`cd $srcdir && pwd`"
223 builddir="`pwd`"
224
225 #
226 # Compute variables useful for running uninstalled software.
227 #
228 MAGICK_CODER_MODULE_PATH="${builddir}/coders"
229 MAGICK_CONFIGURE_SRC_PATH="${srcdirfull}/config"
230 MAGICK_CONFIGURE_BUILD_PATH="${builddir}/config"
231 MAGICK_FILTER_MODULE_PATH="${builddir}/filters"
232 DIRSEP=':'
233 case "${build_os}" in
234     mingw* )
235         MAGICK_CODER_MODULE_PATH=`$WinPathScript "${MAGICK_CODER_MODULE_PATH}" 0`
236         MAGICK_CONFIGURE_SRC_PATH=`$WinPathScript "${MAGICK_CONFIGURE_SRC_PATH}" 0`
237         MAGICK_CONFIGURE_BUILD_PATH=`$WinPathScript "${MAGICK_CONFIGURE_BUILD_PATH}" 0`
238         MAGICK_FILTER_MODULE_PATH=`$WinPathScript "${MAGICK_FILTER_MODULE_PATH}" 0`
239         DIRSEP=';'
240     ;;
241 esac
242 case "${host_os}" in
243   mingw* )
244     DIRSEP=';'
245     ;;
246 esac
247 AC_SUBST(MAGICK_CODER_MODULE_PATH)
248 AC_SUBST(MAGICK_CONFIGURE_SRC_PATH)
249 AC_SUBST(MAGICK_CONFIGURE_BUILD_PATH)
250 AC_SUBST(MAGICK_FILTER_MODULE_PATH)
251 AC_SUBST(DIRSEP)
252
253
254 #
255 # Enable OS features.
256 #
257 AC_USE_SYSTEM_EXTENSIONS
258
259 # Check for programs
260 AC_PROG_CC
261 AC_PROG_CXX
262 AC_PROG_CC_STDC
263 AC_PROG_CPP
264 AC_PROG_LD
265 AC_SUBST(LD)
266 AC_PROG_CC_C99
267 AM_PROG_CC_C_O
268 AX_CFLAGS_WARN_ALL
269 AX_COMPILER_VENDOR
270 AC_PROG_INSTALL
271 AC_PROG_MAKE_SET
272 AC_PROG_LN_S
273 AC_PROG_AWK
274 AM_WITH_DMALLOC
275 AX_C___ATTRIBUTE__
276 AX_GCC_ARCHFLAG([no])
277 PKG_PROG_PKG_CONFIG
278
279 # Check for linker script support 
280 gl_LD_VERSION_SCRIPT
281
282 #
283 # Enable run-time checking.
284 #
285 AC_ARG_ENABLE([bounds-checking],
286     [AC_HELP_STRING([--enable-bounds-checking],
287                     [enable run-time bounds-checking])],
288     [enable_bounds_checking=$enableval],
289     [enable_bounds_checking='no'])
290
291 if test "$enable_bounds_checking" = yes; then
292   AC_DEFINE([_FORTIFY_SOURCE], [2],
293     [enable run-time bounds-checking])
294 fi
295
296 #
297 # Tests for Windows
298 #
299 AC_EXEEXT
300 AC_OBJEXT
301
302 GDI32_LIBS=''
303 native_win32_build='no'
304 cygwin_build='no'
305 case "${host_os}" in
306     cygwin* )
307         cygwin_build='yes'
308         GDI32_LIBS='-lgdi32'
309     ;;
310     mingw* )
311         native_win32_build='yes'
312         GDI32_LIBS='-lgdi32'
313     ;;
314 esac
315 if test "${GDI32_LIBS}x" != 'x'; then
316     AC_DEFINE(WINGDI32_DELEGATE,1,Define to use the Windows GDI32 library)
317 fi
318 AC_SUBST(GDI32_LIBS)
319 AM_CONDITIONAL(WINGDI32_DELEGATE, test "${GDI32_LIBS}x" != 'x' )
320 AM_CONDITIONAL(WIN32_NATIVE_BUILD, test "${native_win32_build}" = 'yes' )
321 AM_CONDITIONAL(CYGWIN_BUILD, test "${cygwin_build}" = 'yes' )
322 AM_CONDITIONAL(USING_CL, test "x${CC}" = 'xcl.exe' )
323
324 WinPathScript="${srcdirfull}/winpath.sh"
325 AC_SUBST(WinPathScript)
326
327 #
328 # Compiler flags tweaks
329 #
330 if test "${GCC}" != "yes"; then
331     case "${host}" in
332         *-*-hpux* )
333             # aCC: HP ANSI C++ B3910B A.03.34
334             CFLAGS="${CFLAGS} -Wp,-H30000"
335             if test -n "${CXXFLAGS}"; then
336                 CXXFLAGS='-AA'
337             else
338                 CXXFLAGS="${CXXFLAGS} -AA"
339             fi
340         ;;
341         *-dec-osf5.* )
342             # Compaq alphaev68-dec-osf5.1 compiler
343             if test -n "${CXXFLAGS}"; then
344                 CXXFLAGS='-std strict_ansi -noimplicit_include'
345             else
346                 CXXFLAGS="${CXXFLAGS} -std strict_ansi -noimplicit_include"
347             fi
348   esac
349 fi
350
351 # Check for lazy-loading.
352 AC_CACHE_CHECK([for linker lazyload option],[im_cv_ld_lazyload],
353 [
354 im_cv_ld_lazyload='none'
355 case "${host}" in
356   *-*-solaris2.8 | *-*-solaris2.9 | *-*-solaris2.1? )
357     if test "$lt_cv_prog_gnu_ld" != 'yes' ; then
358        im_cv_ld_lazyload='-Wl,-zlazyload'
359     fi
360     ;;
361 esac
362 ])
363 if test "${im_cv_ld_lazyload}" != 'none' ; then
364   if test -z "${LDFLAGS}" ; then
365     LDFLAGS="${im_cv_ld_lazyload}"
366   else
367     LDFLAGS="${im_cv_ld_lazyload} ${LDFLAGS}"
368   fi
369 fi
370
371 dnl Platform-specific stuff
372 case "$host" in
373 *darwin* | *-macos10*)
374   dnl OS X universal binary support, requires --disable-dependency-tracking
375   AC_ARG_ENABLE([osx-universal-binary],
376         AC_HELP_STRING([--enable-osx-universal-binary],
377            [build universal binary on OS X [[default=no]]]),
378         [build_osxuniversal="${enableval}"], [build_osxuniversal=no])
379
380   if test "${build_osxuniversal}" != no ; then
381     if test "$enable_dependency_tracking" != no ; then
382       AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
383 Please re-run configure with these options:
384   --disable-dependency-tracking --enable-osx-universal-binary
385         ])
386     fi
387     CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
388     CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
389     LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
390   fi
391   ;;
392 esac
393
394 #
395 # ARCH specific include directory
396 #
397 AC_ARG_WITH([includearch-dir],
398     [AC_HELP_STRING([--includearch-dir=DIR],
399                     [ARCH specific include directory])],
400                     [includearch_dir=$withval],
401                     [includearch_dir=$INCLUDE_DIR])
402
403 eval "eval INCLUDEARCH_DIR=$includearch_dir"
404 AC_SUBST(INCLUDEARCH_DIR)
405
406 #
407 # ARCH specific configuration directory
408 #
409 AC_ARG_WITH([sharearch-dir],
410     [AC_HELP_STRING([--sharearch-dir=DIR],
411                     [ARCH specific config directory])],
412                     [sharearch_dir=$withval],
413                     [sharearch_dir="${LIB_DIR}"])
414
415 eval "eval SHAREARCH_DIR=$sharearch_dir"
416 AC_SUBST(SHAREARCH_DIR)
417
418 #
419 # Enable support for threads
420 AC_ARG_WITH([threads],
421     [AC_HELP_STRING([--without-threads], [disable threads support])],
422     [with_threads=$withval],
423     [with_threads='yes'])
424
425 have_threads=no
426 if test "$with_threads" != 'no'; then
427     AX_PTHREAD()
428     if test "$ax_pthread_ok" = yes; then
429         have_threads=yes
430         DEF_THREAD="$PTHREAD_CFLAGS"
431         CFLAGS="$CFLAGS $DEF_THREAD"
432         CXXFLAGS="$CXXFLAGS $DEF_THREAD"
433         if test "$CC" != "$PTHREAD_CC"; then
434             AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
435             CC="$PTHREAD_CC"
436         fi
437         AC_DEFINE(THREAD_SUPPORT,1,[Define if you have POSIX threads libraries and header files.])
438     fi
439 fi
440
441 # Enable support for OpenMP
442 if test "$have_threads" != 'yes'; then
443   ac_cv_prog_c_openmp=unsupported
444 fi
445 AC_OPENMP([C])
446 CFLAGS="$OPENMP_CFLAGS $CFLAGS"
447 MAGICK_PCFLAGS="$MAGICK_PCFLAGS $OPENMP_CFLAGS"
448 AC_SUBST(OPENMP_CFLAGS)
449 if test "$enable_openmp" != no; then
450   if test "$ac_cv_prog_c_openmp" != 'unsupported'; then
451     MAGICK_FEATURES="OpenMP $MAGICK_FEATURES"
452   fi
453 fi
454
455 # Enable support for OpenCL
456 AX_OPENCL([C])
457 CFLAGS="$CL_CFLAGS $CFLAGS"
458 LIBS="$CL_LIBS $LIBS"
459 AC_SUBST(CL_CFLAGS)
460 if test "$enable_opencl" != no; then
461   if test "X$ax_cv_check_cl_libcl" != Xno; then :
462     MAGICK_FEATURES="OpenCL $MAGICK_FEATURES"
463   fi
464 fi
465
466 ########
467 #
468 # Check for large file support
469 #
470 ########
471 AC_SYS_LARGEFILE
472 AC_FUNC_FSEEKO
473 LFS_CPPFLAGS=''
474 if test "$enable_largefile" != no; then
475     case $ac_cv_sys_file_offset_bits in
476     no)
477         # nothing to do here as the host supports LFS fine
478         ;;
479     unknown)
480         AC_MSG_CHECKING([for native large file support])
481         AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>
482           main () {
483           exit(!(sizeof(off_t) == 8));
484         }])],
485         [ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
486          AC_MSG_RESULT([yes])],
487         [AC_MSG_RESULT([no])])
488         ;;
489     *)
490         LFS_CPPFLAGS="$LFS_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
491         ;;
492     esac
493     if test "$ac_cv_sys_large_files" != 'no'; then
494         LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGE_FILES=1"
495     fi
496     if test "$ac_cv_sys_largefile_source" != 'no'; then
497         LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGEFILE_SOURCE=1"
498     fi
499 fi
500 AC_SUBST(LFS_CPPFLAGS)
501
502 # Configure libtool
503 AC_LIBTOOL_DLOPEN
504 LT_INIT([win32-dll])
505 LT_LANG([C++])
506 AC_SUBST(LIBTOOL_DEPS)
507
508 # Check to see if building shared libraries
509 libtool_build_shared_libs='no'
510 if test "$enable_shared" = 'yes'; then
511     libtool_build_shared_libs='yes'
512 fi
513
514 # Check to see if building static libraries
515 libtool_build_static_libs='no'
516 if test "$enable_static" = 'yes'; then
517     libtool_build_static_libs='yes'
518 fi
519
520 AM_CONDITIONAL(WITH_SHARED_LIBS, test "${libtool_build_shared_libs}" = 'yes')
521 #
522 # Enable support for building loadable modules
523 #
524 build_modules='no'
525 AC_ARG_WITH([modules],
526     [AC_HELP_STRING([--with-modules],
527                     [enable building dynamically loadable modules])],
528     [with_modules=$withval],
529     [with_modules='no'])
530
531 # Only allow building loadable modules if we are building shared libraries
532 if test "$with_modules" != 'no' ; then
533     if test "$libtool_build_shared_libs" = 'no'; then
534         AC_MSG_WARN([Modules may only be built if building shared libraries is enabled.])
535     build_modules='no'
536   else
537     build_modules='yes'
538   fi
539 fi
540 if test "$build_modules" != 'no' ; then
541     AC_DEFINE(BUILD_MODULES,1,Define if coders and filters are to be built as modules.)
542     MAGICK_FEATURES="$MAGICK_FEATURES Modules"
543 fi
544 AM_CONDITIONAL(WITH_MODULES, test "$build_modules" != 'no')
545
546 # Enable build using delegate libraries built in subdirectories rather than installed
547 # delegate libraries (bzlib fftw fpx gslib jp2 jbig jpeg lcms lzma png tiff ttf wmf xml zlib)
548 AC_ARG_ENABLE([delegate-build],
549     [AC_HELP_STRING([--enable-delegate-build],
550                     [look for delegate libraries in build directory])],
551     [enable_delegate_build=$enableval],
552     [enable_delegate_build='no'])
553
554 AC_ARG_ENABLE([deprecated],
555     [AC_HELP_STRING([--disable-deprecated],
556                     [exclude deprecated methods in MagickCore and MagickWand APIs])],
557     [enable_deprecated=$enableval],
558     [enable_deprecated='no'])
559
560 if test "$enable_deprecated" = 'yes'; then
561   AC_DEFINE(EXCLUDE_DEPRECATED,1,[exclude deprecated methods in MagickCore API])
562 else
563   DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-deprecated "
564 fi
565
566 # Build a version of ImageMagick which operates uninstalled.
567 # Used to build distributions located via MAGICK_HOME / executable path
568 AC_ARG_ENABLE([installed],
569     [AC_HELP_STRING([--disable-installed],
570                     [Formally install ImageMagick under PREFIX])],
571     [enable_installed=$enableval],
572     [enable_installed='yes'])
573
574 if test "$enable_installed" = 'yes'; then
575     AC_DEFINE(INSTALLED_SUPPORT,1,[ImageMagick is formally installed under prefix])
576 else
577     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-installed "
578 fi
579
580 # Permit enciphering and deciphering image pixels.
581 AC_ARG_ENABLE([cipher],
582     [AC_HELP_STRING([--disable-cipher],
583                     [disable enciphering and deciphering image pixels])],
584     [enable_cipher=$enableval],
585     [enable_cipher='yes'])
586
587 if test "$enable_cipher" = 'yes'; then
588     AC_DEFINE(CIPHER_SUPPORT,1,[permit enciphering and deciphering image pixels])
589 fi
590
591 # Build a zero-configuration version of ImageMagick.
592 AC_ARG_ENABLE([zero-configuration],
593     [AC_HELP_STRING([--enable-zero-configuration],
594                     [enable self-contained, embeddable, zero-configuration ImageMagick])],
595     [enable_zero_configuration=$enableval],
596     [enable_zero_configuration='no'])
597
598 if test "$enable_zero_configuration" = 'yes'; then
599     AC_DEFINE(ZERO_CONFIGURATION_SUPPORT,1,[Build self-contained, embeddable, zero-configuration ImageMagick])
600     MAGICK_FEATURES="Zero-Configuration $MAGICK_FEATURES"
601 fi
602
603 # Build a high dynamic range version of ImageMagick.
604 AC_ARG_ENABLE([hdri],
605     [AC_HELP_STRING([--enable-hdri],
606                     [accurately represent the wide range of intensity levels found in real scenes])],
607     [enable_hdri=$enableval],
608     [enable_hdri='yes'])
609
610 MAGICK_HDRI=""
611 if test "$enable_hdri" = 'yes'; then
612     MAGICK_HDRI="HDRI"
613     magick_hdri_enable='1';
614     MAGICK_FEATURES="HDRI $MAGICK_FEATURES"
615 else
616     magick_hdri_enable='0'
617 fi
618 AC_DEFINE_UNQUOTED(HDRI_ENABLE_OBSOLETE_IN_H,$magick_hdri_enable,[Whether hdri is enabled or not])
619 AC_SUBST(MAGICK_HDRI)dnl
620 MAGICK_PCFLAGS="$MAGICK_PCFLAGS -DMAGICKCORE_HDRI_ENABLE=$magick_hdri_enable"
621 CFLAGS="$CFLAGS -DMAGICKCORE_HDRI_ENABLE=$magick_hdri_enable"
622
623 # Build a version of ImageMagick with assert statements.
624 AC_ARG_ENABLE([assert],
625     [AC_HELP_STRING([--disable-assert],
626                     [disable assert() statements in build])],
627     [enable_assert=$enableval],
628     [enable_assert='yes'])
629
630 if test "$enable_assert" = 'no'; then
631     AC_DEFINE(NDEBUG,1,[Turn off assert statements])
632 fi
633
634 # Don't emit "rebuild rules" for configure, Makefile.ins, etc.
635 AM_MAINTAINER_MODE
636
637 # Enable ccmalloc memory debugging support
638 AC_ARG_ENABLE([ccmalloc],
639     [AC_HELP_STRING([--enable-ccmalloc],
640                     [enable 'ccmalloc' memory debug support])],
641     [enable_ccmalloc=$enableval],
642     [enable_ccmalloc='no'])
643
644 # Enable Electric Fence memory debugging support
645 AC_ARG_ENABLE([efence],
646     [AC_HELP_STRING([--enable-efence],
647                     [enable 'efence' memory debug support])],
648     [enable_efence=$enableval],
649     [enable_efence='no'])
650
651 # Enable prof-based profiling support
652 AC_ARG_ENABLE([prof],
653     [AC_HELP_STRING([--enable-prof],
654                     [enable 'prof' profiling support])],
655     [enable_prof=$enableval],
656     [enable_prof='no'])
657
658 # Enable gprof-based profiling support
659 AC_ARG_ENABLE([gprof],
660     [AC_HELP_STRING([--enable-gprof],
661                     [enable 'gprof' profiling support])],
662     [enable_gprof=$enableval],
663     [enable_gprof='no'])
664
665 # Enable gcov-based profiling support
666 AC_ARG_ENABLE([gcov],
667     [AC_HELP_STRING([--enable-gcov],
668                     [enable 'gcov' profiling support])],
669     [enable_gcov=$enableval],
670     [enable_gcov='no'])
671
672 enable_profiling='no'
673 if test "$enable_prof" = 'yes' || test "$enable_gprof" = 'yes' || test "$enable_gcov" = 'yes'; then
674     enable_profiling='yes'
675     if test "$libtool_build_shared_libs" = 'yes'; then
676         echo "Warning: Can not profile code using shared libraries"
677     fi
678 fi
679
680 # Magick API method prefix
681 AC_ARG_WITH([method-prefix],
682     [AC_HELP_STRING([--with-method-prefix=PREFIX],
683                     [prefix MagickCore API methods])],
684     [with_method_prefix=$withval],
685     [with_method_prefix='no'])
686
687 if test "$with_method_prefix" != 'no'; then
688     AC_DEFINE_UNQUOTED(NAMESPACE_PREFIX,$with_method_prefix,[Magick API method prefix])
689     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-method-prefix "
690 fi
691
692 # Enable legacy support (default no)
693 AC_ARG_ENABLE(legacy-support,
694               [  --enable-legacy-support  install legacy command-line utilities (default disabled)],
695               [with_legacy_support=$enableval],
696               [with_legacy_support='no'])
697 AM_CONDITIONAL(LEGACY_SUPPORT, test "$with_legacy_support" != 'no')
698
699 # Number of bits in a Quantum
700 AC_ARG_WITH([quantum-depth],
701     [AC_HELP_STRING([--with-quantum-depth=DEPTH],
702                     [number of bits in a pixel quantum (default 16)])],
703     [with_quantum_depth=$withval],
704     [with_quantum_depth=16])
705
706 if test "$with_quantum_depth" != '8'; then
707     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-quantum-depth=$with_quantum_depth "
708 fi
709
710 case "${with_quantum_depth}" in
711     8 ) ;;
712     16 ) ;;
713     32 ) ;;
714     64 ) ;;
715     * ) AC_MSG_ERROR("Pixel quantum depth must have value of 8, 16, 32, or 64") ;;
716 esac
717 QUANTUM_DEPTH="$with_quantum_depth"
718 AC_DEFINE_UNQUOTED(QUANTUM_DEPTH_OBSOLETE_IN_H,$QUANTUM_DEPTH,[Number of bits in a pixel Quantum (8/16/32/64)])
719 AC_SUBST(QUANTUM_DEPTH)dnl
720 MAGICKCORE_PCFLAGS="$MAGICKCORE_PCFLAGS -DMAGICKCORE_QUANTUM_DEPTH=$QUANTUM_DEPTH"
721 CFLAGS="$CFLAGS -DMAGICKCORE_QUANTUM_DEPTH=$QUANTUM_DEPTH"
722
723 # define a lib suffix for abi purpose
724 MAGICK_ABI_SUFFIX="Q${QUANTUM_DEPTH}"
725 if test "$enable_hdri" = 'yes'; then
726   MAGICK_ABI_SUFFIX="Q${QUANTUM_DEPTH}${MAGICK_HDRI}"
727 fi
728 AC_SUBST(MAGICK_ABI_SUFFIX)
729
730 # Set pixel cache threshold
731 AC_ARG_WITH([cache],
732     [AC_HELP_STRING([--with-cache=THRESHOLD],
733                     [set pixel cache threshhold in MB (default available memory)])],
734     [with_cache=$withval],
735     [with_cache=''])
736
737 if test "$with_cache" != ''; then
738     AC_DEFINE_UNQUOTED(PixelCacheThreshold,$with_cache,[Pixel cache threshold in MB (defaults to available memory)])
739     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-cache=$with_cache "
740 fi
741
742 # Disable/Enable support for full delegate paths
743 AC_ARG_WITH([frozenpaths],
744     [AC_HELP_STRING([--with-frozenpaths],
745                     [freeze delegate paths])],
746     [with_frozenpaths=$withval],
747     [with_frozenpaths='no'])
748
749 # Enable build/install of Magick++
750 AC_ARG_WITH([magick-plus-plus],
751     [AC_HELP_STRING([--without-magick-plus-plus],
752                     [disable build/install of Magick++])],
753     [with_magick_plus_plus=$withval],
754     [with_magick_plus_plus='yes'])
755
756 # Encode the this name into the shared library.
757 AC_ARG_WITH([package-release-name],
758     [AC_HELP_STRING([--with-package-release-name=NAME],
759                     [encode this name into the shared library])],
760 [MAGICK_LT_RELEASE_OPTS="-release $withval"])
761 AC_SUBST(MAGICK_LT_RELEASE_OPTS)
762
763 # Disable build/install of PerlMagick.
764 AC_ARG_WITH([perl],
765     [AC_HELP_STRING([--with-perl],
766                     [enable build/install of PerlMagick])],
767     [with_perl=$withval],
768     [with_perl='no'])
769
770 # Options to pass when configuring PerlMagick
771 AC_ARG_WITH([perl-options],
772     [AC_HELP_STRING([--with-perl-options=OPTIONS],
773                     [options to pass on command-line when generating PerlMagick build file])],
774 PERL_MAKE_OPTIONS=$withval)
775 AC_SUBST(PERL_MAKE_OPTIONS)
776
777 # Enable umem, object-caching memory allocation library.
778 AC_ARG_WITH(umem,
779         [  --with-umem             enable umem memory allocation library support],
780         [with_umem=$withval],
781         [with_umem='no'])
782 if test "$with_umem" != 'yes' ; then
783     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-umem=$with_umem "
784 fi
785
786 #
787 # Specify path to shared libstdc++ if not in normal location
788 #
789 AC_ARG_WITH([libstdc],
790     [AC_HELP_STRING([--with-libstdc=DIR],
791                     [ use libstdc++ in DIR (for GNU C++)])],
792     [with_libstdc=$withval],
793     [with_libstdc=''])
794
795 if test "$with_libstdc" != ''; then
796     if test -d "$with_libstdc"; then
797         LIBSTDCLDFLAGS="-L$with_libstdc"
798     fi
799 fi
800 AC_SUBST(LIBSTDCLDFLAGS)
801
802 # Does gcc required -traditional?
803 AC_PROG_GCC_TRADITIONAL
804
805 ########
806 #
807 # Set defines required to build DLLs and modules using MinGW
808 #
809 ########
810 # These options are set for multi-thread DLL module build
811 #  libMagickCore:           _DLL _MAGICKMOD_ _MAGICKLIB_
812 #  module:              _DLL
813 #  executable/Magick++: _DLL _MAGICKMOD_
814 MODULE_EXTRA_CPPFLAGS=''
815 LIBRARY_EXTRA_CPPFLAGS=''
816 if test "${native_win32_build}" = 'yes'; then
817     if test "${libtool_build_shared_libs}" = 'yes'; then
818         CPPFLAGS="$CPPFLAGS -D_DLL"
819         MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_DLL"
820         MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_DLL"
821         LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKLIB_"
822         if test "$build_modules" = 'yes'; then
823             LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKMOD_"
824         else
825             MODULE_EXTRA_CPPFLAGS="$MODULE_EXTRA_CPPFLAGS -D_MAGICKLIB_"
826         fi
827     else
828         CPPFLAGS="$CPPFLAGS -D_LIB"
829         MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_LIB"
830         MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_LIB"
831     fi
832     if test "$with_threads" = 'yes'; then
833          CPPFLAGS="$CPPFLAGS -D_MT"
834          MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_MT"
835          MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_MT"
836     fi
837 fi
838 AC_SUBST(MODULE_EXTRA_CPPFLAGS)
839 AC_SUBST(LIBRARY_EXTRA_CPPFLAGS)
840
841 # Check standard headers
842 AC_HEADER_STDC
843 if ! test x"$ac_cv_header_stdc" = x"yes"; then
844     AC_MSG_WARN([configure has detected that you do not have the ANSI standard C
845     header files.  Compilation cannot proceed.  Please install the ANSI C
846     headers and rerun this script.]);
847 fi
848 AC_HEADER_ASSERT
849 AC_HEADER_DIRENT
850
851 # Check additional headers
852 AC_CHECK_HEADERS(arm/limits.h complex.h errno.h fcntl.h limits.h linux/unistd.h locale.h machine/param.h mach-o/dyld.h OS.h process.h sun_prefetch.h stdarg.h sys/ipc.h sys/mman.h sys/resource.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/wait.h wchar.h xlocale.h)
853
854 ########
855 #
856 # Checks for typedefs, structures, and compiler characteristics.
857 #
858 ########
859
860 AC_HEADER_STDBOOL
861 AC_C_VOLATILE
862 AC_C_STRINGIZE
863 AC_HEADER_STAT
864 AC_HEADER_TIME
865 AC_STRUCT_TM
866 AC_STRUCT_TIMEZONE
867 AC_SYS_INTERPRETER
868
869 # If the C compiler supports the keyword inline, do nothing. Otherwise
870 # define inline to __inline__ or __inline if it accepts one of those,
871 # otherwise define inline to be empty.
872 AC_C_INLINE
873
874 # If the C compiler supports the keyword restrict, do nothing. Otherwise
875 # define restrict to __restrict__ or __restrict if it accepts one of those,
876 # otherwise define restrict to be empty.
877 AC_C_RESTRICT
878
879 # If words are stored with the most significant byte first (like
880 # Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
881 AC_C_BIGENDIAN
882
883 # Define to a suitable type, if standard headers do not define it.
884 AC_TYPE_INT8_T
885 AC_TYPE_INT16_T
886 AC_TYPE_INT32_T
887 AC_TYPE_INT64_T
888 AC_TYPE_INTMAX_T
889 AC_TYPE_INTPTR_T
890 AC_TYPE_LONG_DOUBLE
891 AC_TYPE_LONG_DOUBLE_WIDER
892 AC_TYPE_LONG_LONG_INT
893 AC_TYPE_MBSTATE_T
894 AC_TYPE_MODE_T
895 AC_TYPE_OFF_T
896 AC_TYPE_PID_T
897 AC_TYPE_SIZE_T
898 AC_TYPE_SSIZE_T
899 AC_TYPE_UID_T
900 AC_TYPE_UINT8_T
901 AC_TYPE_UINT16_T
902 AC_TYPE_UINT32_T
903 AC_TYPE_UINT64_T
904 AC_TYPE_UINTMAX_T
905 AC_TYPE_UINTPTR_T
906 AC_TYPE_UNSIGNED_LONG_LONG_INT
907
908 # If the C type char is unsigned, define __CHAR_UNSIGNED__, unless the
909 # C compiler predefines it.
910 AC_C_CHAR_UNSIGNED
911
912 # Float_t and double_t are intended to be the the most efficient type.
913 AC_CHECK_TYPES([float_t], [], [], [[#include <math.h>]])
914 AC_CHECK_TYPES([double_t], [], [], [[#include <math.h>]])
915 AC_CHECK_SIZEOF([float_t], [], [[#include <math.h>]])
916 AC_CHECK_SIZEOF([double_t], [], [[#include <math.h>]])
917
918 # Get size of float, double and long double for comparaison.
919 AC_CHECK_SIZEOF([float])
920 AC_CHECK_SIZEOF([double])
921 AC_CHECK_SIZEOF([long double])
922
923 # Obtain size of an 'signed short' and define as SIZEOF_SIGNED_SHORT
924 AC_CHECK_SIZEOF(signed short)
925
926 # Obtain size of an 'unsigned short' and define as SIZEOF_UNSIGNED_SHORT
927 AC_CHECK_SIZEOF(unsigned short)
928
929 # Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
930 AC_CHECK_SIZEOF(signed int)
931
932 # Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
933 AC_CHECK_SIZEOF(unsigned int)
934
935 # Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
936 AC_CHECK_SIZEOF(signed long)
937
938 # Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
939 AC_CHECK_SIZEOF(unsigned long)
940
941 # Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.  If
942 # 'signed long long' is not supported then the value defined is zero.
943 AC_CHECK_SIZEOF(signed long long)
944
945 # Obtain size of a 'unsigned long long' and define as
946 # SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not
947 # supported then the value defined is zero.
948 AC_CHECK_SIZEOF(unsigned long long)
949
950 # Obtain size of off_t and define as SIZEOF_OFF_T
951 AC_CHECK_SIZEOF(off_t)
952
953 # Obtain size of size_t and define as SIZEOF_SIZE_T
954 AC_CHECK_SIZEOF(size_t)
955
956 # Obtain size of ssize_t and define as SIZEOF_SSIZE_T
957 AC_CHECK_SIZEOF(ssize_t)
958
959 # Obtain size of an unsigned int pointer and define as SIZEOF_UNSIGNED_INTP
960 AC_CHECK_SIZEOF(unsigned int*)
961
962 #
963 # Compute sized types for current CPU and compiler options.
964 #
965
966 AC_MSG_CHECKING(for signed 8-bit type)
967 INT8_T='signed char'
968 AC_MSG_RESULT($INT8_T)
969 AC_SUBST(INT8_T)
970
971 AC_MSG_CHECKING(for unsigned 8-bit type)
972 UINT8_T='unsigned char'
973 AC_MSG_RESULT($UINT8_T)
974 AC_SUBST(UINT8_T)
975
976 AC_MSG_CHECKING(for signed 16-bit type)
977 INT16_T='signed short'
978 AC_MSG_RESULT($INT16_T)
979 AC_SUBST(INT16_T)
980
981 AC_MSG_CHECKING(for unsigned 16-bit type)
982 UINT16_T='unsigned short'
983 AC_MSG_RESULT($UINT16_T)
984 AC_SUBST(UINT16_T)
985
986 AC_MSG_CHECKING(for signed 32-bit type)
987 INT32_T='none'
988 INT32_F='none'
989 if test $ac_cv_sizeof_signed_int -eq 4; then
990   INT32_T='signed int'
991   INT32_F='""'
992 elif test $ac_cv_sizeof_signed_long -eq 4; then
993   INT32_T='signed long'
994   INT32_F='"l"'
995 fi
996 AC_MSG_RESULT($INT32_T)
997 AC_SUBST(INT32_T)
998 AC_SUBST(INT32_F)
999
1000 AC_MSG_CHECKING(for unsigned 32-bit type)
1001 UINT32_T='none'
1002 UINT32_F='none'
1003 if test $ac_cv_sizeof_unsigned_int -eq 4; then
1004   UINT32_T='unsigned int'
1005   UINT32_F='""'
1006 elif test $ac_cv_sizeof_unsigned_long -eq 4; then
1007   UINT32_T='unsigned long'
1008   UINT32_F='"l"'
1009 fi
1010 AC_MSG_RESULT($UINT32_T)
1011 AC_SUBST(UINT32_T)
1012 AC_SUBST(UINT32_F)
1013
1014 AC_MSG_CHECKING(for signed 64-bit type)
1015 INT64_T='none'
1016 INT64_F='none'
1017 if test $ac_cv_sizeof_signed_long -eq 8; then
1018   INT64_T='signed long'
1019   INT64_F='"l"'
1020 elif test $ac_cv_sizeof_signed_long_long -eq 8; then
1021   INT64_T='signed long long'
1022   INT64_F='"ll"'
1023 fi
1024 case "${host_os}" in
1025   mingw* )
1026     INT64_F='"I64"'
1027     ;;
1028 esac
1029 AC_MSG_RESULT($INT64_T)
1030 AC_SUBST(INT64_T)
1031 AC_SUBST(INT64_F)
1032
1033 AC_MSG_CHECKING(for unsigned 64-bit type)
1034 UINT64_T='none'
1035 UINT64_F='none'
1036 if test $ac_cv_sizeof_unsigned_long -eq 8; then
1037   UINT64_T='unsigned long'
1038   UINT64_F='"l"'
1039 elif test $ac_cv_sizeof_unsigned_long_long -eq 8; then
1040   UINT64_T='unsigned long long'
1041   UINT64_F='"ll"'
1042 fi
1043 case "${host_os}" in
1044   mingw* )
1045     UINT64_F='"I64"'
1046     ;;
1047 esac
1048 AC_MSG_RESULT($UINT64_T)
1049 AC_SUBST(UINT64_T)
1050 AC_SUBST(UINT64_F)
1051
1052 AC_MSG_CHECKING(for unsigned maximum type)
1053 UINTMAX_T='none'
1054 UINTMAX_F='none'
1055 if test "$UINT64_T" != 'none'; then
1056   UINTMAX_T=$UINT64_T
1057   UINTMAX_F=$UINT64_F
1058 elif test "$UINT32_T" != 'none'; then
1059   UINTMAX_T=$UINT32_T
1060   UINTMAX_F=$UINT32_F
1061 fi
1062 AC_MSG_RESULT($UINTMAX_T)
1063 AC_SUBST(UINTMAX_T)
1064 AC_SUBST(UINTMAX_F)
1065
1066 AC_MSG_CHECKING(for pointer difference type)
1067 UINTPTR_T='none'
1068 UINTPTR_F='none'
1069 if test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_unsigned_intp; then
1070   UINTPTR_T='unsigned long'
1071   UINTPTR_F='"l"'
1072 elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_unsigned_intp; then
1073   UINTPTR_T='unsigned long long'
1074   UINTPTR_F='"ll"'
1075 fi
1076 AC_MSG_RESULT($UINTPTR_T)
1077 AC_SUBST(UINTPTR_T)
1078 AC_SUBST(UINTPTR_F)
1079
1080 AC_MSG_CHECKING([whether our compiler supports __func__])
1081 AC_TRY_COMPILE([],
1082  [{ const char *func = __func__; return(func != 0 ? 0 : 1); }],
1083  AC_MSG_RESULT([yes]),
1084  AC_MSG_RESULT([no])
1085  AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
1086  AC_TRY_COMPILE([],
1087    [{ const char *func = __FUNCTION__; return(func != 0 ? 0 : 1); }],
1088    AC_MSG_RESULT([yes])
1089    AC_DEFINE(__func__, __FUNCTION__,
1090      [Define to appropriate substitue if compiler does not have __func__]),
1091    AC_MSG_RESULT([no])
1092    AC_DEFINE(__func__, __FILE__,
1093      [Define to appropriate substitue if compiler does not have __func__])))
1094
1095 ########
1096 #
1097 # Check for functions
1098 #
1099 ########
1100 MAGICK_FUNC_MMAP_FILEIO
1101 AC_FUNC_CLOSEDIR_VOID
1102 AC_FUNC_MMAP
1103 AC_FUNC_FORK
1104 AC_FUNC_MEMCMP
1105 AC_FUNC_SELECT_ARGTYPES
1106 AC_FUNC_SETVBUF_REVERSED
1107 AC_TYPE_SIGNAL
1108 AC_FUNC_STRTOD
1109 AC_FUNC_STRERROR_R
1110 AC_FUNC_VPRINTF
1111
1112 #
1113 # Find math library
1114 #
1115 MATH_LIBS=''
1116 AC_CHECK_LIB(m,sqrt,MATH_LIBS="-lm",,)
1117 LIBS="$MATH_LIBS $LIBS"
1118 AC_SUBST(MATH_LIBS)
1119
1120 AC_CHECK_FUNCS([acosh _aligned_malloc asinh atanh atoll atexit cabs carg cimag creal clock ctime_r directio _exit execvp fchmod floor fork ftime ftruncate getc_unlocked getcwd getpid getexecname getdtablesize getpagesize getrlimit getrusage gettimeofday gmtime_r isnan j0 j1 lltostr localtime_r lstat memmove memset mkstemp munmap nanosleep newlocale _NSGetExecutablePath pclose _pclose poll popen _popen posix_fadvise posix_fallocate posix_madvise posix_memalign posix_spawnp pow pread pwrite qsort_r raise rand_r readlink readdir_r realpath select seekdir setlocale sqrt setvbuf stat strchr strrchr strcspn strdup strpbrk strspn strstr strtod strtod_l strtol strtoul symlink sysconf sigemptyset sigaction spawnvp strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times ulltostr uselocale usleep utime vfprintf vfprintf_l vsprintf vsnprintf vsnprintf_l waitpid _wfopen _wstat])
1121
1122 #
1123 # Check for clock_gettime().
1124 #
1125 AC_SEARCH_LIBS(clock_gettime, rt,
1126 [
1127   AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Define to 1 if you have clock_gettime.])
1128   AC_MSG_CHECKING([whether clock_gettime supports CLOCK_REALTIME])
1129   AC_COMPILE_IFELSE([
1130     AC_LANG_PROGRAM(
1131       [[#include <time.h>]],
1132        [[clockid_t clockType = CLOCK_REALTIME;]])],
1133       [
1134         AC_MSG_RESULT(yes)
1135         AC_DEFINE([HAVE_CLOCK_REALTIME],[1],
1136           [Define to 1 if clock_gettime supports CLOCK_REALTIME.])
1137       ],
1138       AC_MSG_RESULT(no)
1139     )
1140   ],
1141   [
1142     AC_CHECK_FUNCS([gettimeofday ftime], [break])
1143   ]
1144 )
1145
1146 ########
1147 #
1148 # Check for function prototypes
1149 #
1150 ########
1151
1152 AC_CHECK_DECLS([pread, pwrite],[],[],[
1153 #include <unistd.h>])
1154
1155 AC_CHECK_DECLS([strlcpy],[],[],[
1156 #include <strings.h>])
1157
1158 AC_CHECK_DECLS([vsnprintf],[],[],[
1159 #include <stdio.h>
1160 #include <stdarg.h>])
1161
1162 ########
1163 #
1164 # C++ Support Tests (For Magick++)
1165 #
1166 ########
1167 have_magick_plus_plus='no'
1168 if test "$with_magick_plus_plus" = 'yes'; then
1169     OLIBS="$LIBS"
1170     LIBS=''
1171     AC_LANG_PUSH(C++)
1172
1173     # Full set of headers used...
1174     # algorithm cctype cerrno cmath cstdio cstdlib cstring ctime exception
1175     # functional iomanip iosfwd iostream iterator list string strstream utility
1176     AC_LANG([C++])
1177     AC_PROG_CXX
1178     AX_CXX_BOOL
1179     AX_CXX_NAMESPACES
1180     AX_CXX_NAMESPACE_STD
1181     AC_CXX_HAVE_STD_LIBS
1182     AC_OPENMP([C++])
1183     AC_LANG_POP
1184
1185     AC_MSG_CHECKING([whether C++ compiler is sufficient for Magick++])
1186     if \
1187         test $ax_cv_cxx_bool = 'yes' && \
1188         test $ax_cv_cxx_namespaces = 'yes' && \
1189         test $ac_cv_cxx_have_std_libs = 'yes' && \
1190         test $ax_cv_cxx_have_std_namespace = 'yes'; then
1191         have_magick_plus_plus='yes'
1192     else
1193         have_magick_plus_plus='no (failed tests)'
1194     fi
1195     AC_MSG_RESULT([$have_magick_plus_plus])
1196     LIBS="$OLIBS"
1197 fi
1198 AM_CONDITIONAL(WITH_MAGICK_PLUS_PLUS, test "$have_magick_plus_plus" = 'yes')
1199
1200 # Only check for delegate libraries in subdirectories if requested.
1201 if test "$enable_delegate_build" != 'no'; then
1202     # Check for delegate sub-directories and add -I & -L options as required.
1203     # This presumes that delegates are installed as detailed in the ImageMagick
1204     # README. If delegates are installed in a standard location where the
1205     # compiler will automatically find them then these options should not be
1206     # required.
1207
1208     #
1209     # Most delegates have includes in the same directory as the library, but not all...
1210     #
1211     # Includes
1212     for dir in bzlib fftw fpx gslib/src jp2 jp2/src/libjasper/include jbig/libjbig jpeg lcms/include lzma magick png tiff/libtiff ttf/include wand webp wmf/include xml/include zlib; do
1213         if test -d "$builddir/$dir"; then
1214             CPPFLAGS="$CPPFLAGS -I$builddir/$dir"
1215         else
1216             if test -d "$srcdirfull/$dir"; then
1217                 CPPFLAGS="$CPPFLAGS -I$srcdirfull/$dir"
1218             fi
1219         fi
1220     done
1221
1222     # Libraries
1223     for dir in bzlib fftw fpx gslib/src jp2 jp2/src/libjasper jbig/libjbig jpeg lcms/src lzma magick png tiff/libtiff ttf/objs wand webp wmf/src xml zlib; do
1224     if test -d "$builddir/$dir/.libs"; then
1225         LDFLAGS="$LDFLAGS -L$builddir/$dir/.libs"
1226     else
1227         if test -d "$srcdirfull/$dir/.libs"; then
1228             LDFLAGS="$LDFLAGS -L$srcdirfull/$dir/.libs"
1229         fi
1230     fi
1231     if test -d "$builddir/$dir"; then
1232         LDFLAGS="$LDFLAGS -L$builddir/$dir"
1233     else
1234         if test -d "$srcdirfull/$dir"; then
1235             LDFLAGS="$LDFLAGS -L$srcdirfull/$dir"
1236         fi
1237     fi
1238   done
1239 fi
1240
1241 # Assume that delegate headers reside under same directory as ImageMagick
1242 # installation prefix.
1243 MAGICK_CPPFLAGS="-I$INCLUDE_DIR/ImageMagick $MAGICK_CPPFLAGS"
1244
1245 #
1246 # Find the X11 RGB database
1247 #
1248 AC_CACHE_CHECK(for X11 configure files,im_cv_x_configure,
1249 [# Look for the header file in a standard set of common directories.
1250 # Check X11 before X11Rn because it is often a symlink to the current release.
1251     for ac_dir in          \
1252     /lib/usr/lib/X11       \
1253     /usr/X11/lib           \
1254     /usr/X11R4/lib         \
1255     /usr/X11R5/lib         \
1256     /usr/X11R6/lib         \
1257     /usr/X11R7/lib         \
1258     /usr/X386/lib          \
1259     /usr/XFree86/lib/X11   \
1260     /usr/athena/lib        \
1261     /usr/lib               \
1262     /usr/lib/X11           \
1263     /usr/lib/X11R4         \
1264     /usr/lib/X11R5         \
1265     /usr/lib/X11R6         \
1266     /usr/lib/X11R7         \
1267     /usr/local/X11/lib     \
1268     /usr/local/X11R4/lib   \
1269     /usr/local/X11R5/lib   \
1270     /usr/local/X11R6/lib   \
1271     /usr/local/lib         \
1272     /usr/local/lib/X11     \
1273     /usr/local/lib/X11R4   \
1274     /usr/local/lib/X11R5   \
1275     /usr/local/lib/X11R6   \
1276     /usr/local/lib/X11R7   \
1277     /usr/local/x11r5/lib   \
1278     /usr/lpp/Xamples/lib   \
1279     /usr/openwin/lib       \
1280     /usr/openwin/share/lib \
1281     /usr/unsupported/lib   \
1282     /usr/x386/lib          \
1283     ; do
1284     if test -f "$ac_dir/X11/rgb.txt"; then
1285       im_cv_x_configure="$ac_dir/X11/"
1286       break
1287     elif test -f "$ac_dir/rgb.txt"; then
1288       im_cv_x_configure="$ac_dir/"
1289       break
1290     fi
1291
1292   done])
1293 X11_CONFIGURE_PATH="$im_cv_x_configure"
1294 case "${build_os}" in
1295   mingw* )
1296     X11ConfigurePath=`$WinPathScript "$X11ConfigurePath=" 1`
1297   ;;
1298 esac
1299 AC_DEFINE_UNQUOTED(X11_CONFIGURE_PATH,"$X11ConfigurePath",[Location of X11 configure files])
1300
1301 #
1302 # Find OpenMP library
1303 #
1304 GOMP_LIBS=''
1305 if test "$enable_openmp" != 'no'; then
1306   if test "${GCC}" = "yes"; then
1307     # Open64 (passes for GCC but uses different OpenMP implementation)
1308     if test "x$GOMP_LIBS" = x ; then
1309       if $CC --version 2>&1 | grep Open64 > /dev/null ; then
1310         AC_CHECK_LIB(openmp,omp_get_num_procs,GOMP_LIBS="-lopenmp",,)
1311       fi
1312     fi
1313     # GCC
1314     if test "x$GOMP_LIBS" = x ; then
1315       AC_CHECK_LIB(gomp,GOMP_parallel_start,GOMP_LIBS="-lgomp",,)
1316     fi
1317   else
1318     # Sun CC
1319     if test "x$GOMP_LIBS" = x ; then
1320       AC_CHECK_LIB(mtsk,sunw_mp_register_warn,GOMP_LIBS="-lmtsk",,)
1321     fi
1322     # AIX xlc
1323     if test "x$GOMP_LIBS" = x ; then
1324     AC_CHECK_LIB(xlsmp,_xlsmpFlush,GOMP_LIBS="-lxlsmp",,)
1325     fi
1326     # SGI IRIX 6.5 MIPSpro C/C++
1327     if test "x$GOMP_LIBS" = x ; then
1328     AC_CHECK_LIB(mp,mp_destroy,GOMP_LIBS="-lmp",,)
1329     fi
1330   fi
1331   LIBS="$GOMP_LIBS $LIBS"
1332 fi
1333 AC_SUBST(GOMP_LIBS)
1334
1335 #
1336 # Find Posix threads library
1337 #
1338 THREAD_LIBS=''
1339 if test "$with_threads" != 'no' && test "$have_threads" = 'yes'; then
1340
1341     if test "x$PTHREAD_LIBS" = "x"; then
1342     case "${host_cpu}-${host_os}" in
1343       *-freebsd*)
1344         MAGICK_CHECK_PTHREAD_LIB(c_r,PTHREAD_LIBS=-lc_r) ;;
1345     esac
1346     fi
1347
1348     for lib in pthread pthreads; do
1349         if test "x$PTHREAD_LIBS" = "x"; then
1350             MAGICK_CHECK_PTHREAD_LIB([$lib],[PTHREAD_LIBS=-l$lib])
1351         fi
1352     done
1353
1354     THREAD_LIBS="$PTHREAD_LIBS"
1355     LIBS="$LIBS $THREAD_LIBS"
1356 fi
1357 AC_SUBST(THREAD_LIBS)
1358
1359 #
1360 # Check for umem.
1361 #
1362 have_umem='no'
1363 UMEM_LIBS=''
1364 if test "$with_umem" != 'no'; then
1365   AC_MSG_CHECKING(for UMEM support )
1366   AC_MSG_RESULT()
1367   failed=0
1368   passed=0
1369   AC_CHECK_HEADER(umem.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1370   AC_CHECK_LIB(umem,umem_alloc,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1371   AC_CHECK_LIB(umem,umem_free,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1372   AC_MSG_CHECKING(if umem memory allocation library is complete)
1373   if test $passed -gt 0; then
1374     if test $failed -gt 0; then
1375       AC_MSG_RESULT(no -- some components failed test)
1376       have_umem='no (failed tests)'
1377     else
1378       UMEM_LIBS='-lumem'
1379       LIBS="$UMEM_LIBS $LIBS"
1380       AC_DEFINE(HasUMEM,1,Define if you have umem memory allocation library)
1381       AC_MSG_RESULT(yes)
1382       have_umem='yes'
1383     fi
1384   else
1385     AC_MSG_RESULT(no)
1386   fi
1387 fi
1388 AM_CONDITIONAL(HasUMEM, test "$have_umem" = 'yes')
1389 AC_SUBST(UMEM_LIBS)
1390
1391 #
1392 # Add support for ccmalloc memory debugging library if requested
1393 #
1394 have_ccmalloc='no'
1395 CCMALLOC_LIBS=''
1396 if test "$enable_ccmalloc" = 'yes'; then
1397     AC_PATH_PROG(CCMALLOCDelegate,ccmalloc,)
1398     if test -n "$CCMALLOCDelegate"; then
1399         eval `grep PREFIX= $CCMALLOCDelegate | sed -e 's/PREFIX/CCMALLOC_PREFIX/'`
1400         OLIBS="$LIBS"
1401         # Assume that gcc is used with ccmalloc.
1402         LIBS="$LIBS $CCMALLOC_PREFIX/lib/ccmalloc-gcc.o"
1403        AC_CHECK_LIB(ccmalloc,ccmalloc_malloc,CCMALLOC_LIBS="$CCMALLOC_PREFIX/lib/ccmalloc-gcc.o -lccmalloc -ldl",,-ldl)
1404         if test -n "$CCMALLOC_LIBS"; then
1405             LIBS="$OLIBS"
1406             LIBS="$LIBS $CCMALLOC_LIBS"
1407             have_ccmalloc='yes'
1408         else
1409             LIBS="$OLIBS"
1410         fi
1411     fi
1412 fi
1413
1414 #
1415 # Add support for efence memory debugging library if requested
1416 #
1417 if test "$enable_efence" = 'yes'; then
1418     EFENCE_LIBS='-lefence'
1419     LIBS="$EFENCE_LIBS $LIBS"
1420 fi
1421
1422 dnl ===========================================================================
1423
1424 #
1425 # Check for BZLIB
1426 #
1427
1428 AC_ARG_WITH([bzlib],
1429     [AC_HELP_STRING([--without-bzlib],
1430                     [disable BZLIB support])],
1431     [with_bzlib=$withval],
1432     [with_bzlib='yes'])
1433
1434 if test "$with_bzlib" != 'yes'; then
1435     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-bzlib=$with_bzlib "
1436 fi
1437
1438 have_bzlib='no'
1439 if test "$with_bzlib" != 'no'; then
1440     BZLIB_LIBS=''
1441     AC_MSG_RESULT([-------------------------------------------------------------])
1442     AC_MSG_CHECKING([for BZLIB])
1443     AC_MSG_RESULT([])
1444     failed=0
1445     passed=0
1446     found_libbz=0
1447     AC_CHECK_HEADER(bzlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1448     AC_CHECK_LIB(bz2,BZ2_bzDecompress,found_libbz=`expr $found_libbz + 1`,,)
1449     if test "$native_win32_build" = 'yes'; then
1450       AC_CHECK_LIB(bz2,_imp__BZ2_decompress,found_libbz=`expr $found_libbz + 1`,,)
1451     fi
1452     if test $found_libbz -gt 0; then
1453       passed=`expr $passed + 1`
1454     else
1455       failed=`expr $failed + 1`
1456     fi
1457     AC_MSG_CHECKING(if BZLIB package is complete)
1458     if test $passed -gt 0; then
1459       if test $failed -gt 0; then
1460         AC_MSG_RESULT(no -- some components failed test)
1461         have_bzlib='no (failed tests)'
1462       else
1463         BZLIB_LIBS='-lbz2'
1464         LIBS="$BZLIB_LIBS $LIBS"
1465         AC_DEFINE(BZLIB_DELEGATE,1,Define if you have the bzip2 library)
1466         AC_MSG_RESULT(yes)
1467         have_bzlib='yes'
1468       fi
1469     else
1470       AC_MSG_RESULT(no)
1471     fi
1472 fi
1473 AM_CONDITIONAL(BZLIB_DELEGATE, test "$have_bzlib" = 'yes')
1474 AC_SUBST(BZLIB_LIBS)
1475
1476 #
1477 # Find the X11 include and library directories.
1478 #
1479 IPC_LIBS=''
1480 X11_LIBS=''
1481 XEXT_LIBS=''
1482 XT_LIBS=''
1483 AC_PATH_XTRA
1484 if test "$no_x" != 'yes'; then
1485     AC_MSG_RESULT([-------------------------------------------------------------])
1486     AC_MSG_CHECKING([for X11])
1487     AC_MSG_RESULT([])
1488     LDFLAGS="$LDFLAGS $X_LIBS"
1489     X11_LIBS="$X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
1490     LIBS="$X11_LIBS $LIBS"
1491     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1492
1493     AC_DEFINE(X11_DELEGATE,1,Define if you have X11 library)dnl
1494
1495     #
1496     # Check for X11 shared memory extension
1497     #
1498     # shmctl is required to support the shared memory extension
1499     AC_CHECK_FUNC([shmctl],[have_shmctl='yes'],[])
1500     if test "$have_shmctl" != 'yes'; then
1501         PERSIST_LIBS=$LIBS
1502         LIBS="$LIBS -lcygipc"
1503         AC_TRY_LINK_FUNC([shmctl],[have_shmctl='yes'; IPC_LIBS='-lcygipc'],[])
1504         LIBS=$PERSIST_LIBS
1505     fi
1506
1507     if test "$have_shmctl" = 'yes'; then
1508         AC_CHECK_LIB([Xext],[XShmAttach],[XEXT_LIBS='-lXext' ; AC_DEFINE(HAVE_SHARED_MEMORY,1,X11 server supports shared memory extension)],[],[])
1509     fi
1510
1511     #
1512     # Check for X11 shape extension
1513     #
1514     AC_CHECK_LIB([Xext],[XShapeCombineMask],[XEXT_LIBS='-lXext' ; AC_DEFINE(HAVE_SHAPE,1,X11 server supports shape extension)],[],[])
1515     AC_CHECK_LIB(Xt,XtSetEventDispatcher,XT_LIBS='-lXt',,)
1516     LIBS="$XEXT_LIBS $XT_LIBS $LIBS"
1517 fi
1518 if test "$no_x" != 'yes'; then
1519   have_x='yes'
1520 else
1521   have_x='no'
1522 fi
1523 AM_CONDITIONAL(X11_DELEGATE, test "$have_x" = 'yes')
1524 AC_SUBST(X11_LIBS)
1525 AC_SUBST(XEXT_LIBS)
1526
1527 dnl ===========================================================================
1528
1529 #
1530 # Check for ZLIB
1531 #
1532 AC_ARG_WITH([zlib],
1533     [AC_HELP_STRING([--without-zlib],
1534                     [disable ZLIB support])],
1535     [with_zlib=$withval],
1536     [with_zlib='yes'])
1537
1538 if test "$with_zlib" != 'yes'; then
1539     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-zlib=$with_zlib "
1540 fi
1541
1542 have_zlib='no'
1543 ZLIB_LIBS=''
1544 dnl PNG requires zlib so enable zlib check if PNG is requested
1545 if test "$with_zlib" != 'no' || test "$with_png" != 'no'; then
1546     AC_MSG_RESULT([-------------------------------------------------------------])
1547     AC_MSG_CHECKING([for ZLIB])
1548     AC_MSG_RESULT([])
1549     ZLIB_LIBS=''
1550     failed=0
1551     passed=0
1552     AC_CHECK_HEADER(zconf.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1553     AC_CHECK_HEADER(zlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1554     AC_CHECK_LIB(z,compress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1555     AC_CHECK_LIB(z,uncompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1556     AC_CHECK_LIB(z,deflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1557     AC_CHECK_LIB(z,inflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1558     AC_CHECK_LIB(z,gzseek,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1559     AC_CHECK_LIB(z,gztell,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1560     AC_MSG_CHECKING([if ZLIB package is complete])
1561     if test $passed -gt 0; then
1562         if test $failed -gt 0; then
1563             AC_MSG_RESULT([no -- some components failed test])
1564             have_zlib='no (failed tests)'
1565         else
1566             ZLIB_LIBS='-lz'
1567             LIBS="$ZLIB_LIBS $LIBS"
1568             AC_DEFINE(ZLIB_DELEGATE,1,Define if you have zlib compression library)
1569             AC_MSG_RESULT([yes])
1570             have_zlib='yes'
1571         fi
1572     else
1573         AC_MSG_RESULT([no])
1574     fi
1575 fi
1576 AM_CONDITIONAL(ZLIB_DELEGATE, test "$have_zlib" = 'yes')
1577 AC_SUBST(ZLIB_LIBS)
1578
1579 # whether modules are built or not.
1580 with_ltdl='yes'
1581 have_ltdl='no'
1582 LTDL_LIBS=''
1583 if test "$build_modules" != 'no' ; then
1584   AC_MSG_RESULT([-------------------------------------------------------------])
1585   AC_MSG_CHECKING([for libltdl])
1586   AC_MSG_RESULT([])
1587   failed=0
1588   passed=0
1589   AC_CHECK_HEADER([ltdl.h],[passed=`expr $passed + 1`],[failed=`expr $failed + 1`])
1590   AC_CHECK_LIB([ltdl],[lt_dlinit],[passed=`expr $passed + 1`],[failed=`expr $failed + 1`],)
1591   AC_MSG_CHECKING([if libltdl package is complete])
1592   if test $passed -gt 0 ; then
1593     if test $failed -gt 0 ; then
1594       AC_MSG_RESULT([no -- some components failed test])
1595       have_ltdl='no (failed tests)'
1596     else
1597       LTDL_LIBS='-lltdl'
1598       LIBS="$LTDL_LIBS $LIBS"
1599       AC_DEFINE(LTDL_DELEGATE,1,[Define if using libltdl to support dynamically loadable modules])
1600       AC_MSG_RESULT([yes])
1601       have_ltdl='yes'
1602     fi
1603   else
1604     AC_MSG_RESULT([no])
1605   fi
1606   if test "$have_ltdl" != 'yes' ; then
1607     AC_MSG_FAILURE([libltdl is required for modules build],[1])
1608   fi
1609 fi
1610 AM_CONDITIONAL(WITH_LTDL, test "$have_ltdl" != 'no')
1611
1612 #
1613 # If profiling, then check for -ldl and dlopen (required for Solaris & gcc)
1614 #
1615 LIB_DL=''
1616 if test "$enable_profiling" = 'yes'; then
1617     AC_CHECK_LIB(dl,dlopen,LIB_DL='-ldl',,)
1618     LIBS="$LIB_DL $LIBS"
1619 fi
1620 AC_SUBST(LIB_DL)
1621
1622 dnl ===========================================================================
1623
1624 #
1625 # Check for Autotrace delegate library.
1626 #
1627 AC_ARG_WITH([autotrace],
1628     [AC_HELP_STRING([--with-autotrace],
1629                     [enable autotrace support])],
1630         [with_autotrace=$withval],
1631         [with_autotrace='no'])
1632
1633 if test "$with_autotrace" != 'yes'; then
1634     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-autotrace=$with_autotrace "
1635 fi
1636
1637 have_autotrace='no'
1638 AUTOTRACE_CFLAGS=""
1639 AUTOTRACE_LIBS=""
1640 AUTOTRACE_PKG=""
1641 if test "x$with_autotrace" = "xyes"; then
1642     AC_MSG_RESULT([-------------------------------------------------------------])
1643     PKG_CHECK_MODULES(AUTOTRACE,[autotrace >= 0.31.1], have_autotrace=yes, have_autotrace=no)
1644     AC_MSG_RESULT([])
1645 fi
1646
1647 if test "$have_autotrace" = 'yes'; then
1648     failed=0
1649     AC_DEFINE(AUTOTRACE_DELEGATE,1,Define if you have AUTOTRACE library)
1650     if test "$build_modules" = 'no'; then
1651       CPPFLAGS="$AUTOTRACE_CFLAGS $CPPFLAGS"
1652     fi
1653 fi
1654
1655 AM_CONDITIONAL(AUTOTRACE_DELEGATE,test "$have_autotrace" = 'yes')
1656 AC_SUBST(AUTOTRACE_CFLAGS)
1657 AC_SUBST(AUTOTRACE_LIBS)
1658
1659 dnl ===========================================================================
1660
1661 #
1662 # Check for Display Postscript delegate library.
1663 #
1664 AC_ARG_WITH([dps],
1665     [AC_HELP_STRING([--without-dps],
1666                     [disable Display Postscript support])],
1667     [with_dps=$withval],
1668     [with_dps='yes'])
1669
1670 if test "$with_dps" != 'yes'; then
1671     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-dps=$with_dps "
1672 fi
1673
1674 have_dps='no'
1675 DPS_LIBS=''
1676 if test "$with_dps" != 'no' && test "$with_x" != 'no'; then
1677     AC_MSG_RESULT([-------------------------------------------------------------])
1678     AC_MSG_CHECKING([for DPS])
1679     AC_MSG_RESULT([])
1680     failed=0
1681     passed=0
1682     PERSIST_CPPFLAGS="$CPPFLAGS"
1683     CPPFLAGS="$CPPFLAGS -I${ac_x_includes}/X11"
1684     AC_CHECK_HEADER(DPS/dpsXclient.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1685     # DPS issues:
1686     # XFree86-4.x needs -lXt to provide XtMalloc for -ldps.
1687     # Cygwin doesn't deliver -lXt as a DLL, which prevents a DLL build.
1688     # Adobe DPS (as delivered on Solaris) doesn't require -lXt.
1689     # ImageMagick itself doesn't use -lXt.
1690     have_libdps='no'
1691     LIBDPS_XT=''
1692     AC_CHECK_LIB(dps,DPSInitialize,have_libdps='yes',have_libdps='no',)
1693     if test "$have_libdps" != 'yes'; then
1694         # Unset cache variable so we can try again.
1695         unset ac_cv_lib_dps_DPSInitialize
1696         AC_CHECK_LIB(dps,DPSInitialize,have_libdps='yes',have_libdps='no',-lXt)
1697         if test "$have_libdps" = 'yes'; then
1698             LIBDPS_XT='-lXt'
1699         fi
1700     fi
1701     if test "$have_libdps" = 'yes'; then
1702         passed=`expr $passed + 1`
1703     else
1704         failed=`expr $failed + 1`
1705     fi
1706     AC_CHECK_LIB(dpstk,XDPSPixelsPerPoint,passed=`expr $passed + 1`,failed=`expr $failed + 1`,-ldps $LIBDPS_XT)
1707     AC_MSG_CHECKING([if DPS package is complete])
1708     if test $passed -gt 0; then
1709         if test $failed -gt 0; then
1710             AC_MSG_RESULT([no -- some components failed test])
1711             have_dps='no (failed tests)'
1712             CPPFLAGS="$PERSIST_CPPFLAGS"
1713         else
1714             DPS_LIBS="-ldpstk -ldps ${LIBDPS_XT}"
1715             LIBS="$DPS_LIBS $LIBS"
1716             AC_DEFINE(DPS_DELEGATE,1,Define if you have Display Postscript)
1717             AC_MSG_RESULT([yes])
1718             have_dps='yes'
1719         fi
1720     else
1721         AC_MSG_RESULT([no])
1722         CPPFLAGS=$PERSIST_CPPFLAGS
1723     fi
1724 fi
1725 AM_CONDITIONAL(DPS_DELEGATE, test "$have_dps" = 'yes')
1726 AC_SUBST(DPS_LIBS)
1727
1728 dnl ===========================================================================
1729
1730 #
1731 # Check for DJVU delegate library.
1732 #
1733 AC_ARG_WITH([djvu],
1734     [AC_HELP_STRING([--without-djvu],
1735                     [disable DjVu support])],
1736     [with_djvu=$withval],
1737     [with_djvu='yes'])
1738
1739 if test "$with_djvu" != 'yes'; then
1740     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-djvu=$with_djvu "
1741 fi
1742
1743 have_djvu='no'
1744 DJVU_LIBS=''
1745 if test "$with_djvu" != 'no'; then
1746     AC_MSG_RESULT([-------------------------------------------------------------])
1747     AC_MSG_CHECKING([for DJVU])
1748     AC_MSG_RESULT([])
1749     failed=0
1750     passed=0
1751     AC_CHECK_HEADER(libdjvu/ddjvuapi.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1752     AC_CHECK_LIB(djvulibre,ddjvu_context_create,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1753     AC_MSG_CHECKING([if DJVU package is complete])
1754     if test $passed -gt 0; then
1755         if test $failed -gt 0; then
1756             AC_MSG_RESULT([no -- some components failed test])
1757             have_djvu='no (failed tests)'
1758         else
1759             DJVU_LIBS='-ldjvulibre'
1760             LIBS="$DJVU_LIBS $LIBS"
1761             AC_DEFINE(DJVU_DELEGATE,1,Define if you have DJVU library)
1762             AC_MSG_RESULT([yes])
1763             have_djvu='yes'
1764         fi
1765     else
1766         AC_MSG_RESULT([no])
1767     fi
1768 fi
1769 AM_CONDITIONAL(DJVU_DELEGATE, test "$have_djvu" = 'yes')
1770 AC_SUBST(DJVU_LIBS)
1771
1772 dnl ===========================================================================
1773
1774 #
1775 # Set DejaVu font directory.
1776 #
1777 AC_ARG_WITH([dejavu-font-dir],
1778     [AC_HELP_STRING([--with-dejavu-font-dir=DIR],
1779                     [DejaVu font directory])],
1780     [with_dejavu_font_dir=$withval],
1781     [with_dejavu_font_dir='default'])
1782
1783 if test "$with_dejavu_font_dir" != 'default'; then
1784     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-dejavu-font-dir=$with_dejavu_font_dir "
1785 fi
1786
1787 dnl ===========================================================================
1788
1789 #
1790 # Check for FFTW delegate library.
1791 #
1792 AC_ARG_WITH([fftw],
1793     [AC_HELP_STRING([--without-fftw],
1794                     [disable FFTW support])],
1795     [with_fftw=$withval],
1796     [with_fftw='yes'])
1797
1798 if test "$with_fftw" != 'yes'; then
1799     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fftw=$with_fftw "
1800 fi
1801
1802 have_fftw='no'
1803 FFTW_LIBS=''
1804 if test "$with_fftw" != 'no'; then
1805     AC_MSG_RESULT([-------------------------------------------------------------])
1806     AC_MSG_CHECKING([for FFTW])
1807     AC_MSG_RESULT([])
1808     failed=0
1809     passed=0
1810     AC_CHECK_HEADER(fftw3.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1811     AC_CHECK_LIB(fftw3,fftw_execute,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1812     AC_MSG_CHECKING([if FFTW package is complete])
1813     if test $passed -gt 0; then
1814         if test $failed -gt 0; then
1815             AC_MSG_RESULT([no -- some components failed test])
1816             have_fftw='no (failed tests)'
1817         else
1818             FFTW_LIBS='-lfftw3'
1819             LIBS="$FFTW_LIBS $LIBS"
1820             AC_DEFINE(FFTW_DELEGATE,1,Define if you have FFTW library)
1821             AC_MSG_RESULT([yes])
1822             have_fftw='yes'
1823         fi
1824     else
1825         AC_MSG_RESULT([no])
1826     fi
1827 fi
1828 AM_CONDITIONAL(FFTW_DELEGATE, test "$have_fftw" = 'yes')
1829 AC_SUBST(FFTW_LIBS)
1830
1831 dnl ===========================================================================
1832
1833 #
1834 # Check for FlashPIX delegate library.
1835 #
1836 AC_ARG_WITH([fpx],
1837     [AC_HELP_STRING([--without-fpx],
1838                     [disable FlashPIX support])],
1839     [with_fpx=$withval],
1840     [with_fpx='yes'])
1841
1842 if test "$with_fpx" != 'yes'; then
1843     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fpx=$with_fpx "
1844 fi
1845
1846 have_fpx='no'
1847 FPX_LIBS=''
1848 if test "$with_fpx" != 'no'; then
1849     AC_MSG_RESULT([-------------------------------------------------------------])
1850     AC_MSG_CHECKING([for FlashPIX])
1851     AC_MSG_RESULT([])
1852     failed=0
1853     passed=0
1854     AC_LANG_PUSH(C++)
1855     AC_CHECK_HEADER(fpxlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1856     AC_CHECK_LIB(fpx,FPX_OpenImageByFilename,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1857     AC_LANG_POP
1858     AC_MSG_CHECKING([if FlashPIX package is complete])
1859     if test $passed -gt 0; then
1860         if test $failed -gt 0; then
1861             AC_MSG_RESULT([no -- some components failed test])
1862             have_fpx='no (failed tests)'
1863         else
1864             FPX_LIBS='-lfpx'
1865             AC_DEFINE(FPX_DELEGATE,1,Define if you have FlashPIX library)
1866             AC_MSG_RESULT([yes])
1867             have_fpx='yes'
1868             PERLMAINCC="$CXX"
1869         fi
1870     else
1871         AC_MSG_RESULT([no])
1872     fi
1873 fi
1874 AM_CONDITIONAL(FPX_DELEGATE, test "$have_fpx" = 'yes')
1875 AC_SUBST(FPX_LIBS)
1876
1877 dnl ===========================================================================
1878
1879 #
1880 # Check for fontconfig delegate library.
1881 #
1882 AC_ARG_WITH([fontconfig],
1883     [AC_HELP_STRING([--without-fontconfig],
1884                     [disable fontconfig support])],
1885         [with_fontconfig=$withval],
1886         [with_fontconfig='yes'])
1887
1888 if test "$with_fontconfig" != 'yes'; then
1889     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fontconfig=$with_fontconfig "
1890 fi
1891
1892 have_fontconfig='no'
1893 FONTCONFIG_CFLAGS=""
1894 FONTCONFIG_LIBS=""
1895 FONTCONFIG_PKG=""
1896 if test "x$with_fontconfig" = "xyes"; then
1897     AC_MSG_RESULT([-------------------------------------------------------------])
1898     PKG_CHECK_MODULES(FONTCONFIG,[fontconfig >= 2.1.0], have_fontconfig=yes, have_fontconfig=no)
1899     AC_MSG_RESULT([])
1900 fi
1901
1902 if test "$have_fontconfig" = 'yes'; then
1903   AC_DEFINE(FONTCONFIG_DELEGATE,1,Define if you have FONTCONFIG library)
1904   if test "$build_modules" = 'no'; then
1905     CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
1906   fi
1907 fi
1908
1909 AM_CONDITIONAL(FONTCONFIG_DELEGATE,test "$have_fontconfig" = 'yes')
1910 AC_SUBST(FONTCONFIG_CFLAGS)
1911 AC_SUBST(FONTCONFIG_LIBS)
1912
1913 dnl ===========================================================================
1914
1915 #
1916 # Check for freetype delegate library.
1917 #
1918 AC_ARG_WITH([freetype],
1919     [AC_HELP_STRING([--without-freetype],
1920                     [disable Freetype support])],
1921     [with_freetype=$withval],
1922     [with_freetype='yes'])
1923
1924
1925 if test "$with_freetype" != 'yes'; then
1926     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-freetype=$with_freetype "
1927 fi
1928
1929 have_freetype='no'
1930 FREETYPE_LIBS=''
1931 if test "$with_freetype" != 'no'; then
1932     AC_MSG_RESULT([-------------------------------------------------------------])
1933     AC_MSG_CHECKING(for FreeType 2.0 )
1934     AC_MSG_RESULT()
1935     failed=0
1936     passed=0
1937     PERSIST_LDFLAGS="$LDFLAGS"
1938     PERSIST_CPPFLAGS="$CPPFLAGS"
1939     freetype_config=''
1940     # Allow the user to specify the location of freetype.
1941     if test "$with_freetype" != 'yes'; then
1942       if test -x "${with_freetype}/bin/freetype-config"; then
1943         freetype_config="${with_freetype}/bin/freetype-config"
1944       elif test -x "${with_freetype}"; then
1945         freetype_config=${with_freetype}
1946       fi
1947     fi
1948     if test -z "$freetype_config"; then
1949       AC_PATH_PROG(freetype_config,freetype-config,)dnl
1950     fi
1951     if test -n "$freetype_config"; then
1952       freetype_prefix=`${freetype_config} --prefix`
1953       freetype_exec_prefix=`${freetype_config} --exec-prefix`
1954       LDFLAGS="$LDFLAGS -L${freetype_exec_prefix}/lib"
1955       CPPFLAGS="$CPPFLAGS -I${freetype_prefix}/include/freetype2"
1956     fi
1957
1958 dnl First see if there is a library
1959     if test "$FREETYPE_LIBS" = ''; then
1960       AC_CHECK_LIB(freetype,FT_Init_FreeType,FREETYPE_LIBS='-lfreetype',,)
1961       if test "$FREETYPE_LIBS" != ''; then
1962         passed=`expr $passed + 1`
1963       else
1964         failed=`expr $failed + 1`
1965         LDFLAGS="$PERSIST_LDFLAGS"
1966       fi
1967     fi
1968
1969 dnl Now test for the headers
1970     AC_CHECK_HEADER([ft2build.h],[FT2BUILD_H='#include <ft2build.h>'],[ft2build=''],[])
1971     AC_CHECK_HEADER(freetype/freetype.h,[have_freetype_h='yes'],[have_freetype_h='no'],[$FT2BUILD_H])
1972     if test "$have_freetype_h" = 'yes'; then
1973       passed=`expr $passed + 1`
1974     else
1975       failed=`expr $failed + 1`
1976       CPPFLAGS="$PERSIST_CPPFLAGS"
1977     fi
1978
1979     AC_MSG_CHECKING(if FreeType package is complete)
1980     if test $passed -gt 0; then
1981       if test $failed -gt 0; then
1982         FREETYPE_LIBS=''
1983         AC_MSG_RESULT(no -- some components failed test)
1984         have_freetype='no (failed tests)'
1985       else
1986         LIBS="$FREETYPE_LIBS $LIBS"
1987         AC_DEFINE(FREETYPE_DELEGATE,1,Define if you have FreeType (TrueType font) library)
1988         if test "$ac_cv_header_ft2build_h" = 'yes'; then
1989           AC_DEFINE([HAVE_FT2BUILD_H],[1],[Define to 1 if you have the <ft2build.h> header file.])
1990         fi
1991         AC_MSG_RESULT(yes)
1992         have_freetype='yes'
1993       fi
1994     else
1995       AC_MSG_RESULT(no)
1996     fi
1997 fi
1998 AM_CONDITIONAL(FREETYPE_DELEGATE, test "$have_freetype" = 'yes')
1999 AC_SUBST(FREETYPE_LIBS)
2000
2001 dnl ===========================================================================
2002
2003 #
2004 # Check for Ghostscript library or framework.
2005 #
2006 # Test for iapi.h & test for gsapi_new_instance in -lgs
2007 # or -framework Ghostscript
2008
2009 AC_ARG_WITH([gslib],
2010     [AC_HELP_STRING([--without-gslib],
2011                     [enable Ghostscript library support])],
2012     [with_gslib=$withval],
2013     [with_gslib='no'])
2014
2015 gslib_framework='no'
2016 if test "$with_gslib" != 'yes'; then
2017     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gslib=$with_gslib "
2018 fi
2019
2020 have_gslib='no'
2021 GS_LIBS=''
2022 if test "$with_gslib" != 'no'; then
2023     AC_MSG_RESULT([-------------------------------------------------------------])
2024     AC_MSG_CHECKING([for Ghostscript])
2025     AC_MSG_RESULT([])
2026     framework=0
2027     failed=0
2028     passed=0
2029     AC_CHECK_HEADER(ghostscript/iapi.h,passed=`expr $passed + 1`,
2030         failed=`expr $failed + 1`,)
2031     AC_CHECK_HEADER(ghostscript/ierrors.h,passed=`expr $passed + 1`,
2032         failed=`expr $failed + 1`,)
2033     AC_CHECK_FRAMEWORK(Ghostscript,gsapi_new_instance,framework=`expr $framework + 1`,
2034     AC_CHECK_LIB(gs,gsapi_new_instance,passed=`expr $passed + 1`,failed=`expr $failed + 1`,),)
2035     AC_MSG_CHECKING([if Ghostscript package is complete])
2036     if test $passed -gt 0; then
2037         if test $failed -gt 0; then
2038             AC_MSG_RESULT([no -- some components failed test])
2039             have_gslib='no (failed tests)'
2040         else
2041             if test $framework -gt 0; then
2042                 GS_LIBS='-framework Ghostscript'
2043                 gslib_framework='yes'
2044                 AC_MSG_RESULT([yes, using framework.])
2045             else
2046                 AC_MSG_RESULT([yes, using library.])
2047                 GS_LIBS='-lgs'
2048             fi
2049             LIBS="$GS_LIBS $LIBS"
2050             AC_DEFINE(GS_DELEGATE,1,Define if you have Ghostscript library or framework)
2051             have_gslib='yes'
2052         fi
2053     else
2054         AC_MSG_RESULT([no])
2055     fi
2056 fi
2057 AM_CONDITIONAL(GS_DELEGATE, test "$have_gslib" = 'yes')
2058 AC_SUBST(GS_LIBS)
2059
2060 # Set default font search path
2061 AC_ARG_WITH([fontpath],
2062     [AC_HELP_STRING([--with-fontpath=DIR],
2063                     [prepend to default font search path])],
2064     [with_fontpath=$withval],
2065     [with_fontpath=''])
2066
2067 if test "$with_fontpath" != "yes" && test -z "$with_fontpath"; then
2068     with_fontpath=''
2069 else
2070     AC_DEFINE_UNQUOTED(MAGICK_FONT_PATH,"$with_fontpath",[Define to prepend to default font search path.])
2071 fi
2072 if test "$with_fontpath=" != ''; then
2073     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fontpath=$with_fontpath "
2074 fi
2075
2076 # Set Ghostscript font directory
2077 AC_ARG_WITH([gs-font-dir],
2078     [AC_HELP_STRING([--with-gs-font-dir=DIR],
2079                     [Ghostscript font directory])],
2080     [with_gs_font_dir=$withval],
2081     [with_gs_font_dir='default'])
2082
2083 if test "$with_gs_font_dir" != 'default'; then
2084     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gs-font-dir=$with_gs_font_dir "
2085 fi
2086
2087 dnl ===========================================================================
2088
2089 #
2090 # Check for GVC delegate library.
2091 #
2092 AC_ARG_WITH(gvc,
2093     [AC_HELP_STRING([--with-gvc],
2094                     [disable GVC support])],
2095     [with_gvc=$withval],
2096     [with_gvc='no'])
2097
2098 if test "$with_gvc" != 'yes'; then
2099     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gvc=$with_gvc "
2100 fi
2101
2102 GVC_PKG=""
2103 if test "x$with_gvc" = "xyes"; then
2104     AC_MSG_RESULT([-------------------------------------------------------------])
2105     PKG_CHECK_MODULES(GVC,[libgvc >= 2.9.0], have_gvc=yes, have_gvc=no)
2106     AC_MSG_RESULT([])
2107 fi
2108
2109 if test "$have_gvc" = 'yes'; then
2110     AC_DEFINE(GVC_DELEGATE,1,Define if you have GVC library)
2111     if test "$build_modules" = 'no'; then
2112         CPPFLAGS="$GVC_CFLAGS $CPPFLAGS"
2113     fi
2114 fi
2115
2116 AM_CONDITIONAL(GVC_DELEGATE, test "$have_gvc" = 'yes')
2117 AC_SUBST(GVC_CFLAGS)
2118 AC_SUBST(GVC_LIBS)
2119
2120 dnl ===========================================================================
2121
2122 #
2123 # Check for JBIG delegate library.
2124 #
2125
2126 AC_ARG_WITH([jbig],
2127     [AC_HELP_STRING([--without-jbig],
2128                     [disable JBIG support])],
2129     [with_jbig=$withval],
2130     [with_jbig='yes'])
2131
2132 have_jbig='no'
2133 JBIG_LIBS=''
2134 if test "$with_jbig" != 'no'; then
2135     AC_MSG_RESULT([-------------------------------------------------------------])
2136     AC_MSG_CHECKING([for JBIG])
2137     AC_MSG_RESULT([])
2138     failed=0
2139     passed=0
2140     AC_CHECK_HEADER(jbig.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2141     AC_CHECK_LIB(jbig,jbg_dec_init,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2142     AC_MSG_CHECKING([if JBIG package is complete])
2143     if test $passed -gt 0; then
2144         if test $failed -gt 0; then
2145             AC_MSG_RESULT([no -- some components failed test])
2146             have_jbig='no (failed tests)'
2147         else
2148             JBIG_LIBS='-ljbig'
2149             LIBS="$JBIG_LIBS $LIBS"
2150             AC_DEFINE(JBIG_DELEGATE,1,Define if you have JBIG library)
2151             AC_MSG_RESULT([yes])
2152             have_jbig='yes'
2153         fi
2154     else
2155         AC_MSG_RESULT([no])
2156     fi
2157 fi
2158 AM_CONDITIONAL(JBIG_DELEGATE, test "$have_jbig" = 'yes')
2159 AC_SUBST(JBIG_LIBS)
2160
2161 dnl ===========================================================================
2162
2163 #
2164 # Check for JPEG delegate library.
2165 #
2166 AC_ARG_WITH([jpeg],
2167     [AC_HELP_STRING([--without-jpeg],
2168                     [disable JPEG support])],
2169     [with_jpeg=$withval],
2170     [with_jpeg='yes'])
2171
2172 if test "$with_jpeg" != 'yes'; then
2173     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jpeg=$with_jpeg "
2174 fi
2175
2176 have_jpeg='no'
2177 JPEG_LIBS=''
2178 if test "$with_jpeg" != 'no'; then
2179     AC_MSG_RESULT([-------------------------------------------------------------])
2180     AC_MSG_CHECKING([for JPEG])
2181     AC_MSG_RESULT([])
2182     failed=0
2183     passed=0
2184     AC_CHECK_HEADER(jconfig.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2185     AC_CHECK_HEADER(jerror.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2186     AC_CHECK_HEADER(jmorecfg.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2187     AC_CHECK_HEADER(jpeglib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2188     AC_CHECK_LIB(jpeg,jpeg_read_header,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2189
2190 # Test for compatible JPEG library
2191 if test "$ac_cv_jpeg_version_ok" != 'yes'; then
2192 AC_CACHE_CHECK(for JPEG library is version 6b or later, ac_cv_jpeg_version_ok,
2193 [AC_TRY_COMPILE(
2194 #include <stdio.h>
2195 #include <stdlib.h>
2196 #include <jpeglib.h>
2197 ,
2198 changequote(<<, >>)dnl
2199 <<
2200 #if JPEG_LIB_VERSION < 62
2201 #error IJG JPEG library must be version 6b or newer!
2202 #endif
2203 return 0;
2204 >>,
2205 changequote([, ])dnl
2206 ac_cv_jpeg_version_ok='yes'; passed=`expr $passed + 1`,
2207 ac_cv_jpeg_version_ok='no'; failed=`expr $failed + 1`)])
2208 fi
2209     AC_MSG_CHECKING([if JPEG package is complete])
2210     if test $passed -gt 0; then
2211         if test $failed -gt 0; then
2212             AC_MSG_RESULT([no -- some components failed test])
2213             have_jpeg='no (failed tests)'
2214         else
2215             JPEG_LIBS='-ljpeg'
2216             LIBS="$JPEG_LIBS $LIBS"
2217             AC_DEFINE(JPEG_DELEGATE,1,Define if you have JPEG library)
2218             AC_MSG_RESULT([yes])
2219             have_jpeg='yes'
2220         fi
2221     else
2222         AC_MSG_RESULT([no])
2223     fi
2224 fi
2225 AM_CONDITIONAL(JPEG_DELEGATE, test "$have_jpeg" = 'yes')
2226 AC_SUBST(JPEG_LIBS)
2227
2228 dnl ===========================================================================
2229
2230 #
2231 # Check for JPEG Version 2 delegate library.
2232 #
2233 AC_ARG_WITH([jp2],
2234     [AC_HELP_STRING([--without-jp2],
2235                     [disable JPEG-2000 support])],
2236     [with_jp2=$withval],
2237     [with_jp2='yes'])
2238
2239 if test "$with_jp2" != 'yes'; then
2240     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jp2=$with_jp2 "
2241 fi
2242
2243 have_jp2='no'
2244 JP2_LIBS=''
2245 if test "$with_jp2" != 'no'; then
2246     AC_MSG_RESULT([-------------------------------------------------------------])
2247     AC_MSG_CHECKING([for JPEG Version 2])
2248     AC_MSG_RESULT([])
2249     failed=0
2250     passed=0
2251     AC_CHECK_HEADER(jasper/jasper.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2252     AC_CHECK_LIB(jasper,jas_stream_fopen,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2253     AC_MSG_CHECKING([if JPEG version 2 support package is complete])
2254     if test $passed -gt 0; then
2255         if test $failed -gt 0; then
2256             AC_MSG_RESULT([no -- some components failed test])
2257             have_jp2='no (failed tests)'
2258         else
2259             JP2_LIBS='-ljasper'
2260             LIBS="$JP2_LIBS $LIBS"
2261             AC_DEFINE(JP2_DELEGATE,1,Define if you have JPEG version 2 "Jasper" library)
2262             AC_MSG_RESULT([yes])
2263             have_jp2='yes'
2264         fi
2265     else
2266         AC_MSG_RESULT([no])
2267     fi
2268 fi
2269 AM_CONDITIONAL(JP2_DELEGATE, test "$have_jp2" = 'yes')
2270 AC_SUBST(JP2_LIBS)
2271
2272 dnl ===========================================================================
2273
2274 #
2275 # Check for LCMS delegate library.
2276 #
2277 # Disable LCMS.
2278 AC_ARG_WITH(lcms,
2279         [  --without-lcms          disable lcms (v1.1X) support],
2280         [with_lcms=$withval],
2281         [with_lcms='yes'])
2282 if test "$with_lcms" != 'yes' ; then
2283     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-lcms=$with_lcms "
2284 fi
2285
2286 # Disable LCMS2.
2287 AC_ARG_WITH(lcms2,
2288         [  --without-lcms2         disable lcms (v2.X) support],
2289         [with_lcms2=$withval],
2290         [with_lcms2='yes'])
2291 if test "$with_lcms2" != 'yes' ; then
2292     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-lcms2=$with_lcms2 "
2293 fi
2294
2295 have_lcms2='no'
2296 LCMS_LIBS=''
2297 if test "$with_lcms2" != 'no'; then
2298     AC_MSG_RESULT([-------------------------------------------------------------])
2299     AC_MSG_CHECKING([for LCMS v2])
2300     AC_MSG_RESULT()
2301     failed=0
2302     passed=0
2303     have_lcms_header='no'
2304
2305     # Check for <lcms2.h>
2306     AC_CHECK_HEADER(lcms2.h,have_lcms_header='yes',,)
2307     if test "$have_lcms_header" = 'yes'; then
2308        AC_DEFINE(HAVE_LCMS2_H,1,Define if you have the <lcms2.h> header file.)
2309        passed=`expr $passed + 1`
2310     fi
2311
2312     # Check for <lcms2/lcms2.h)
2313     if test "$have_lcms_header" != 'yes'; then
2314       AC_CHECK_HEADER(lcms2/lcms2.h,have_lcms_header='yes',,)
2315       if test "$have_lcms_header" = 'yes'; then
2316         passed=`expr $passed + 1`
2317         AC_DEFINE(HAVE_LCMS2_LCMS2_H,1,Define if you have the <lcms2/lcms2.h> header file.)
2318       fi
2319     fi
2320
2321     # Failed to find lcms header?
2322     if test "$have_lcms_header" != 'yes'; then
2323       failed=`expr $failed + 1`
2324     fi
2325
2326     AC_CHECK_LIB(lcms2,cmsSetLogErrorHandler,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2327     AC_MSG_CHECKING(if LCMS v2 package is complete)
2328     if test $passed -gt 0; then
2329       if test $failed -gt 0; then
2330         AC_MSG_RESULT(no -- some components failed test)
2331         have_lcms2='no (failed tests)'
2332       else
2333         LCMS_LIBS='-llcms2'
2334         LIBS="$LCMS_LIBS $LIBS"
2335         AC_MSG_RESULT(yes)
2336         have_lcms2='yes'
2337       fi
2338     else
2339       AC_MSG_RESULT(no)
2340     fi
2341 fi
2342
2343 #
2344 # Check for LCMS v1 (1.11 or later)
2345 #
2346 if test $have_lcms2 = 'yes'; then
2347   with_lcms='no'
2348 fi
2349
2350 have_lcms='no'
2351 if test "$with_lcms" != 'no'; then
2352     AC_MSG_RESULT([-------------------------------------------------------------])
2353     AC_MSG_CHECKING([for LCMS v1.1X])
2354     AC_MSG_RESULT()
2355     failed=0
2356     passed=0
2357     have_lcms_header='no'
2358
2359     # Check for <lcms.h>
2360     if test "$have_lcms_header" != 'yes'; then
2361       AC_CHECK_HEADER(lcms.h,have_lcms_header='yes',,)
2362       if test "$have_lcms_header" = 'yes'; then
2363         passed=`expr $passed + 1`
2364         AC_DEFINE(HAVE_LCMS_H,1,Define if you have the <lcms.h> header file.)
2365       fi
2366     fi
2367
2368     # Check for <lcms/lcms.h>
2369     if test "$have_lcms_header" != 'yes'; then
2370       AC_CHECK_HEADER(lcms/lcms.h,have_lcms_header='yes',,)
2371       if test "$have_lcms_header" = 'yes'; then
2372         passed=`expr $passed + 1`
2373         AC_DEFINE(HAVE_LCMS_LCMS_H,1,Define if you have the <lcms/lcms.h> header file.)
2374       fi
2375     fi
2376
2377     # Failed to find lcms header?
2378     if test "$have_lcms_header" != 'yes'; then
2379       failed=`expr $failed + 1`
2380     fi
2381
2382     AC_CHECK_LIB(lcms,cmsSetErrorHandler,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2383     AC_MSG_CHECKING(if LCMS package is complete)
2384     if test $passed -gt 0; then
2385       if test $failed -gt 0; then
2386         AC_MSG_RESULT(no -- some components failed test)
2387         have_lcms='no (failed tests)'
2388       else
2389         LCMS_LIBS='-llcms'
2390         LIBS="$LCMS_LIBS $LIBS"
2391         AC_MSG_RESULT(yes)
2392         have_lcms='yes'
2393       fi
2394     else
2395       AC_MSG_RESULT(no)
2396     fi
2397 fi
2398
2399 AM_CONDITIONAL(LCMS_DELEGATE, test "$have_lcms2" = 'yes' -o "$have_lcms" = 'yes')
2400 if test "$have_lcms2" = 'yes' -o "$have_lcms" = 'yes'; then
2401   AC_DEFINE(LCMS_DELEGATE,1,[Define if you have LCMS (v1.11 or later) library])
2402 fi
2403 AC_SUBST(LCMS_LIBS)
2404
2405
2406 dnl ===========================================================================
2407
2408 #
2409 # Check for the LQR (Liquid Rescale) delegate library.
2410 #
2411 AC_ARG_WITH([lqr],
2412     [AC_HELP_STRING([--without-lqr],
2413                     [disable Liquid Rescale support])],
2414     [with_lqr=$withval],
2415     [with_lqr='yes'])
2416
2417 if test "$with_lqr" != 'yes'; then
2418     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-lqr=$with_lqr "
2419 fi
2420
2421 have_lqr='no'
2422 LQR_CFLAGS=""
2423 LQR_LIBS=""
2424 LQR_PKG=""
2425 if test "x$with_lqr" = "xyes"; then
2426     AC_MSG_RESULT([-------------------------------------------------------------])
2427     PKG_CHECK_MODULES(LQR,[lqr-1 >= 0.1.0], have_lqr=yes, have_lqr=no)
2428     AC_MSG_RESULT([])
2429 fi
2430
2431 if test "$have_lqr" = 'yes'; then
2432     AC_DEFINE(LQR_DELEGATE,1,Define if you have LQR library)
2433     CFLAGS="$LQR_CFLAGS $CFLAGS"
2434 fi
2435
2436 AM_CONDITIONAL(LQR_DELEGATE, test "$have_lqr" = 'yes')
2437 AC_SUBST(LQR_CFLAGS)
2438 AC_SUBST(LQR_LIBS)
2439
2440 dnl ===========================================================================
2441
2442 # Disable LZMA (lzma library)
2443 AC_ARG_WITH(lzma,
2444               [  --without-lzma          disable LZMA support],
2445               [with_lzma=$withval],
2446               [with_lzma='yes'])
2447 if test "$with_lzma" != 'yes' ; then
2448     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-lzma=$with_lzma "
2449 fi
2450
2451 LZMA_PKG=""
2452 if test "x$with_lzma" = "xyes"; then
2453     AC_MSG_RESULT([-------------------------------------------------------------])
2454     PKG_CHECK_MODULES(LZMA,[liblzma >= 2.9.0], have_lzma=yes, have_lzma=no)
2455     AC_MSG_RESULT([])
2456 fi
2457
2458 if test "$have_lzma" = 'yes'; then
2459     AC_DEFINE(LZMA_DELEGATE,1,Define if you have LZMA library)
2460     if test "$build_modules" = 'no'; then
2461         CPPFLAGS="$LZMA_CFLAGS $CPPFLAGS"
2462     fi
2463 fi
2464
2465 AM_CONDITIONAL(LZMA_DELEGATE, test "$have_lzma" = 'yes')
2466 AC_SUBST(LZMA_CFLAGS)
2467 AC_SUBST(LZMA_LIBS)
2468
2469 dnl ===========================================================================
2470
2471 #
2472 # Check for the OpenEXR delegate library.
2473 #
2474 AC_ARG_WITH([openexr],
2475     [AC_HELP_STRING([--without-openexr],
2476                     [disable OpenEXR support])],
2477     [with_openexr=$withval],
2478     [with_openexr='yes'])
2479
2480 if test "$with_openexr" != 'yes'; then
2481     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-openexr=$with_openexr "
2482 fi
2483
2484 have_openexr='no'
2485 OPENEXR_CFLAGS=""
2486 OPENEXR_LIBS=""
2487 OPENEXR_PKG=""
2488 if test "x$with_openexr" = "xyes"; then
2489     AC_MSG_RESULT([-------------------------------------------------------------])
2490     PKG_CHECK_MODULES(OPENEXR,[OpenEXR >= 1.0.6], have_openexr=yes, have_openexr=no)
2491     AC_MSG_RESULT([])
2492 fi
2493
2494 if test "$have_openexr" = 'yes'; then
2495     AC_DEFINE(OPENEXR_DELEGATE,1,Define if you have OPENEXR library)
2496     if test "$build_modules" = 'no'; then
2497         CFLAGS="$OPENEXR_CFLAGS $CFLAGS"
2498     fi
2499 fi
2500
2501 AM_CONDITIONAL(OPENEXR_DELEGATE, test "$have_openexr" = 'yes')
2502 AC_SUBST(OPENEXR_CFLAGS)
2503 AC_SUBST(OPENEXR_LIBS)
2504
2505 dnl ===========================================================================
2506
2507 #
2508 # Check for PANGO delegate library.
2509 #
2510 AC_ARG_WITH([pango],
2511     [AC_HELP_STRING([--without-pango],
2512                     [disable PANGO support])],
2513     [with_pango=$withval],
2514     [with_pango='yes'])
2515
2516 if test "$with_pango" != 'yes'; then
2517     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-pango=$with_pango "
2518 fi
2519
2520 have_pango='no'
2521 have_pangocairo='no'
2522 PANGO_CFLAGS=""
2523 PANGO_LIBS=""
2524 PANGO_PKG=""
2525 if test "x$with_pango" = "xyes"; then
2526     AC_MSG_RESULT([-------------------------------------------------------------])
2527     PKG_CHECK_MODULES(PANGO, [pangocairo >= 1.28.1], have_pangocairo=yes, have_pangocairo=no)
2528     AC_MSG_RESULT([])
2529     PKG_CHECK_MODULES(PANGO, [pango >= 1.28.1], have_pango=yes, have_pango=no)
2530     AC_MSG_RESULT([])
2531 fi
2532
2533 if test "$have_pango" = 'yes'; then
2534     AC_DEFINE(PANGO_DELEGATE,1,Define if you have PANGO library)
2535     if test "$build_modules" = 'no'; then
2536         CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
2537     fi
2538 fi
2539
2540 if test "$have_pangocairo" = 'yes'; then
2541     AC_DEFINE(PANGOCAIRO_DELEGATE,1,Define if you have PANGOCAIRO library)
2542     if test "$build_modules" = 'no'; then
2543         CPPFLAGS="$PANGOCAIRO_CFLAGS $CPPFLAGS"
2544     fi
2545 fi
2546
2547 AM_CONDITIONAL(PANGO_DELEGATE, test "$have_pango" = 'yes')
2548 AM_CONDITIONAL(PANGOCAIRO_DELEGATE, test "$have_pangocairo" = 'yes')
2549 AC_SUBST(PANGO_CFLAGS)
2550 AC_SUBST(PANGO_LIBS)
2551
2552 dnl ===========================================================================
2553
2554 #
2555 # Check for PNG delegate library.
2556 #
2557 AC_ARG_WITH(png,
2558     [AC_HELP_STRING([--without-png],
2559                     [disable PNG support])],
2560     [with_png=$withval],
2561     [with_png='yes'])
2562
2563 if test "$with_png" != 'yes'; then
2564     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-png=$with_png "
2565 fi
2566
2567 have_png='no'
2568 PNG_LIBS=''
2569
2570 if test "$with_png" != 'no' -a  "$have_zlib" != 'no' ; then
2571   AC_MSG_RESULT([-------------------------------------------------------------])
2572   AC_MSG_CHECKING(for PNG support )
2573   AC_MSG_RESULT()
2574   failed=0
2575   passed=0
2576   AC_CHECK_HEADER(png.h,passed=`expr $passed + 1`,
2577      failed=`expr $failed + 1`,)
2578
2579   if test $passed -gt 0; then
2580     for var in 5 4 2 '' ; do
2581       if test "$have_png" = 'no' ; then
2582         if test "x${var}" = 'x' ; then
2583           pnglib='png'
2584         else
2585           pnglib="png1${var}"
2586         fi
2587
2588 #       Test for compatible LIBPNG library
2589         failed=0
2590         passed=0
2591         if test "$with_png" = 'yes' -o "$with_png" = "libpng1${var}" ; then
2592           if test "${pnglib}" != 'png' ; then
2593             AC_MSG_CHECKING(for LIBPNG1${var} support )
2594             AC_TRY_COMPILE(
2595 #include <stdio.h>
2596 #include <stdlib.h>
2597 #include <png.h>
2598 ,
2599 changequote(<<, >>)dnl
2600 <<
2601 #if PNG_LIBPNG_VER_MINOR != ${var}
2602 #error LIBPNG library must be version 1${var}!
2603 Kaboom, Kaboom
2604 #endif
2605 return 0;
2606 >>,
2607             changequote([, ])dnl
2608             ac_cv_libpng_ok='yes',
2609             ac_cv_libpng_ok='no')
2610             if test "$ac_cv_libpng_ok" = 'yes' ; then
2611               passed=`expr $passed + 1`
2612               AC_MSG_RESULT(yes)
2613             else
2614               failed=`expr $failed + 1`
2615               AC_MSG_RESULT(no)
2616             fi
2617           else
2618             passed=`expr $passed + 1`
2619             AC_MSG_RESULT(yes)
2620           fi
2621         fi
2622
2623         if test $passed -gt 0 -a $failed -le 0; then
2624           if test "1${var}" = '15' ; then
2625             AC_CHECK_LIB(png15,png_get_io_ptr,passed=`expr $passed + 1`,
2626                failed=`expr $failed + 1`,)
2627             AC_CHECK_LIB(png15,png_longjmp,passed=`expr $passed + 1`,
2628                failed=`expr $failed + 1`,)
2629           fi
2630           if test "1${var}" = '14' ; then
2631             AC_CHECK_LIB(png14,png_get_io_ptr,passed=`expr $passed + 1`,
2632                failed=`expr $failed + 1`,)
2633             AC_CHECK_LIB(png14,png_get_io_state,passed=`expr $passed + 1`,
2634                failed=`expr $failed + 1`,)
2635           fi
2636           if test "1${var}" = '12' ; then
2637             AC_CHECK_LIB(png12,png_get_io_ptr,passed=`expr $passed + 1`,
2638                failed=`expr $failed + 1`,)
2639           fi
2640           if test "1${var}" = '1' ; then
2641               AC_CHECK_LIB(png,png_get_io_ptr,passed=`expr $passed + 1`,
2642                  failed=`expr $failed + 1`,)
2643           fi
2644           if test $passed -gt 0 -a $failed -le 0 ; then
2645             AC_MSG_CHECKING(if ${pnglib} package is complete)
2646             if test $passed -gt 0 ; then
2647               if test $failed -gt 0 ; then
2648                   AC_MSG_RESULT(no -- some components failed test)
2649                   have_png='no (failed tests)'
2650               else
2651                   PNG_LIBS="-l${pnglib}"
2652                   LIBS="$PNG_LIBS $LIBS"
2653                   AC_DEFINE(PNG_DELEGATE,1,Define if you have PNG library)
2654                   AC_MSG_RESULT(yes)
2655                   have_png='yes'
2656               fi
2657             fi
2658           fi
2659         fi
2660       fi
2661     done
2662   fi
2663 fi
2664
2665 AM_CONDITIONAL(PNG_DELEGATE,test "$have_png" = 'yes')
2666 AC_SUBST(PNG_LIBS)
2667
2668
2669 dnl ===========================================================================
2670
2671 #
2672 # Check for RSVG delegate library.
2673 #
2674 AC_ARG_WITH([rsvg],
2675     [AC_HELP_STRING([--without-rsvg],
2676                     [enable RSVG support])],
2677     [with_rsvg=$withval],
2678     [with_rsvg='no'])
2679
2680 if test "$with_rsvg" != 'yes'; then
2681     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-rsvg=$with_rsvg "
2682 fi
2683
2684 have_rsvg='no'
2685 have_cairo='no'
2686 RSVG_CFLAGS=""
2687 RSVG_LIBS=""
2688 RSVG_PKG=""
2689 if test "x$with_rsvg" = "xyes"; then
2690     AC_MSG_RESULT([-------------------------------------------------------------])
2691     PKG_CHECK_MODULES(RSVG,[librsvg-2.0 >= 2.9.0], have_rsvg=yes, have_rsvg=no)
2692     AC_MSG_RESULT([])
2693     PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg, have_cairo=yes, have_cairo=no)
2694     AC_MSG_RESULT([])
2695 fi
2696
2697 if test "$have_rsvg" = 'yes'; then
2698     AC_DEFINE(RSVG_DELEGATE,1,Define if you have RSVG library)
2699     if test "$build_modules" = 'no'; then
2700         CPPFLAGS="$RSVG_CFLAGS $CPPFLAGS"
2701     fi
2702 fi
2703
2704 if test "$have_cairo" = 'yes'; then
2705     AC_DEFINE(CAIRO_DELEGATE,1,Define if you have CAIRO library)
2706     if test "$build_modules" = 'no'; then
2707         CPPFLAGS="$CAIRO_SVG_CFLAGS $CPPFLAGS"
2708     fi
2709 fi
2710
2711 AM_CONDITIONAL(RSVG_DELEGATE, test "$have_rsvg" = 'yes')
2712 AM_CONDITIONAL(CAIRO_DELEGATE, test "$have_cairo" = 'yes')
2713 AC_SUBST(RSVG_CFLAGS)
2714 AC_SUBST(RSVG_LIBS)
2715
2716 dnl ===========================================================================
2717
2718 #
2719 # Check for TIFF delegate library.
2720 #
2721 AC_ARG_WITH([tiff],
2722     [AC_HELP_STRING([--without-tiff],
2723                     [disable TIFF support])],
2724     [with_tiff=$withval],
2725     [with_tiff='yes'])
2726
2727 if test "$with_tiff" != 'yes'; then
2728     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-tiff=$with_tiff "
2729 fi
2730
2731 have_tiff='no'
2732 TIFF_LIBS=''
2733 if test "$with_tiff" != 'no'; then
2734     AC_MSG_RESULT([-------------------------------------------------------------])
2735     AC_MSG_CHECKING([for TIFF])
2736     AC_MSG_RESULT([])
2737     failed=0
2738     passed=0
2739     AC_CHECK_HEADER(tiff.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2740     AC_CHECK_HEADER(tiffio.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2741     AC_CHECK_LIB(tiff,TIFFOpen,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2742     AC_CHECK_LIB(tiff,TIFFClientOpen,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2743     AC_CHECK_LIB(tiff,TIFFIsByteSwapped,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2744     AC_CHECK_LIB(tiff,TIFFReadRGBATile,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2745     AC_CHECK_LIB(tiff,TIFFReadRGBAStrip,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2746     AC_MSG_CHECKING([if TIFF package is complete])
2747     if test $passed -gt 0; then
2748         if test $failed -gt 0; then
2749             AC_MSG_RESULT([no -- some components failed test])
2750             have_tiff='no (failed tests)'
2751         else
2752             TIFF_LIBS='-ltiff'
2753             LIBS="$TIFF_LIBS $LIBS"
2754             AC_DEFINE(TIFF_DELEGATE,1,Define if you have TIFF library)
2755             AC_MSG_RESULT([yes])
2756             have_tiff='yes'
2757             AC_CHECK_HEADERS(tiffconf.h)
2758             AC_CHECK_FUNCS([TIFFIsCODECConfigured TIFFMergeFieldInfo \
2759               TIFFIsBigEndian TIFFReadEXIFDirectory TIFFSetErrorHandlerExt \
2760               TIFFSetTagExtender TIFFSetWarningHandlerExt \
2761               TIFFSwabArrayOfTriples])
2762         fi
2763     else
2764         AC_MSG_RESULT([no])
2765     fi
2766 fi
2767 AM_CONDITIONAL(TIFF_DELEGATE, test "$have_tiff" = 'yes')
2768 AC_SUBST(TIFF_LIBS)
2769
2770 dnl ===========================================================================
2771
2772 #
2773 # Check for WEBP delegate library.
2774 #
2775 AC_ARG_WITH(webp,
2776     [AC_HELP_STRING([--without-webp],
2777                     [disable WEBP support])],
2778     [with_webp=$withval],
2779     [with_webp='yes'])
2780
2781 if test "$with_webp" != 'yes'; then
2782     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-webp=$with_webp "
2783 fi
2784
2785 have_webp='no'
2786 WEBP_LIBS=''
2787 if test "$with_webp" != 'no'; then
2788     AC_MSG_RESULT([-------------------------------------------------------------])
2789     AC_MSG_CHECKING([for WEBP])
2790     AC_MSG_RESULT([])
2791     failed=0
2792     passed=0
2793     AC_CHECK_HEADER(webp/decode.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2794     AC_CHECK_LIB(webp,WebPDecodeRGB,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2795     AC_MSG_CHECKING([if WEBP package is complete])
2796     if test $passed -gt 0; then
2797         if test $failed -gt 0; then
2798             AC_MSG_RESULT([no -- some components failed test])
2799             have_webp='no (failed tests)'
2800         else
2801             WEBP_LIBS='-lwebp'
2802             LIBS="$WEBP_LIBS $LIBS"
2803             AC_DEFINE(WEBP_DELEGATE,1,Define if you have WEBP library)
2804             AC_MSG_RESULT([yes])
2805             have_webp='yes'
2806         fi
2807     else
2808         AC_MSG_RESULT([no])
2809     fi
2810 fi
2811 AM_CONDITIONAL(WEBP_DELEGATE,test "$have_webp" = 'yes')
2812 AC_SUBST(WEBP_LIBS)
2813
2814 dnl ===========================================================================
2815
2816 #
2817 # Set Windows font directory.
2818 #
2819 AC_ARG_WITH([windows-font-dir],
2820     [AC_HELP_STRING([--with-windows-font-dir=DIR],
2821                     [directory containing MS-Windows fonts])],
2822                     [with_windows_font_dir=$withval],
2823                     [with_windows_font_dir=''])
2824 if test "$with_windows_font_dir" != '' ; then
2825     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-windows-font-dir=$with_windows_font_dir "
2826 fi
2827
2828 dnl ===========================================================================
2829
2830 #
2831 # Check for WMF delegate library.
2832 #
2833 AC_ARG_WITH([wmf],
2834     [AC_HELP_STRING([--with-wmf],
2835                     [enable WMF support])],
2836     [with_wmf=$withval],
2837     [with_wmf='no'])
2838
2839 if test "$with_wmf" != 'yes'; then
2840     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-wmf=$with_wmf "
2841 fi
2842
2843 have_wmf='no'
2844 WMF_LIBS=''
2845 WMF_LIBS_DEPS=''
2846 OLIBS="$LIBS"
2847 if test "$with_wmf" != 'no'; then
2848     AC_MSG_RESULT([-------------------------------------------------------------])
2849     AC_MSG_CHECKING([for WMF])
2850     AC_MSG_RESULT([])
2851     have_libwmf='no'
2852     have_libwmflite='no'
2853     have_libwmf_ipa_h='no'
2854
2855     AC_CHECK_HEADER([libwmf/ipa.h],[have_libwmf_ipa_h='yes'],,[$FT2BUILD_H])
2856     if test "$have_libwmf_ipa_h" = 'yes'; then
2857         AC_CHECK_LIB(wmflite,wmf_lite_create,have_libwmflite='yes',,)
2858         if test "$have_libwmflite" = 'yes'; then
2859             AC_DEFINE(WMFLITE_DELEGATE,1,Define if you have wmflite library)
2860             WMF_LIBS='-lwmflite'
2861             LIBS="$WMF_LIBS $LIBS"
2862             have_wmf='yes'
2863         else
2864             WMF_LIBS_DEPS=''
2865             WMF_CONFIG_LIBS=`libwmf-config --libs`
2866             for lib in xml2 expat freetype jpeg png z; do
2867                 testlib="-l${lib}"
2868                 echo "$WMF_CONFIG_LIBS" | grep -- "$testlib" > /dev/null && WMF_LIBS_DEPS="$WMF_LIBS_DEPS $testlib"
2869             done
2870             AC_CHECK_LIB(wmf,wmf_api_create,have_libwmf='yes',,$WMF_LIBS_DEPS)
2871             if test "$have_libwmf" = 'yes'; then
2872                 AC_DEFINE(WMF_DELEGATE,1,Define if you have wmf library)
2873                 WMF_LIBS='-lwmf'
2874                 LIBS="$WMF_LIBS $LIBS"
2875                 have_wmf='yes'
2876             else
2877                 AC_MSG_RESULT([no -- some components failed test])
2878                 have_wmf='no (failed tests)'
2879                 have_wmflite='no (failed tests)'
2880                 LIBS="$OLIBS"
2881                 WMF_LIBS=''
2882             fi
2883         fi
2884     fi
2885     AC_MSG_CHECKING([if WMF package is complete])
2886     if test "$have_wmf" = 'yes'; then
2887         AC_MSG_RESULT([yes])
2888     else
2889         AC_MSG_RESULT([no])
2890     fi
2891 fi
2892 AM_CONDITIONAL(WMF_DELEGATE, test "$have_wmf" = 'yes')
2893 AC_SUBST(WMF_LIBS)
2894 AC_SUBST(WMF_LIBS_DEPS)
2895
2896
2897 dnl ===========================================================================
2898
2899 #
2900 # Check for XML delegate library.
2901 #
2902 AC_ARG_WITH([xml],
2903     [AC_HELP_STRING([--without-xml],
2904                     [disable XML support])],
2905     [with_xml=$withval],
2906     [with_xml='yes'])
2907
2908 if test "$with_xml" != 'yes' ; then
2909     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-xml=$with_xml "
2910 fi
2911
2912 have_xml='no'
2913 XML_LIBS=''
2914 if test "$with_xml" != 'no'; then
2915     AC_MSG_RESULT([-------------------------------------------------------------])
2916     AC_MSG_CHECKING([for XML])
2917     AC_MSG_RESULT([])
2918     PERSIST_LDFLAGS=$LDFLAGS
2919     PERSIST_CPPFLAGS=$CPPFLAGS
2920     xml2_config=''
2921     AC_PATH_PROG(xml2_config,xml2-config,)dnl
2922     if test -n "$xml2_config"; then
2923         # Debian installs libxml headers under /usr/include/libxml2/libxml with
2924         # the shared library installed under /usr/lib, whereas the package
2925         # installs itself under $prefix/libxml and $prefix/lib.
2926         xml2_prefix=`xml2-config --prefix`
2927         if test -d "${xml2_prefix}/include/libxml2"; then
2928             CPPFLAGS="$CPPFLAGS -I${xml2_prefix}/include/libxml2"
2929         fi
2930         if test "${xml2_prefix}" != '/usr'; then
2931             LDFLAGS="$LDFLAGS -L${xml2_prefix}/lib"
2932         fi
2933     fi
2934     failed=0
2935     passed=0
2936     AC_CHECK_HEADER(libxml/parser.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2937     AC_CHECK_LIB(xml2,xmlSAXVersion,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2938     AC_CHECK_LIB(xml2,xmlParseChunk,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2939     AC_CHECK_LIB(xml2,xmlCreatePushParserCtxt,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2940     AC_MSG_CHECKING([if XML package is complete])
2941     if test $passed -gt 0; then
2942         if test $failed -gt 0; then
2943             AC_MSG_RESULT([no -- some components failed test])
2944             have_xml='no (failed tests)'
2945             LDFLAGS="$PERSIST_LDFLAGS"
2946             CPPFLAGS="$PERSIST_CPPFLAGS"
2947         else
2948             XML_LIBS='-lxml2'
2949             LIBS="$XML_LIBS $LIBS"
2950             AC_DEFINE(XML_DELEGATE,1,Define if you have XML library)
2951             AC_MSG_RESULT([yes])
2952             have_xml='yes'
2953         fi
2954     else
2955         AC_MSG_RESULT([no])
2956     fi
2957 fi
2958 AM_CONDITIONAL(XML_DELEGATE,test "$have_xml" = 'yes')
2959 AC_SUBST(XML_LIBS)
2960
2961 dnl ===========================================================================
2962
2963 # Substitute compiler name to build/link PerlMagick
2964 #
2965 AC_SUBST(PERLMAINCC)
2966
2967 #
2968 # Configure install Paths
2969 #
2970
2971 # Path to ImageMagick header files
2972 INCLUDE_RELATIVE_PATH="ImageMagick"
2973 INCLUDE_PATH="${INCLUDE_DIR}/${INCLUDE_RELATIVE_PATH}"
2974 DEFINE_INCLUDE_PATH="${INCLUDE_DIR}/${INCLUDE_RELATIVE_PATH}/"
2975 case "${build_os}" in
2976   mingw* )
2977     DEFINE_INCLUDE_PATH=`$WinPathScript "$DEFINE_INCLUDE_PATH" 1`
2978     ;;
2979 esac
2980 AC_DEFINE_UNQUOTED(INCLUDE_PATH,"$DEFINE_INCLUDE_PATH",[Directory where ImageMagick headers live.])
2981 AC_SUBST(INCLUDE_PATH)
2982
2983 # Path to ImageMagick header files (arch part)
2984 INCLUDEARCH_PATH="${INCLUDEARCH_DIR}/${INCLUDE_RELATIVE_PATH}"
2985 DEFINE_INCLUDEARCH_PATH="${INCLUDEARCH_DIR}/${INCLUDE_RELATIVE_PATH}/"
2986 case "${build_os}" in
2987   mingw* )
2988     DEFINE_INCLUDEARCH_PATH=`$WinPathScript "$DEFINE_INCLUDEARCH_PATH" 1`
2989     ;;
2990 esac
2991 AC_DEFINE_UNQUOTED(INCLUDEARCH_PATH,"$DEFINE_INCLUDE_PATH",[Directory where ImageMagick architecture headers live.])
2992 AC_SUBST(INCLUDEARCH_PATH)
2993
2994 # Subdirectory under lib to place ImageMagick lib files
2995 LIBRARY_RELATIVE_PATH="${PACKAGE_NAME}-${PACKAGE_VERSION}"
2996 AC_DEFINE_UNQUOTED(LIBRARY_RELATIVE_PATH,"$LIBRARY_RELATIVE_PATH",[Subdirectory of lib where ImageMagick architecture dependent files are installed.])
2997
2998 # Path to ImageMagick bin directory
2999 EXECUTABLE_PATH="${BIN_DIR}"
3000 DEFINE_EXECUTABLE_PATH="${BIN_DIR}/"
3001 case "${build_os}" in
3002   mingw* )
3003     DEFINE_EXECUTABLE_PATH=`$WinPathScript "$DEFINE_EXECUTABLE_PATH" 1`
3004     ;;
3005 esac
3006 AC_DEFINE_UNQUOTED(EXECUTABLE_PATH,"$DEFINE_EXECUTABLE_PATH",[Directory where executables are installed.])
3007 AC_SUBST(EXECUTABLE_PATH)
3008
3009 # Path to ImageMagick lib
3010 LIBRARY_PATH="${LIB_DIR}/${LIBRARY_RELATIVE_PATH}"
3011 DEFINE_LIBRARY_PATH="${LIB_DIR}/${LIBRARY_RELATIVE_PATH}/"
3012 case "${build_os}" in
3013   mingw* )
3014     DEFINE_LIBRARY_PATH=`$WinPathScript "$DEFINE_LIBRARY_PATH" 1`
3015     ;;
3016 esac
3017 AC_DEFINE_UNQUOTED(LIBRARY_PATH,"$DEFINE_LIBRARY_PATH",[Directory where architecture-dependent files live.])
3018 AC_SUBST(LIBRARY_PATH)
3019
3020 #
3021 # path to modules lib
3022 if test "x$MODULES_BASEDIRNAME" = "x"; then
3023    MODULES_BASEDIRNAME="modules"
3024 fi
3025 AC_DEFINE_UNQUOTED(MODULES_BASEDIRNAME,"$MODULES_BASEDIRNAME",[Module directory name without ABI part.])
3026 AC_SUBST(MODULES_BASEDIRNAME)
3027
3028 if test "x$MODULES_DIRNAME" = "x"; then
3029   MODULES_DIRNAME=${MODULES_BASEDIRNAME}-${MAGICK_ABI_SUFFIX}
3030 else
3031   AC_DEFINE_UNQUOTED(MODULES_DIRNAME,"$MODULES_DIRNAME",[Module directory dirname])
3032 fi
3033 AC_SUBST(MODULES_DIRNAME)
3034
3035 MODULES_RELATIVE_PATH="${MODULES_DIRNAME}"
3036 AC_SUBST(MODULES_RELATIVE_PATH)
3037 MODULES_PATH="${LIBRARY_PATH}/${MODULES_RELATIVE_PATH}"
3038 AC_SUBST(MODULES_PATH)
3039
3040 #
3041 # path to coders lib
3042 if test "x$CODER_DIRNAME" = "x"; then
3043    CODER_DIRNAME="coders"
3044 fi
3045 AC_DEFINE_UNQUOTED(CODER_DIRNAME,"$CODER_DIRNAME",[coders subdirectory.])
3046 AC_SUBST(CODER_DIRNAME)
3047
3048 CODER_RELATIVE_PATH="${CODER_DIRNAME}"
3049 CODER_PATH="${MODULES_PATH}/${CODER_DIRNAME}"
3050 AC_SUBST(CODER_PATH)
3051
3052 #
3053 # Subdirectory under lib to place ImageMagick filter module files
3054 #
3055 # path to coders lib
3056 if test "x$FILTER_DIRNAME" = "x"; then
3057    FILTER_DIRNAME="filters"
3058 fi
3059 AC_DEFINE_UNQUOTED(FILTER_DIRNAME,"$FILTER_DIRNAME",[filter subdirectory.])
3060 AC_SUBST(FILTER_DIRNAME)
3061
3062 FILTER_RELATIVE_PATH="${FILTER_DIRNAME}"
3063 FILTER_PATH="${MODULES_PATH}/${FILTER_DIRNAME}"
3064 AC_SUBST(FILTER_PATH)
3065
3066 #
3067 # Path to ImageMagick documentation files
3068 DOCUMENTATION_RELATIVE_PATH="${PACKAGE_NAME}-${PACKAGE_VERSION}"
3069 DOCUMENTATION_PATH="${DOC_DIR}/${DOCUMENTATION_RELATIVE_PATH}"
3070 DEFINE_DOCUMENTATION_PATH="${DOC_DIR}/${DOCUMENTATION_RELATIVE_PATH}/"
3071 case "${build_os}" in
3072   mingw* )
3073     DEFINE_DOCUMENTATION_PATH=`$WinPathScript "$DEFINE_DOCUMENTATION_PATH" 1`
3074     ;;
3075 esac
3076 AC_DEFINE_UNQUOTED(DOCUMENTATION_PATH,"$DEFINE_DOCUMENTATION_PATH",[Directory where ImageMagick documents live.])
3077 AC_SUBST(DOCUMENTATION_PATH)
3078
3079 # Subdirectory to place architecture-dependent configuration files
3080 CONFIGURE_RELATIVE_PATH="${PACKAGE_NAME}"
3081 AC_DEFINE_UNQUOTED(CONFIGURE_RELATIVE_PATH,"$CONFIGURE_RELATIVE_PATH",[Subdirectory of lib where architecture-dependent configuration files live.])
3082 CONFIGURE_PATH="${SYSCONF_DIR}/${CONFIGURE_RELATIVE_PATH}/"
3083 DEFINE_CONFIGURE_PATH="${SYSCONF_DIR}/${CONFIGURE_RELATIVE_PATH}/"
3084 case "${build_os}" in
3085   mingw* )
3086     DEFINE_CONFIGURE_PATH=`$WinPathScript "$DEFINE_CONFIGURE_PATH" 1`
3087     ;;
3088 esac
3089 AC_DEFINE_UNQUOTED(CONFIGURE_PATH,"$DEFINE_CONFIGURE_PATH",[Directory where architecture-dependent configuration files live.])
3090 AC_SUBST(CONFIGURE_PATH)
3091
3092 # Subdirectory to place architecture-independent configuration files
3093 SHARE_RELATIVE_PATH="${LIBRARY_RELATIVE_PATH}"
3094 AC_DEFINE_UNQUOTED(SHARE_RELATIVE_PATH,"$SHARE_RELATIVE_PATH",[Subdirectory of lib where architecture-independent configuration files live.])
3095 SHARE_PATH="${DATA_DIR}/${SHARE_RELATIVE_PATH}"
3096 DEFINE_SHARE_PATH="${DATA_DIR}/${SHARE_RELATIVE_PATH}/"
3097 case "${build_os}" in
3098   mingw* )
3099     DEFINE_SHARE_PATH=`$WinPathScript "$DEFINE_SHARE_PATH" 1`
3100     ;;
3101 esac
3102 AC_DEFINE_UNQUOTED(SHARE_PATH,"$DEFINE_SHARE_PATH",[Directory where architecture-independent configuration files live.])
3103 AC_SUBST(SHARE_PATH)
3104
3105 #
3106 # Subdirectory to place architecture-dependent configuration files.
3107 if test "x$SHAREARCH_BASEDIRNAME" = "x"; then
3108    SHAREARCH_BASEDIRNAME="config"
3109 fi
3110 AC_DEFINE_UNQUOTED(SHAREARCH_BASEDIRNAME,"$SHAREARCH_BASEDIRNAME",[Sharearch directory name without ABI part.])
3111 AC_SUBST(SHAREARCH_BASEDIRNAME)
3112
3113 if test "x$SHAREARCH_DIRNAME" = "x"; then
3114   SHAREARCH_DIRNAME=${SHAREARCH_BASEDIRNAME}-${MAGICK_ABI_SUFFIX}
3115 else
3116   AC_DEFINE_UNQUOTED(SHAREARCH_DIRNAME,"$SHAREARCH_DIRNAME",[Sharearch directory dirname])
3117 fi
3118 AC_SUBST(SHAREARCH_DIRNAME)
3119
3120 SHAREARCH_RELATIVE_PATH="${SHAREARCH_DIRNAME}"
3121 AC_SUBST(SHAREARCH_RELATIVE_PATH)
3122 SHAREARCH_PATH="${LIBRARY_PATH}/${SHAREARCH_RELATIVE_PATH}"
3123 AC_SUBST(SHAREARCH_PATH)
3124
3125 #
3126 # program_transform_name is formed for use in a Makefile, so create a
3127 # modified version for use in a shell script.
3128 configure_transform_name=`echo ${program_transform_name} | sed 's,\\$\\$,$,'`
3129
3130 # Default delegate definitions
3131 AC_MSG_RESULT([-------------------------------------------------------------])
3132 AC_MSG_CHECKING([for ImageMagick delegate programs])
3133 AC_MSG_RESULT([])
3134 AutotraceDecodeDelegateDefault='autotrace'
3135 BlenderDecodeDelegateDefault='blender'
3136 BZIPDelegateDefault='bzip2'
3137 BrowseDelegateDefault='xdg-open'
3138 CGMDecodeDelegateDefault='ralcgm'
3139 CatDelegateDefault='cat'
3140 DNGDecodeDelegateDefault='ufraw-batch'
3141 GVCDecodeDelegateDefault='dot'
3142 DVIDecodeDelegateDefault='dvips'
3143 EchoDelegateDefault='echo'
3144 EditorDelegateDefault='xterm'
3145 FIGDecodeDelegateDefault='fig2dev'
3146 ConvertDelegateDefault=`echo convert | sed ${configure_transform_name}`
3147 DisplayDelegateDefault=`echo display | sed ${configure_transform_name}`
3148 MogrifyDelegateDefault=`echo mogrify | sed ${configure_transform_name}`
3149 GnuplotDecodeDelegateDefault='gnuplot'
3150 HPGLDecodeDelegateDefault='hp2xx'
3151 HTMLDecodeDelegateDefault='html2ps'
3152 ILBMDecodeDelegateDefault='ilbmtoppm'
3153 ILBMEncodeDelegateDefault='ppmtoilbm'
3154 LPDelegateDefault='lp'
3155 LPRDelegateDefault='lpr'
3156 LaunchDelegateDefault='gimp'
3157 MANDelegateDefault='groff'
3158 MPEGDecodeDelegateDefault='ffmpeg'
3159 MPEGEncodeDelegateDefault='ffmpeg'
3160 MrSIDDecodeDelegateDefault='mrsidgeodecode'
3161 MVDelegateDefault='mv'
3162 PCLDelegateDefault='pcl6'
3163 PGPDecodeDelegateDefault='pgpv'
3164 POVDelegateDefault='povray'
3165 if test "$native_win32_build" = 'yes'; then
3166     PSDelegateDefault='gswin32c'
3167 elif test "$gslib_framework" = 'yes'; then
3168     PSDelegateDefault='gsc'
3169 else
3170     PSDelegateDefault='gs'
3171 fi
3172 RLEEncodeDelegateDefault='rawtorle'
3173 RMDelegateDefault='rm'
3174 RSVGDecodeDelegateDefault='rsvg-convert'
3175 SCANDecodeDelegateDefault='scanimage'
3176 SVGDecodeDelegateDefault='inkscape'
3177 TXTDelegateDefault='enscript'
3178 UniconvertorDelegateDefault='uniconvertor'
3179 WMFDecodeDelegateDefault='wmf2eps'
3180 WWWDecodeDelegateDefault='curl'
3181 XPSDelegateDefault='gxps'
3182 ZipDelegateDefault='gzip'
3183
3184 # Search for delegates
3185 AC_PATH_PROG(AutotraceDecodeDelegate, "$AutotraceDecodeDelegateDefault", "$AutotraceDecodeDelegateDefault")
3186 AC_PATH_PROG(BlenderDecodeDelegate, "$BlenderDecodeDelegateDefault", "$BlenderDecodeDelegateDefault")
3187 AC_PATH_PROG(BZIPDelegate, "$BZIPDelegateDefault", "$BZIPDelegateDefault")
3188 AC_PATH_PROGS(BrowseDelegate, "$BrowseDelegateDefault" google-chrome firefox konqueror mozilla lynx, "$BrowseDelegateDefault")
3189 AC_PATH_PROG(CGMDecodeDelegate, "$CGMDecodeDelegateDefault", "$CGMDecodeDelegateDefault")
3190 AC_PATH_PROG(CatDelegate, "$CatDelegateDefault", "$CatDelegateDefault")
3191 AC_PATH_PROG(DNGDecodeDelegate, "$DNGDecodeDelegateDefault", "$DNGDecodeDelegateDefault")
3192 AC_PATH_PROG(GVCDecodeDelegate, "$GVCDecodeDelegateDefault", "$GVCDecodeDelegateDefault")
3193 AC_PATH_PROG(DVIDecodeDelegate, "$DVIDecodeDelegateDefault", "$DVIDecodeDelegateDefault")
3194 AC_PATH_PROG(EchoDelegate, "$EchoDelegateDefault", "$EchoDelegateDefault")
3195 AC_PATH_PROG(EditorDelegate, "$EditorDelegateDefault", "$EditorDelegateDefault")
3196 AC_PATH_PROG(FIGDecodeDelegate, "$FIGDecodeDelegateDefault", "$FIGDecodeDelegateDefault")
3197 AC_PATH_PROG(ConvertDelegate, "$ConvertDelegateDefault", "$ConvertDelegateDefault")
3198 AC_PATH_PROG(DisplayDelegate, "$DisplayDelegateDefault", "$DisplayDelegateDefault")
3199 AC_PATH_PROG(MogrifyDelegate, "$MogrifyDelegateDefault", "$MogrifyDelegateDefault")
3200 AC_PATH_PROG(GnuplotDecodeDelegate, "$GnuplotDecodeDelegateDefault", "$GnuplotDecodeDelegateDefault")
3201 AC_PATH_PROG(HPGLDecodeDelegate, "$HPGLDecodeDelegateDefault", "$HPGLDecodeDelegateDefault")
3202 AC_PATH_PROG(HTMLDecodeDelegate, "$HTMLDecodeDelegateDefault", "$HTMLDecodeDelegateDefault")
3203 AC_PATH_PROG(ILBMDecodeDelegate, "$ILBMDecodeDelegateDefault", "$ILBMDecodeDelegateDefault")
3204 AC_PATH_PROG(ILBMEncodeDelegate, "$ILBMEncodeDelegateDefault", "$ILBMEncodeDelegateDefault")
3205 AC_PATH_PROG(LPDelegate, "$LPDelegateDefault", no)
3206 AC_PATH_PROG(LPRDelegate, "$LPRDelegateDefault", "$LPRDelegateDefault")
3207 AC_PATH_PROG(LaunchDelegate, "$LaunchDelegateDefault", "$LaunchDelegateDefault")
3208 AC_PATH_PROG(MANDelegate, "$MANDelegateDefault", "$MANDelegateDefault")
3209 AC_PATH_PROG(MPEGDecodeDelegate, "$MPEGDecodeDelegateDefault", "$MPEGDecodeDelegateDefault")
3210 AC_PATH_PROG(MPEGEncodeDelegate, "$MPEGEncodeDelegateDefault", "$MPEGEncodeDelegateDefault")
3211 AC_PATH_PROG(MrSIDDecodeDelegate, "$MrSIDDecodeDelegateDefault", "$MrSIDDecodeDelegateDefault")
3212 AC_PATH_PROG(MVDelegate, "$MVDelegateDefault", "$MVDelegateDefault")
3213 AC_PATH_PROG(PCLDelegate, "$PCLDelegateDefault", "$PCLDelegateDefault")
3214 AC_PATH_PROG(PGPDecodeDelegate, "$PGPDecodeDelegateDefault", "$PGPDecodeDelegateDefault")
3215 AC_PATH_PROG(POVDelegate, "$POVDelegateDefault", "$POVDelegateDefault")
3216 AC_PATH_PROGS(PSDelegate, gsx gsc "$PSDelegateDefault", "$PSDelegateDefault")
3217 AC_PATH_PROG(RLEEncodeDelegate, "$RLEEncodeDelegateDefault", "$RLEEncodeDelegateDefault")
3218 AC_PATH_PROG(RMDelegate, "$RMDelegateDefault", "$RMDelegateDefault")
3219 AC_PATH_PROG(RSVGDecodeDelegate, "$RSVGDecodeDelegateDefault", "$RSVGDecodeDelegateDefault")
3220 AC_PATH_PROG(SCANDecodeDelegate, "$SCANDecodeDelegateDefault", "$SCANDecodeDelegateDefault")
3221 AC_PATH_PROG(SVGDecodeDelegate, "$SVGDecodeDelegateDefault", "$SVGDecodeDelegateDefault")
3222 AC_PATH_PROG(TXTDelegate, "$TXTDelegateDefault", "$TXTDelegateDefault")
3223 AC_PATH_PROG(UniconvertorDelegate, "$UniconvertorDelegateDefault", "$UniconvertorDelegateDefault")
3224 AC_PATH_PROG(WMFDecodeDelegate, "$WMFDecodeDelegateDefault", "$WMFDecodeDelegateDefault")
3225 AC_PATH_PROG(WWWDecodeDelegate, "$WWWDecodeDelegateDefault", "$WWWDecodeDelegateDefault")
3226 AC_PATH_PROG(XPSDelegate, "$XPSDelegateDefault", "$XPSDelegateDefault")
3227 AC_PATH_PROG(ZipDelegate, "$ZipDelegateDefault", "$ZipDelegateDefault")
3228
3229 # Prefer lpr to lp; lp needs options tacked on.
3230 if test "$LPRDelegate" != no; then
3231     PrintDelegate="$LPRDelegate"
3232 else
3233     PrintDelegate="$LPDelegate -c -s"
3234 fi
3235 AC_SUBST(PrintDelegate)
3236
3237 # Installed ImageMagick utiltity paths
3238 ConvertDelegate="${BIN_DIR}/${ConvertDelegateDefault}"
3239 DisplayDelegate="${BIN_DIR}/${DisplayDelegateDefault}"
3240 MogrifyDelegate="${BIN_DIR}/${MogrifyDelegateDefault}"
3241
3242 # Set delegate booleans
3243 have_ffmpeg='no'; if test "$MPEGDecodeDelegate" != "$MPEGDecodeDelegateDefault" ; then have_ffmpeg='yes'; fi
3244 have_fig2dev='no'    ; if test "$FIGDecodeDelegate" != "$FIGDecodeDelegateDefault" ; then have_fig2dev='yes'; fi
3245 have_gs='no'         ; if test "$PSDelegate" != "$PSDelegateDefault"; then have_gs='yes'; fi
3246 have_hp2xx='no'      ; if test "$HPGLDecodeDelegate" !=  "$HPGLDecodeDelegateDefault" ; then have_hp2xx='yes'; fi
3247 have_ilbmtoppm='no'  ; if test "$ILBMDecodeDelegate" != "$ILBMDecodeDelegateDefault" ; then have_ilbmtoppm='yes'; fi
3248 have_mrsid='no'; if test "$MrSIDDecodeDelegate" != "$MrSIDDecodeDelegateDefault" ; then have_mrsid='yes'; fi
3249 have_pcl='no'        ; if test "$PCLDelegate" != "$PCLDelegateDefault"; then have_pcl='yes'; fi
3250 have_ppmtoilbm='no'  ; if test "$ILBMEncodeDelegate" != "$ILBMEncodeDelegateDefault" ; then have_ppmtoilbm='yes'; fi
3251 have_ralcgm='no'     ; if test "$CGMDecodeDelegate" != "$CGMDecodeDelegateDefault" ; then have_ralcgm='yes'; fi
3252 have_xps='no'        ; if test "$XPSDelegate" != "$XPSDelegateDefault"; then have_xps='yes'; fi
3253
3254 #
3255 # Test for font directories
3256 #
3257 type_include_files=''
3258
3259 # Dejavu fonts.
3260 AC_MSG_CHECKING(for Dejavu fonts directory)
3261 dejavu_font_dir=''
3262 if test "${with_dejavu_font_dir}" != 'default'; then
3263   dejavu_font_dir="${with_dejavu_font_dir}/"
3264 else
3265   for font_dir in "${prefix}/share/dejavu/fonts/" '/usr/share/fonts/dejavu/'; do
3266     if test -f "${font_dir}DejaVuSerif.ttf"; then
3267       dejavu_font_dir="${font_dir}"
3268       break 1
3269     fi
3270   done
3271 fi
3272 if test "${dejavu_font_dir}x" != 'x'; then
3273   type_include_files="${type_include_files} "'<include file="type-dejavu.xml" />'
3274   AC_MSG_RESULT([$dejavu_font_dir])
3275 else
3276   AC_MSG_RESULT([not found!]);
3277 fi
3278 AC_SUBST(dejavu_font_dir)
3279
3280 # Windows
3281 windows_font_dir=''
3282 if test "$with_windows_font_dir" != "no" && test -n "$with_windows_font_dir"; then
3283    windows_font_dir="${with_windows_font_dir}/"
3284 fi
3285 if test "${windows_font_dir}x" != 'x'; then
3286     if test -f '/usr/X11R6/lib/X11/fonts/truetype/arial.ttf'; then
3287       windows_font_dir='/usr/X11R6/lib/X11/fonts/truetype/'
3288     fi
3289     if test -f '/usr/X11R7/lib/X11/fonts/truetype/arial.ttf'; then
3290       windows_font_dir='/usr/X11R7/lib/X11/fonts/truetype/'
3291     fi
3292     if test -f '/usr/share/fonts/msttcore/arial.ttf'; then
3293       windows_font_dir='/usr/share/fonts/msttcore/truetype/'
3294     fi
3295 fi
3296 if test "${windows_font_dir}x" != 'x'; then
3297   type_include_files="$type_include_files "'<include file="type-windows.xml" />'
3298 fi
3299 AC_SUBST(windows_font_dir)
3300
3301 # Ghostscript
3302 AC_MSG_CHECKING(for Ghostscript fonts directory)
3303 ghostscript_font_dir=''
3304 if test "${with_gs_font_dir}" != 'default'; then
3305   ghostscript_font_dir="${with_gs_font_dir}/"
3306 else
3307   if test "${native_win32_build}" = 'yes'; then
3308     # Native Windows Build
3309     for font_dir in "c:\\Program Files\\gs\\fonts\\" "c:\\Program Files \(x86\)\\gs\\fonts\\" "c:\\gs\\fonts\\"; do
3310       if test -f "${font_dir}a010013l.pfb"; then
3311         ghostscript_font_dir="$font_dir"
3312         break 1
3313       fi
3314     done
3315     if test "${PSDelegate}" != 'gswin32c'; then
3316       ghostscript_font_dir=`echo "${PSDelegate}" | sed -e 's:/gs/.*:/gs:;s:^/::;s/./&:/;s:/:\\\\:g'`"\\fonts\\"
3317     fi
3318   else
3319     # Linux / Mac OS X / Unix Build
3320     for font_dir in "${prefix}/share/ghostscript/fonts/" '/usr/share/fonts/default/Type1/' '/usr/share/ghostscript/fonts/' '/usr/share/fonts/ghostscript/' '/usr/share/fonts/type1/gsfonts/' '/opt/local/share/ghostscript/fonts/' '/sw/share/ghostscript/fonts/' '/System/Library/Frameworks/Ghostscript.framework/Resources/fonts/'; do
3321       if test -f "${font_dir}a010013l.pfb"; then
3322         ghostscript_font_dir="${font_dir}"
3323         break 1
3324       fi
3325     done
3326     if test "${ghostscript_font_dir}x" = 'x'; then
3327       if test "$PSDelegate" != 'gs'; then
3328         ghostscript_font_dir=`echo "$PSDelegate" | sed -e 's:/bin/gs:/share/ghostscript/fonts:'`"/"
3329       fi
3330     fi
3331   fi
3332 fi
3333 if test "${ghostscript_font_dir}x" != 'x'; then
3334   type_include_files="${type_include_files} "'<include file="type-ghostscript.xml" />'
3335   AC_MSG_RESULT([$ghostscript_font_dir])
3336 else
3337   AC_MSG_RESULT([not found!]);
3338 fi
3339 AC_SUBST(ghostscript_font_dir)
3340 case "${build_os}" in
3341   mingw* )
3342     PSDelegate=`$WinPathScript "$PSDelegate" 1`
3343     ;;
3344 esac
3345
3346 AC_SUBST(type_include_files)
3347
3348 #
3349 # Handle case where user doesn't want frozen paths
3350 #
3351 if test "$with_frozenpaths" != 'yes'; then
3352   # Re-set delegate definitions to default (no paths)
3353   AutotraceDecodeDelegate="$AutotraceDecodeDelegateDefault"
3354   BlenderDecodeDelegate="$BlenderDecodeDelegateDefault"
3355   BZIPDelegate="$BZIPDelegateDefault"
3356   BrowseDelegate="$BrowseDelegateDefault"
3357   CGMDecodeDelegate="$CGMDecodeDelegateDefault"
3358   CatDelegate="$CatDelegateDefault"
3359   ConvertDelegate="$ConvertDelegateDefault"
3360   GVCDecodeDelegate="$GVCDecodeDelegateDefault"
3361   DVIDecodeDelegate="$DVIDecodeDelegateDefault"
3362   EchoDelegate="$EchoDelegateDefault"
3363   EditorDelegate="$EditorDelegateDefault"
3364   FIGDecodeDelegate="$FIGDecodeDelegateDefault"
3365   GnuplotDecodeDelegate="$GnuplotDecodeDelegateDefault"
3366   HPGLDecodeDelegate="$HPGLDecodeDelegateDefault"
3367   HTMLDecodeDelegate="$HTMLDecodeDelegateDefault"
3368   ILBMDecodeDelegate="$ILBMDecodeDelegateDefault"
3369   ILBMEncodeDelegate="$ILBMEncodeDelegateDefault"
3370   LPDelegate="$LPDelegateDefault"
3371   LaunchDelegate="$LaunchDelegateDefault"
3372   MANDelegate="$MANDelegateDefault"
3373   MPEGDecodeDelegate="$MPEGDecodeDelegateDefault"
3374   MPEGEncodeDelegate="$MPEGEncodeDelegateDefault"
3375   MogrifyDelegate="$MogrifyDelegateDefault"
3376   MrSIDDecodeDelegate="$MrSIDDecodeDelegateDefault"
3377   MVDelegate="$MVDelegateDefault"
3378   PCLDelegate="$PCLDelegateDefault"
3379   PGPDecodeDelegate="$PGPDecodeDelegateDefault"
3380   POVDelegate="$POVDelegateDefault"
3381   PSDelegate="$PSDelegateDefault"
3382   RLEEncodeDelegate="$RLEEncodeDelegateDefault"
3383   RMDelegate="$RMDelegateDefault"
3384   RSVGDecodeDelegate="$RSVGDecodeDelegateDefault"
3385   SCANDecodeDelegate="$SCANDecodeDelegateDefault"
3386   SVGDecodeDelegate="$SVGDecodeDelegateDefault"
3387   ShowImageDelegate="$ShowImageDelegateDefault"
3388   TXTDelegate="$TXTDelegateDefault"
3389   UniconvertorDelegate="$UniconvertorDelegateDefault"
3390   WMFDecodeDelegate="$WMFDecodeDelegateDefault"
3391   WWWDecodeDelegate="$WWWDecodeDelegateDefault"
3392   XPSDelegate="$XPSDelegateDefault"
3393   ZipDelegate="$ZipDelegateDefault"
3394 fi
3395
3396 # Delegate substitutions
3397 AC_SUBST(AutotraceDecodeDelegate)
3398 AC_SUBST(BlenderDecodeDelegate)
3399 AC_SUBST(BZIPDelegate)
3400 AC_SUBST(BrowseDelegate)
3401 AC_SUBST(CGMDecodeDelegate)
3402 AC_SUBST(CatDelegate)
3403 AC_SUBST(ConvertDelegate)
3404 AC_SUBST(GVCDecodeDelegate)
3405 AC_SUBST(DVIDecodeDelegate)
3406 AC_SUBST(EchoDelegate)
3407 AC_SUBST(EditorDelegate)
3408 AC_SUBST(FIGDecodeDelegate)
3409 AC_SUBST(GnuplotDecodeDelegate)
3410 AC_SUBST(HPGLDecodeDelegate)
3411 AC_SUBST(HTMLDecodeDelegate)
3412 AC_SUBST(ILBMDecodeDelegate)
3413 AC_SUBST(ILBMEncodeDelegate)
3414 AC_SUBST(LPDelegate)
3415 AC_SUBST(LaunchDelegate)
3416 AC_SUBST(MANDelegate)
3417 AC_SUBST(MPEGDecodeDelegate)
3418 AC_SUBST(MPEGEncodeDelegate)
3419 AC_SUBST(MogrifyDelegate)
3420 AC_SUBST(MrSIDDecodeDelegate)
3421 AC_SUBST(MVDelegate)
3422 AC_SUBST(PCLDelegate)
3423 AC_SUBST(PGPDecodeDelegate)
3424 AC_SUBST(POVDelegate)
3425 AC_SUBST(PSDelegate)
3426 AC_SUBST(RLEEncodeDelegate)
3427 AC_SUBST(RMDelegate)
3428 AC_SUBST(SCANDecodeDelegate)
3429 AC_SUBST(ShowImageDelegate)
3430 AC_SUBST(TXTDelegate)
3431 AC_SUBST(UniconvertorDelegate)
3432 AC_SUBST(WMFDecodeDelegate)
3433 AC_SUBST(WWWDecodeDelegate)
3434 AC_SUBST(XPSDelegate)
3435 AC_SUBST(ZipDelegate)
3436
3437 #
3438 # RPM support.
3439 #
3440 RPM=''
3441 AC_CHECK_PROGS(TAR,gnutar gtar tar)
3442 AC_CHECK_PROGS(PERL,perl)
3443 AC_CHECK_PROGS(RPM,rpmbuild rpm)
3444 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
3445 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
3446 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
3447 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
3448 AC_SUBST(RPM)
3449 AM_CONDITIONAL(RPM_DELEGATE, test "x$RPM" != "x" )
3450
3451 #
3452 # 7ZIP support (http://p7zip.sourceforge.net/)
3453 #
3454 P7ZIP=''
3455 AC_CHECK_PROGS(P7ZIP,[7za])
3456 AC_SUBST(P7ZIP)
3457 AM_CONDITIONAL(P7ZIP_DELEGATE, test "x$P7ZIP" != "x" )
3458
3459 #
3460 # ZIP support (http://www.info-zip.org/Zip.html)
3461 #
3462 ZIP=''
3463 AC_CHECK_PROGS(ZIP,[zip])
3464 AC_SUBST(ZIP)
3465 AM_CONDITIONAL(ZIP_DELEGATE, test "x$ZIP" != "x" )
3466
3467 #
3468 # GhostPCL related configuration.
3469 #
3470 PCLColorDevice=ppmraw
3471 PCLCMYKDevice=pamcmyk32
3472 PCLMonoDevice=pbmraw
3473 if test -z "$PCLVersion"; then
3474     PCLVersion='unknown'
3475 fi
3476 if test $have_pcl = 'yes'; then
3477     AC_MSG_RESULT([-------------------------------------------------------------])
3478     AC_MSG_CHECKING([for PCL])
3479     AC_MSG_RESULT([])
3480     # PCLColorDevice
3481     AC_MSG_CHECKING([for pcl color device])
3482     if $PCLDelegate -dBATCH -sDEVICE=$PCLColorDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3483         :
3484     else
3485         PCLColorDevice=ppmraw
3486     fi
3487     AC_MSG_RESULT([$PCLColorDevice])
3488
3489     # PCLCMYKDevice
3490     AC_MSG_CHECKING([for pcl CMYK device])
3491     if $PCLDelegate -dBATCH -sDEVICE=$PCLColorDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3492         :
3493     else
3494         PCLCMYKDevice=$PCLColorDevice
3495     fi
3496     AC_MSG_RESULT([$PCLCMYKDevice])
3497
3498     # PCLMonoDevice
3499     AC_MSG_CHECKING([for pcl mono device])
3500     if $PCLDelegate -dBATCH -sDEVICE=$PCLMonoDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3501         :
3502     else
3503         PCLMonoDevice=$PCLColorDevice
3504     fi
3505     AC_MSG_RESULT([$PCLMonoDevice])
3506 fi
3507
3508 AC_SUBST(PCLMonoDevice)
3509 AC_SUBST(PCLColorDevice)
3510 AC_SUBST(PCLCMYKDevice)
3511 AC_SUBST(PCLVersion)
3512
3513 #
3514 # GhostXPS related configuration.
3515 #
3516 XPSColorDevice=ppmraw
3517 XPSCMYKDevice=bmpsep8
3518 XPSMonoDevice=pbmraw
3519 if test -z "$XPSVersion"; then
3520     XPSVersion='unknown'
3521 fi
3522 if test $have_xps = 'yes'; then
3523     AC_MSG_RESULT([-------------------------------------------------------------])
3524     AC_MSG_CHECKING([for XPS])
3525     AC_MSG_RESULT([])
3526     # XPSColorDevice
3527     AC_MSG_CHECKING([for xps color device])
3528     if $XPSDelegate -dBATCH -sDEVICE=$XPSColorDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3529         :
3530     else
3531         XPSColorDevice=ppmraw
3532     fi
3533     AC_MSG_RESULT([$XPSColorDevice])
3534
3535     # XPSCMYKDevice
3536     AC_MSG_CHECKING([for xps CMYK device])
3537     if $XPSDelegate -dBATCH -sDEVICE=$XPSColorDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3538         :
3539     else
3540         XPSCMYKDevice=$XPSColorDevice
3541     fi
3542     AC_MSG_RESULT([$XPSCMYKDevice])
3543
3544     # XPSMonoDevice
3545     AC_MSG_CHECKING([for xps mono device])
3546     if $XPSDelegate -dBATCH -sDEVICE=$XPSMonoDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3547         :
3548     else
3549         XPSMonoDevice=$XPSColorDevice
3550     fi
3551     AC_MSG_RESULT([$XPSMonoDevice])
3552 fi
3553
3554 AC_SUBST(XPSMonoDevice)
3555 AC_SUBST(XPSColorDevice)
3556 AC_SUBST(XPSCMYKDevice)
3557 AC_SUBST(XPSVersion)
3558
3559 #
3560 # Ghostscript related configuration.
3561 #
3562 GSAlphaDevice=pngalpha
3563 GSColorDevice=pnmraw
3564 GSCMYKDevice=pam
3565 GSMonoDevice=pbmraw
3566 GSPDFDevice=pdfwrite
3567 GSPSDevice=pswrite
3568 GSEPSDevice=epswrite
3569 GSVersion='unknown'
3570 if test $have_gs = 'yes'; then
3571     AC_MSG_RESULT([-------------------------------------------------------------])
3572     AC_MSG_CHECKING([for Ghostscript])
3573     AC_MSG_RESULT([])
3574     AC_MSG_CHECKING([for Ghostscript version])
3575     if GSVersion=`$PSDelegate --version`; then
3576         :
3577     else
3578         GSVersion=`$PSDelegate --help | sed -e '1q' | awk '{ print $3 }'`
3579     fi
3580     AC_MSG_RESULT([$GSVersion])
3581
3582     # GSAlphaDevice
3583     AC_MSG_CHECKING([for gs alpha device])
3584     if $PSDelegate -q -dBATCH -sDEVICE=$GSAlphaDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3585         :
3586     else
3587         GSAlphaDevice=pnmraw
3588     fi
3589     AC_MSG_RESULT([$GSAlphaDevice])
3590
3591     # GSColorDevice
3592     AC_MSG_CHECKING([for gs color device])
3593     if $PSDelegate -q -dBATCH -sDEVICE=$GSColorDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3594         :
3595     else
3596         GSColorDevice=pnmraw
3597     fi
3598     AC_MSG_RESULT([$GSColorDevice])
3599
3600     # GSCMYKDevice
3601     AC_MSG_CHECKING([for gs CMYK device])
3602     if $PSDelegate -q -dBATCH -sDEVICE=$GSCMYKDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3603         :
3604     else
3605         GSCMYKDevice=bmpsep8
3606     fi
3607     AC_MSG_RESULT([$GSCMYKDevice])
3608
3609     # GSMonoDevice
3610     AC_MSG_CHECKING([for gs mono device])
3611     if $PSDelegate -q -dBATCH -sDEVICE=$GSMonoDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3612         :
3613     else
3614         GSMonoDevice=$GSColorDevice
3615     fi
3616     AC_MSG_RESULT([$GSMonoDevice])
3617
3618     # GSPDFDevice
3619     AC_MSG_CHECKING([for gs PDF writing device])
3620     if $PSDelegate -q -dBATCH -sDEVICE=$GSPDFDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3621         :
3622     else
3623         GSPDFDevice=nodevice
3624     fi
3625         AC_MSG_RESULT([$GSPDFDevice])
3626
3627     # GSPSDevice
3628     AC_MSG_CHECKING([for gs PS writing device])
3629     if $PSDelegate -q -dBATCH -sDEVICE=$GSPSDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3630         :
3631     else
3632         GSPSDevice=nodevice
3633     fi
3634     AC_MSG_RESULT([$GSPSDevice])
3635
3636     # GSEPSDevice
3637     AC_MSG_CHECKING([for gs EPS writing device])
3638     if $PSDelegate -q -dBATCH -sDEVICE=$GSEPSDevice -sOutputFile=/dev/null < /dev/null 2> /dev/null; then
3639         :
3640     else
3641         GSEPSDevice=nodevice
3642     fi
3643     AC_MSG_RESULT([$GSEPSDevice])
3644 fi
3645
3646 AC_SUBST(GSAlphaDevice)
3647 AC_SUBST(GSCMYKDevice)
3648 AC_SUBST(GSColorDevice)
3649 AC_SUBST(GSEPSDevice)
3650 AC_SUBST(GSMonoDevice)
3651 AC_SUBST(GSPDFDevice)
3652 AC_SUBST(GSPSDevice)
3653 AC_SUBST(GSVersion)
3654
3655 #
3656 # PerlMagick-related configuration
3657 #
3658
3659 # Look for PERL if PerlMagick requested
3660 # If name/path of desired PERL interpreter is specified, look for that one first
3661 have_perl='no'
3662 if test "$with_perl" != 'no'; then
3663     AC_MSG_RESULT([-------------------------------------------------------------])
3664     AC_MSG_CHECKING([for Perl])
3665     AC_MSG_RESULT([])
3666     if test "$with_perl" != 'yes'; then
3667         AC_CACHE_CHECK(for perl,ac_cv_path_PERL,ac_cv_path_PERL="$with_perl");
3668         PERL=$ac_cv_path_PERL
3669         AC_SUBST(PERL)dnl
3670         have_perl="$ac_cv_path_PERL"
3671     else
3672         AC_PATH_PROGS(PERL,perl perl5,)dnl
3673         if test "$ac_cv_path_PERL"; then
3674             have_perl="$ac_cv_path_PERL"
3675         fi
3676     fi
3677 fi
3678
3679 if test "$with_perl" != 'yes' ; then
3680     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-perl=$with_perl "
3681 fi
3682
3683 PERL_SUPPORTS_DESTDIR='no'
3684
3685 with_perl_static='no'
3686 with_perl_dynamic='no'
3687 if test "$have_perl" != 'no'; then
3688     if test "$with_perl" != 'no' && test "$libtool_build_shared_libs" = 'no'; then
3689         with_perl_static='yes'
3690     fi
3691     if test "$with_perl" != 'no' && test "$libtool_build_shared_libs" = 'yes'; then
3692         with_perl_dynamic='yes'
3693     fi
3694     # Is PERL's MakeMaker new enough to support DESTDIR?
3695     AX_PROG_PERL_VERSION(5.8.1,[PERL_SUPPORTS_DESTDIR='yes'],[PERL_SUPPORTS_DESTDIR='no'])
3696 fi
3697 AM_CONDITIONAL(WITH_PERL, test "$have_perl" != 'no')
3698 AM_CONDITIONAL(WITH_PERL_STATIC, test $with_perl_static = 'yes')
3699 AM_CONDITIONAL(WITH_PERL_DYNAMIC, test $with_perl_dynamic = 'yes')
3700 AC_SUBST(PERL_SUPPORTS_DESTDIR)
3701
3702 # Determine path to pick up MagickCore library from for use with building PerlMagick
3703 MAGICKCORE_PATH="${LIB_DIR}"
3704 if test $with_perl_static = 'yes'; then
3705     # Find out where libtool hides its uninstalled libraries (as libtool_objdir)
3706     libtool_objdir=$objdir
3707
3708     # Linker search path to library, followed by -lMagickCore
3709     MAGICKCORE_PATH="${builddir}/MagickCore/${libtool_objdir}"
3710 fi
3711 AC_SUBST(MAGICKCORE_PATH)
3712
3713 # Create a simple string containing format names for all delegate libraries.
3714 MAGICK_DELEGATES=''
3715 if test "$have_autotrace"  = 'yes' ; then
3716    MAGICK_DELEGATES="$MAGICK_DELEGATES autotrace"
3717 fi
3718 if test "$have_bzlib"  = 'yes' ; then
3719    MAGICK_DELEGATES="$MAGICK_DELEGATES bzlib"
3720 fi
3721 if test "$have_dps"    = 'yes' ; then
3722    MAGICK_DELEGATES="$MAGICK_DELEGATES dps"
3723 fi
3724 if test "$have_djvu"    = 'yes' ; then
3725    MAGICK_DELEGATES="$MAGICK_DELEGATES djvu"
3726 fi
3727 if test "$have_ffmpeg"   = 'yes' ; then
3728    MAGICK_DELEGATES="$MAGICK_DELEGATES mpeg"
3729 fi
3730 if test "$have_fftw"    = 'yes' ; then
3731    MAGICK_DELEGATES="$MAGICK_DELEGATES fftw"
3732 fi
3733 if test "$have_fig2dev" = 'yes' && test "$have_ps" = 'yes'  ; then
3734    MAGICK_DELEGATES="$MAGICK_DELEGATES xfig"
3735 fi
3736 if test "$have_fpx"    = 'yes' ; then
3737    MAGICK_DELEGATES="$MAGICK_DELEGATES fpx"
3738 fi
3739 if test "$have_fontconfig"    = 'yes' ; then
3740    MAGICK_DELEGATES="$MAGICK_DELEGATES fontconfig"
3741 fi
3742 if test "$have_freetype"    = 'yes' ; then
3743    MAGICK_DELEGATES="$MAGICK_DELEGATES freetype"
3744 fi
3745 if test "$have_gslib"    = 'yes' ; then
3746    MAGICK_DELEGATES="$MAGICK_DELEGATES gslib"
3747 fi
3748 if test "$have_jbig"    = 'yes' ; then
3749    MAGICK_DELEGATES="$MAGICK_DELEGATES jbig"
3750 fi
3751 if test "$have_png$have_jpeg" = 'yesyes' ; then
3752    MAGICK_DELEGATES="$MAGICK_DELEGATES jng"
3753 fi
3754 if test "$have_jp2"   = 'yes' ; then
3755    MAGICK_DELEGATES="$MAGICK_DELEGATES jp2"
3756 fi
3757 if test "$have_jpeg"   = 'yes' ; then
3758    MAGICK_DELEGATES="$MAGICK_DELEGATES jpeg"
3759 fi
3760 if test "$have_lcms" = 'yes' || test "$have_lcms2" = 'yes' ; then
3761    MAGICK_DELEGATES="$MAGICK_DELEGATES lcms"
3762 fi
3763 if test "$have_lqr"    = 'yes' ; then
3764    MAGICK_DELEGATES="$MAGICK_DELEGATES lqr"
3765 fi
3766 if test "$have_lzma"    = 'yes' ; then
3767    MAGICK_DELEGATES="$MAGICK_DELEGATES lzma"
3768 fi
3769 if test "$have_openexr"    = 'yes' ; then
3770    MAGICK_DELEGATES="$MAGICK_DELEGATES openexr"
3771 fi
3772 if test "$have_pango"    = 'yes' ; then
3773    MAGICK_DELEGATES="$MAGICK_DELEGATES pango"
3774 fi
3775 if test "$have_png"    = 'yes' ; then
3776    MAGICK_DELEGATES="$MAGICK_DELEGATES png"
3777 fi
3778 have_ps='no'
3779 if test "$have_dps"    = 'yes' || \
3780    test "$have_gs" = 'yes' || \
3781    test "${native_win32_build}" = 'yes' ; then
3782    have_ps='yes'
3783 fi
3784 if test "$have_ps"     = 'yes' ; then
3785    MAGICK_DELEGATES="$MAGICK_DELEGATES ps"
3786 fi
3787 if test "$have_ralcgm" = 'yes' ; then
3788    MAGICK_DELEGATES="$MAGICK_DELEGATES cgm"
3789 fi
3790 if test "$have_ra_ppm" = 'yes' ; then
3791    MAGICK_DELEGATES="$MAGICK_DELEGATES rad"
3792 fi
3793 if test "$have_rsvg"   = 'yes' ; then
3794    MAGICK_DELEGATES="$MAGICK_DELEGATES rsvg"
3795 fi
3796 if test "$have_tiff"   = 'yes' ; then
3797    MAGICK_DELEGATES="$MAGICK_DELEGATES tiff"
3798 fi
3799 if test "$have_ttf"    = 'yes' ; then
3800    MAGICK_DELEGATES="$MAGICK_DELEGATES ttf"
3801 fi
3802 if test "$have_wmf"    = 'yes' ; then
3803    MAGICK_DELEGATES="$MAGICK_DELEGATES wmf"
3804 fi
3805 if test "$have_x"      = 'yes' ; then
3806    MAGICK_DELEGATES="$MAGICK_DELEGATES x"
3807 fi
3808 if test "$have_xml"      = 'yes' ; then
3809    MAGICK_DELEGATES="$MAGICK_DELEGATES xml"
3810 fi
3811 if test "$have_zlib"   = 'yes' ; then
3812    MAGICK_DELEGATES="$MAGICK_DELEGATES zlib"
3813 fi
3814 # Remove extraneous spaces from output variables (asthetic)
3815 MAGICK_DELEGATES=`echo $MAGICK_DELEGATES | sed -e 's/  */ /g'`
3816 MAGICK_FEATURES=`echo $MAGICK_FEATURES | sed -e 's/  */ /g'`
3817 AC_SUBST(MAGICK_DELEGATES)
3818 AC_SUBST(MAGICK_FEATURES)
3819
3820 #
3821 # Handle special compiler flags
3822 #
3823
3824 # Add '-p' if prof source profiling support enabled
3825 if test "$enable_prof" = 'yes'; then
3826     CFLAGS="-p $CFLAGS"
3827     CXXFLAGS="-p $CXXFLAGS"
3828     LDFLAGS="-p $LDFLAGS"
3829 fi
3830
3831 # Add '-pg' if gprof source profiling support enabled
3832 if test "$enable_gprof" = 'yes'; then
3833     CFLAGS="-pg $CFLAGS"
3834     CXXFLAGS="-pg $CXXFLAGS"
3835     LDFLAGS="-pg $LDFLAGS"
3836 fi
3837
3838 # Add '-ftest-coverage -fprofile-arcs' if gcov source profiling support enabled
3839 # This is a gcc-specific feature
3840 if test "$enable_gcov" = 'yes'; then
3841     AC_CHECK_LIB(gcov,_gcov_init)
3842     AC_CHECK_LIB(gcov,__gcov_init)
3843     case "$target_os" in
3844         darwin*)
3845             OSX_GCOV_LDFLAG="-Wl,-single_module"
3846         ;;
3847         *)
3848             OSX_GCOV_LDFLAG=""
3849         ;;
3850     esac
3851     AC_SUBST(OSX_GCOV_LDFLAG)
3852     CFLAGS="-ftest-coverage -fprofile-arcs  $CFLAGS"
3853     CXXFLAGS="-ftest-coverage -fprofile-arcs  $CXXFLAGS"
3854     LDFLAGS="-ftest-coverage -fprofile-arcs $LDFLAGS"
3855 fi
3856
3857 #
3858 # Build library dependency list for libMagickCore
3859 #
3860
3861 if test "$build_modules" != 'no'; then
3862     MAGICK_DEP_LIBS="$LCMS_LIBS $FREETYPE_LIBS $LQR_LIBS $FFTW_LIBS $FONTCONFIG_LIBS $XEXT_LIBS $IPC_LIBS $X11_LIBS $XT_LIBS $LZMA_LIBS $BZLIB_LIBS $ZLIB_LIBS $LTDL_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $THREAD_LIBS"
3863 else
3864     MAGICK_DEP_LIBS="$JBIG_LIBS $LCMS_LIBS $TIFF_LIBS $FREETYPE_LIBS $JP2_LIBS $JPEG_LIBS $GS_LIBS $LQR_LIBS $PNG_LIBS $AUTOTRACE_LIBS $DJVU_LIBS $FFTW_LIBS $FPX_LIBS $FONTCONFIG_LIBS $WEBP_LIBS $WMF_LIBS $DPS_LIBS $XEXT_LIBS $XT_LIBS $IPC_LIBS $X11_LIBS $LZMA_LIBS $BZLIB_LIBS $OPENEXR_LIBS $PANGO_LIBS $RSVG_LIBS $XML_LIBS $GVC_LIBS $ZLIB_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $THREAD_LIBS"
3865 fi
3866 AC_SUBST(MAGICK_DEP_LIBS)
3867
3868 #
3869 # Remove extraneous spaces from output variables (asthetic)
3870 #
3871 X_CFLAGS=`echo $X_CFLAGS | sed -e 's/  */ /g'`
3872 X_PRE_LIBS=`echo $X_PRE_LIBS | sed -e 's/  */ /g'`
3873 X_LIBS=`echo $X_LIBS | sed -e 's/  */ /g'`
3874 X_EXTRA_LIBS=`echo $X_EXTRA_LIBS | sed -e 's/  */ /g'`
3875
3876 CC=`echo $CC | sed -e 's/  */ /g'`
3877 CFLAGS=`echo $CFLAGS | sed -e 's/  */ /g'`
3878 CPPFLAGS=`echo $CPPFLAGS | sed -e 's/  */ /g'`
3879 CXXFLAGS=`echo $CXXFLAGS | sed -e 's/  */ /g'`
3880 DISTCHECK_CONFIG_FLAGS=`echo $DISTCHECK_CONFIG_FLAGS | sed -e 's/  */ /g'`
3881 LDFLAGS=`echo $LDFLAGS | sed -e 's/  */ /g'`
3882 TESTED_LIBS=`echo $LIBS | sed -e 's/  */ /g'`
3883 MAGICK_DEP_LIBS=`echo $MAGICK_DEP_LIBS | sed -e 's/  */ /g'`
3884 #LIBS=`echo $LIBS | sed -e 's/  */ /g'`
3885
3886 # Pass only user-provided LIBS as "global" libraries
3887 LIBS=$USER_LIBS
3888
3889 #AC_SUBST(CPPFLAGS)
3890 AC_SUBST(X_CFLAGS)
3891 #AC_SUBST(LDFLAGS)
3892 #AC_SUBST(X_PRE_LIBS)
3893 #AC_SUBST(X_LIBS)
3894 #AC_SUBST(X_EXTRA_LIBS)
3895
3896 MAGICK_CFLAGS=$CFLAGS
3897 MAGICK_CXXFLAGS="$CXXFLAGS"
3898 MAGICK_CPPFLAGS=`echo $MAGICK_CPPFLAGS | sed -e 's/  */ /g'`
3899 MAGICK_PCFLAGS=`echo $MAGICK_PCFLAGS | sed -e 's/  */ /g'`
3900 MAGICK_LDFLAGS="-L$LIB_DIR $LDFLAGS"
3901 MAGICK_LIBS="-lMagickCore $MAGICK_DEP_LIBS"
3902
3903 AC_SUBST(MAGICK_CFLAGS)
3904 AC_SUBST(MAGICK_CXXFLAGS)
3905 AC_SUBST(MAGICK_CPPFLAGS)
3906 AC_SUBST(MAGICK_PCFLAGS)
3907 AC_SUBST(MAGICK_LDFLAGS)
3908 AC_SUBST(MAGICK_LIBS)
3909
3910 # Set configured scripts to executable.
3911 AC_CONFIG_COMMANDS([default],[],[])
3912 AC_CONFIG_COMMANDS([magick.sh.in],[chmod +x magick.sh])
3913 AC_CONFIG_COMMANDS([MagickCore-config.in],[chmod +x MagickCore/MagickCore-config])
3914 AC_CONFIG_COMMANDS([MagickWand-config.in],[chmod +x MagickWand/MagickWand-config])
3915 AC_CONFIG_COMMANDS([Magick++-config.in],[chmod +x Magick++/bin/Magick++-config])
3916 AC_CONFIG_COMMANDS([PerlMagick/check.sh.in],[chmod +x PerlMagick/check.sh])
3917
3918 AC_MSG_RESULT([-------------------------------------------------------------])
3919 AC_MSG_RESULT([Update ImageMagick configuration])
3920 AC_OUTPUT
3921
3922 rm -f magick-version
3923
3924 result_dejavu_font_dir='none'
3925 if test "${dejavu_font_dir}x" != 'x'; then
3926     result_dejavu_font_dir=$dejavu_font_dir
3927 fi
3928
3929 result_ghostscript_font_dir='none'
3930 if test "${ghostscript_font_dir}x" != 'x'; then
3931     result_ghostscript_font_dir=$ghostscript_font_dir
3932 fi
3933
3934 result_windows_font_dir='none'
3935 if test "${windows_font_dir}x" != 'x'; then
3936     result_windows_font_dir=${windows_font_dir}
3937 fi
3938
3939 AC_MSG_RESULT([
3940 ImageMagick is configured as follows. Please verify that this configuration
3941 matches your expectations.
3942
3943 Host system type: $host
3944 Build system type: $build
3945
3946                   Option                        Value
3947 -------------------------------------------------------------------------------
3948 Shared libraries  --enable-shared=$enable_shared                $libtool_build_shared_libs
3949 Static libraries  --enable-static=$enable_static                $libtool_build_static_libs
3950 Module support    --with-modules=$build_modules         $build_modules
3951 GNU ld            --with-gnu-ld=$with_gnu_ld            $lt_cv_prog_gnu_ld
3952 Quantum depth     --with-quantum-depth=$with_quantum_depth      $with_quantum_depth
3953 High Dynamic Range Imagery
3954                   --enable-hdri=$enable_hdri            $enable_hdri
3955
3956 Delegate Configuration:
3957 BZLIB             --with-bzlib=$with_bzlib              $have_bzlib
3958 Autotrace         --with-autotrace=$with_autotrace              $have_autotrace
3959 Dejavu fonts      --with-dejavu-font-dir=$with_dejavu_font_dir  $result_dejavu_font_dir
3960 DJVU              --with-djvu=$with_djvu                $have_djvu
3961 DPS               --with-dps=$with_dps          $have_dps
3962 FFTW              --with-fftw=$with_fftw                $have_fftw
3963 FlashPIX          --with-fpx=$with_fpx          $have_fpx
3964 FontConfig        --with-fontconfig=$with_fontconfig            $have_fontconfig
3965 FreeType          --with-freetype=$with_freetype                $have_freetype
3966 GhostPCL          None                          $PCLDelegate ($PCLVersion)
3967 GhostXPS          None                          $XPSDelegate ($XPSVersion)
3968 Ghostscript       None                          $PSDelegate ($GSVersion)
3969 Ghostscript fonts --with-gs-font-dir=$with_gs_font_dir  $result_ghostscript_font_dir
3970 Ghostscript lib   --with-gslib=$with_gslib              $have_gslib
3971 Graphviz          --with-gvc=$with_gvc          $have_gvc
3972 JBIG              --with-jbig=$with_jbig                $have_jbig
3973 JPEG v1           --with-jpeg=$with_jpeg                $have_jpeg
3974 JPEG-2000         --with-jp2=$with_jp2          $have_jp2
3975 LCMS v1           --with-lcms=$with_lcms                $have_lcms
3976 LCMS v2           --with-lcms2=$with_lcms2              $have_lcms2
3977 LQR               --with-lqr=$with_lqr          $have_lqr
3978 LTDL              --with-ltdl=$with_ltdl                $have_ltdl
3979 LZMA              --with-lzma=$with_lzma                $have_lzma
3980 Magick++          --with-magick-plus-plus=$with_magick_plus_plus        $have_magick_plus_plus
3981 OpenEXR           --with-openexr=$with_openexr          $have_openexr
3982 PANGO             --with-pango=$with_pango              $have_pango
3983 PERL              --with-perl=$with_perl                $have_perl
3984 PNG               --with-png=$with_png          $have_png
3985 RSVG              --with-rsvg=$with_rsvg                $have_rsvg
3986 TIFF              --with-tiff=$with_tiff                $have_tiff
3987 WEBP              --with-webp=$with_webp                $have_webp
3988 Windows fonts     --with-windows-font-dir=$with_windows_font_dir        $result_windows_font_dir
3989 WMF               --with-wmf=$with_wmf          $have_wmf
3990 X11               --with-x=$with_x                      $have_x
3991 XML               --with-xml=$with_xml          $have_xml
3992 ZLIB              --with-zlib=$with_zlib                $have_zlib
3993
3994 X11 Configuration:
3995       X_CFLAGS        = $X_CFLAGS
3996       X_PRE_LIBS      = $X_PRE_LIBS
3997       X_LIBS          = $X_LIBS
3998       X_EXTRA_LIBS    = $X_EXTRA_LIBS
3999
4000 Options used to compile and link:
4001   PREFIX          = $PREFIX_DIR
4002   EXEC-PREFIX     = $EXEC_PREFIX_DIR
4003   VERSION         = $PACKAGE_VERSION
4004   CC              = $CC
4005   CFLAGS          = $CFLAGS
4006   CPPFLAGS        = $MAGICK_CPPFLAGS
4007   PCFLAGS         = $MAGICK_PCFLAGS
4008   DEFS            = $DEFS
4009   LDFLAGS         = $LDFLAGS
4010   MAGICK_LDFLAGS  = $MAGICK_LDFLAGS
4011   LIBS            = $MAGICK_LIBS
4012   CXX             = $CXX
4013   CXXFLAGS        = $CXXFLAGS
4014   FEATURES        = $MAGICK_FEATURES
4015   DELEGATES       = $MAGICK_DELEGATES
4016 ])