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