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