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