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