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