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