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