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