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