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