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