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