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