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