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