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