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