root / ImageMagick / branches / ImageMagick-6.3.5 / configure.ac

Revision 8055, 95.4 kB (checked in by cristy, 12 months ago)
  • Property svn:executable set to *
Line 
1#  Copyright 1999-2007 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
15AC_PREREQ(2.60)
16AC_INIT([ImageMagick],[6.3.5],[http://www.imagemagick.org],[ImageMagick])
17AC_CONFIG_SRCDIR([magick/MagickCore.h])
18AC_CONFIG_AUX_DIR([config])
19AC_CONFIG_MACRO_DIR([m4])
20AC_CONFIG_LIBOBJ_DIR([ltdl])
21AC_CONFIG_HEADERS([magick/magick-config.h wand/wand-config.h])
22AC_CONFIG_FILES( \
23    config/delegates.xml \
24    config/configure.xml \
25    config/ImageMagick.rdf \
26    config/type-ghostscript.xml \
27    config/type.xml \
28    config/type-solaris.xml \
29    config/type-windows.xml \
30    ImageMagick.spec \
31    magick/ImageMagick.pc \
32    magick/Magick-config \
33    magick/version.h \
34    magick.sh \
35    Magick++/bin/Magick++-config \
36    Magick++/lib/ImageMagick++.pc \
37    Makefile \
38    PerlMagick/Magick.pm \
39    PerlMagick/Makefile.PL \
40    utilities/animate.1 \
41    utilities/compare.1 \
42    utilities/composite.1 \
43    utilities/conjure.1 \
44    utilities/convert.1 \
45    utilities/display.1 \
46    utilities/identify.1 \
47    utilities/ImageMagick.1 \
48    utilities/import.1 \
49    utilities/mogrify.1 \
50    utilities/montage.1 \
51    utilities/stream.1 \
52    wand/Wand-config \
53    wand/Wand.pc )
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=`echo "$0 $@" | sed -e 's/  */ /g'`
69AC_SUBST(CONFIGURE_ARGS)
70
71# Source file containing package/library versioning information.
72. ${srcdir}/version.sh
73
74echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}${PACKAGE_VERSION_ADDENDUM}"
75AC_CANONICAL_TARGET([])
76
77# Substitute library versioning
78AC_SUBST(LIBRARY_CURRENT)dnl
79AC_SUBST(LIBRARY_REVISION)dnl
80AC_SUBST(LIBRARY_AGE)dnl
81AC_SUBST(PACKAGE_NAME)dnl
82AC_SUBST(PACKAGE_VERSION)dnl
83AC_SUBST(PACKAGE_LIB_VERSION)dnl
84AC_SUBST(PACKAGE_LIB_VERSION_NUMBER)dnl
85AC_SUBST(PACKAGE_RELEASE_DATE)dnl
86AC_SUBST(PACKAGE_VERSION_ADDENDUM)dnl
87
88# Ensure that make can run correctly
89AM_SANITY_CHECK
90
91AM_INIT_AUTOMAKE([foreign subdir-objects dist-zip dist-bzip2 tar-ustar -Wall])
92AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/ChangeLog $(top_srcdir)/version.sh'])
93
94PERLMAINCC=$CC
95
96MAGICK_CFLAGS=''
97MAGICK_CPPFLAGS=$CPPFLAGS_USER
98MAGICK_PCFLAGS=$CPPFLAGS_USER
99MAGICK_LDFLAGS=''
100MAGICK_LIBS=''
101
102#
103# Evaluate shell variable equivalents to Makefile directory variables
104#
105if test "x$prefix" = xNONE; then
106    prefix=$ac_default_prefix
107fi
108# Let make expand exec_prefix.
109if test "x$exec_prefix" = xNONE; then
110    exec_prefix='${prefix}'
111fi
112
113#
114eval "eval PREFIX_DIR=${prefix}"
115AC_SUBST(PREFIX_DIR)
116eval "eval EXEC_PREFIX_DIR=${exec_prefix}"
117AC_SUBST(EXEC_PREFIX_DIR)
118eval "eval BIN_DIR=$bindir"
119AC_SUBST(BIN_DIR)
120eval "eval SBIN_DIR=$sbindir"
121AC_SUBST(SBIN_DIR)
122eval "eval LIBEXEC_DIR=$libexecdir"
123AC_SUBST(LIBEXEC_DIR)
124eval "eval DATA_DIR=$datadir"
125AC_SUBST(DATA_DIR)
126eval "eval SYSCONF_DIR=$sysconfdir"
127AC_SUBST(SYSCONF_DIR)
128eval "eval SHAREDSTATE_DIR=$sharedstatedir"
129AC_SUBST(SHAREDSTATE_DIR)
130eval "eval LOCALSTATE_DIR=$localstatedir"
131AC_SUBST(LOCALSTATE_DIR)
132eval "eval LIB_DIR=$libdir"
133AC_SUBST(LIB_DIR)
134eval "eval INCLUDE_DIR=$includedir"
135AC_SUBST(INCLUDE_DIR)
136eval "eval PERSISTINCLUDE_DIR=$oldincludedir"
137AC_SUBST(PERSISTINCLUDE_DIR)
138eval "eval INFO_DIR=$infodir"
139AC_SUBST(INFO_DIR)
140eval "eval MAN_DIR=$mandir"
141AC_SUBST(MAN_DIR)
142
143# Get full paths to source and build directories
144srcdirfull=`cd $srcdir && pwd`
145builddir=`pwd`
146
147WinPathScript="${srcdirfull}/winpath.sh"
148AC_SUBST(WinPathScript)
149
150#
151# Compute variables useful for running uninstalled software.
152#
153MAGICK_CODER_MODULE_PATH="${builddir}/coders"
154MAGICK_CONFIGURE_SRC_PATH="${srcdirfull}/config"
155MAGICK_CONFIGURE_BUILD_PATH="${builddir}/config"
156MAGICK_FILTER_MODULE_PATH="${builddir}/filters"
157DIRSEP=':'
158case "${host_os}" in
159    mingw* )
160        MAGICK_CODER_MODULE_PATH=`$WinPathScript "${MAGICK_CODER_MODULE_PATH}" 0`
161        MAGICK_CONFIGURE_SRC_PATH=`$WinPathScript "${MAGICK_CONFIGURE_SRC_PATH}" 0`
162        MAGICK_CONFIGURE_BUILD_PATH=`$WinPathScript "${MAGICK_CONFIGURE_BUILD_PATH}" 0`
163        MAGICK_FILTER_MODULE_PATH=`$WinPathScript "${MAGICK_FILTER_MODULE_PATH}" 0`
164        DIRSEP=';'
165    ;;
166esac
167AC_SUBST(MAGICK_CODER_MODULE_PATH)
168AC_SUBST(MAGICK_CONFIGURE_SRC_PATH)
169AC_SUBST(MAGICK_CONFIGURE_BUILD_PATH)
170AC_SUBST(MAGICK_FILTER_MODULE_PATH)
171AC_SUBST(DIRSEP)
172
173# Check for programs
174AC_PROG_CC
175AC_PROG_CPP
176AC_PROG_LD
177AC_SUBST(LD)
178AM_PROG_CC_C_O
179AC_PROG_INSTALL
180AC_PROG_MAKE_SET
181AC_PROG_RANLIB
182AC_COMPILE_WARNINGS
183AC_PROG_LN_S
184AM_WITH_DMALLOC
185
186#
187# Enable OS features.
188#
189AC_GNU_SOURCE
190
191#
192# Tests for Windows
193#
194AC_EXEEXT
195AC_OBJEXT
196
197GDI32_LIBS=''
198StaticCplusPlusLibraries='no'
199native_win32_build='no'
200cygwin_build='no'
201case "${host_os}" in
202    cygwin* )
203        StaticCplusPlusLibraries='yes'
204        cygwin_build='yes'
205        GDI32_LIBS='-lgdi32'
206    ;;
207    mingw* )
208        StaticCplusPlusLibraries='yes'
209        native_win32_build='yes'
210        GDI32_LIBS='-lgdi32'
211    ;;
212esac
213if test "${GDI32_LIBS}x" != 'x'; then
214    AC_DEFINE(HasWINGDI32,1,Define to use the Windows GDI32 library)
215fi
216AC_SUBST(GDI32_LIBS)
217AM_CONDITIONAL(HasWINGDI32, test "${GDI32_LIBS}x" != 'x' )
218AM_CONDITIONAL(WIN32_NATIVE_BUILD, test "${native_win32_build}" = 'yes' )
219AM_CONDITIONAL(CYGWIN_BUILD, test "${cygwin_build}" = 'yes' )
220
221#
222# Compiler flags tweaks
223#
224if test "${GCC}" != "yes"; then
225    case "${host}" in
226        *-*-hpux* )
227            # aCC: HP ANSI C++ B3910B A.03.34
228            CFLAGS="${CFLAGS} -Wp,-H30000"
229            if test -n "${CXXFLAGS}"; then
230                CXXFLAGS='-AA'
231            else
232                CXXFLAGS="${CXXFLAGS} -AA"
233            fi
234        ;;
235        *-dec-osf5.* )
236            # Compaq alphaev68-dec-osf5.1 compiler
237            if test -n "${CXXFLAGS}"; then
238                CXXFLAGS='-std strict_ansi -noimplicit_include'
239            else
240                CXXFLAGS="${CXXFLAGS} -std strict_ansi -noimplicit_include"
241            fi
242  esac
243fi
244
245dnl Platform-specific stuff
246case "$host" in
247*darwin*)
248  dnl OS X universal binary support, requires --disable-dependency-tracking
249  AC_ARG_ENABLE(osx-universal-binaries,
250        AC_HELP_STRING([--enable-osx-universal-binaries],
251           [build universal binaries on OS X [[default=no]]]),
252        [build_osxuniversal="${enableval}"], [build_osxuniversal=no])
253 
254  if test "${build_osxuniversal}" != no ; then
255    if test "$enable_dependency_tracking" != no ; then
256      AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
257Please re-run configure with these options:
258  --disable-dependency-tracking --enable-osx-universal-binary
259        ])
260    fi
261    CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
262    CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
263    LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
264  fi
265 
266esac
267
268# Enable support for threads
269AC_ARG_WITH([threads],
270    [AC_HELP_STRING([--without-threads],
271                    [disable threads support])],
272    [with_threads=$withval],
273    [with_threads='yes'])
274
275have_threads=no
276if test "$with_threads" != 'no'; then
277    ACX_PTHREAD()
278    if test "$acx_pthread_ok" = yes; then
279        have_threads=yes
280        DEF_THREAD="$PTHREAD_CFLAGS"
281        CFLAGS="$CFLAGS $DEF_THREAD"
282        CXXFLAGS="$CXXFLAGS $DEF_THREAD"
283        if test "$CC" != "$PTHREAD_CC"; then
284            AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
285            CC="$PTHREAD_CC"
286        fi
287    fi
288fi
289
290# Enable support for OpenMP
291AC_OPENMP([C])
292CFLAGS="$CFLAGS $OPENMP_CFLAGS"
293LDFLAGS="$LDFLAGS $OPENMP_CFLAGS"
294MAGICK_PCFLAGS="$MAGICK_PCFLAGS $OPENMP_CFLAGS"
295
296########
297#
298# Check for large file support
299#
300########
301AC_SYS_LARGEFILE
302AC_FUNC_FSEEKO
303LFS_CPPFLAGS=''
304if test "$enable_largefile" != no; then
305    if test "$ac_cv_sys_file_offset_bits" != 'no'; then
306        LFS_CPPFLAGS="$LFS_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
307    else
308        AC_MSG_CHECKING([for native large file support])
309        AC_RUN_IFELSE([#include <unistd.h>
310          main () {
311          exit(!(sizeof(off_t) == 8));
312        }],
313        [ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
314         AC_MSG_RESULT([yes])],
315        [AC_MSG_RESULT([no])])
316    fi
317    if test "$ac_cv_sys_large_files" != 'no'; then
318        LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGE_FILES=1"
319    fi
320    if  test "$ac_cv_sys_largefile_source" != 'no'; then
321        LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGEFILE_SOURCE=1"
322    fi
323fi
324AC_SUBST(LFS_CPPFLAGS)
325
326#
327# Configure libtool & libltdl
328#
329
330# Configure libltdl
331#AC_CONFIG_SUBDIRS(ltdl)
332AC_LIBLTDL_CONVENIENCE(ltdl)
333AC_LIB_LTDL
334# Substitute INCLTDL and LIBLTDL in the Makefiles
335#AC_SUBST(INCLTDL)
336#AC_SUBST(LIBLTDL)
337
338# Configure libtool
339AC_ENABLE_SHARED
340AC_ENABLE_STATIC
341AC_LIBTOOL_TAGS([CXX])
342AC_LIBTOOL_WIN32_DLL
343AC_LIBTOOL_DLOPEN
344AC_PROG_LIBTOOL
345AC_SUBST(LIBTOOL_DEPS)
346#AC_OUTPUT
347
348# Check to see if building shared libraries
349libtool_build_shared_libs='no'
350if test "$enable_shared" = 'yes'; then
351    libtool_build_shared_libs='yes'
352fi
353
354# Check to see if building static libraries
355libtool_build_static_libs='no'
356if test "$enable_static" = 'yes'; then
357    libtool_build_static_libs='yes'
358fi
359
360# MinGW and Cygwin can't build C++ DLLs which support exceptions.
361if test "${StaticCplusPlusLibraries}" = 'yes'; then
362    LTCXXLIBOPTS='--static'
363    AC_SUBST(LTCXXLIBOPTS)
364fi
365
366#
367# Enable support for building loadable modules
368#
369AC_ARG_WITH([modules],
370    [AC_HELP_STRING([--with-modules],
371                    [support dynamically loadable modules])],
372    [with_modules=$withval],
373    [with_modules=$libtool_build_shared_libs])
374
375# Only allow building loadable modules if we are building shared libraries
376if test "$with_modules" != 'no' ; then
377    if test "$libtool_build_shared_libs" = 'no'; then
378        AC_MSG_WARN([Modules may only be built if building shared libraries is enabled.])
379        with_modules='no'
380    fi
381fi
382if test "$with_modules" != 'no'; then
383    AC_DEFINE(BuildMagickModules,1,Define if coders and filters are to be built as modules.)
384fi
385AM_CONDITIONAL(WITH_MODULES, test "$with_modules" != 'no')
386
387# Enable building/use of libltdl if we are building shared libraries regardless
388# of whether modules are built or not.
389with_ltdl='no'
390if test "$libtool_build_shared_libs" != 'no'; then
391    with_ltdl='yes'
392fi
393
394AM_CONDITIONAL(WITH_LTDL, test "$with_ltdl" != 'no')
395if test "$with_ltdl" != 'no'; then
396    AC_DEFINE(HasLTDL,1,Define if using libltdl to support dynamically loadable modules)
397
398    # Set DLLDFLAGS
399    if test X"$enable_shared" = Xyes; then
400        DLLDFLAGS=-export-dynamic
401        AC_SUBST(DLLDFLAGS)
402    fi
403fi
404
405# Enable build using delegate libraries built in subdirectories rather than installed
406# delegate libraries (bzlib fpx jp2 jbig jpeg lcms png tiff ttf wmf xml zlib)
407AC_ARG_ENABLE([delegate-build],
408    [AC_HELP_STRING([--enable-delegate-build],
409                    [look for delegate libraries in build directory])],
410    [enable_delegate_build=$enableval],
411    [enable_delegate_build='no'])
412
413AC_ARG_ENABLE([deprecated],
414    [AC_HELP_STRING([--disable-deprecated],
415                    [exclude deprecated methods in MagickCore and MagickWand API's])],
416    [enable_deprecated=$enableval],
417    [enable_deprecated='no'])
418
419if test "$enable_deprecated" = 'yes'; then
420  AC_DEFINE(ExcludeMagickDeprecated,1,[exclude deprecated methods in MagickCore API])
421else
422  DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-deprecate "
423fi
424
425# Build a version of ImageMagick which operates uninstalled.
426# Used to build distributions located via MAGICK_HOME / executable path
427AC_ARG_ENABLE([installed],
428    [AC_HELP_STRING([--disable-installed],
429                    [Formally install ImageMagick under PREFIX])],
430    [enable_installed=$enableval],
431    [enable_installed='yes'])
432
433if test "$enable_installed" = 'yes'; then
434    AC_DEFINE(UseInstalledMagick,1,[ImageMagick is formally installed under prefix])
435else
436    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-installed "
437fi
438
439# Build an embeddable version of ImageMagick.
440AC_ARG_ENABLE([embeddable],
441    [AC_HELP_STRING([--enable-embeddable],
442                    [enable self-contained, embeddable, zero-configuration ImageMagick])],
443    [enable_embeddable=$enableval],
444    [enable_embeddable='no'])
445
446if test "$enable_embeddable" = 'yes'; then
447    AC_DEFINE(UseEmbeddableMagick,1,[Build self-contained, embeddable, zero-configuration ImageMagick (experimental)])
448fi
449
450# Build a high dynamic range version of ImageMagick.
451AC_ARG_ENABLE([hdri],
452    [AC_HELP_STRING([--enable-hdri],
453                    [accurately represent the wide range of intensity levels found in real scenes])],
454    [enable_hdri=$enableval],
455    [enable_hdri='no'])
456
457MAGICK_HDRI=""
458if test "$enable_hdri" = 'yes'; then
459    MAGICK_HDRI="HDRI"
460    AC_DEFINE(UseHDRI,1,[accurately represent the wide range of intensity levels  in real scenes])
461fi
462AC_SUBST(MAGICK_HDRI)dnl
463
464# Enable verbose output from libtool (enable libtool's default)
465AC_ARG_ENABLE([libtool-verbose],
466    [AC_HELP_STRING([--enable-libtool-verbose],
467                    [enable verbose libtool output])],
468    [enable_libtool_verbose=$enableval],
469    [enable_libtool_verbose='no'])
470
471if test "$enable_libtool_verbose" = 'no'; then
472    LIBTOOL="$LIBTOOL --silent"
473fi
474
475# Build a version of ImageMagick with assert statements.
476AC_ARG_ENABLE([assert],
477    [AC_HELP_STRING([--disable-assert],
478                    [disable assert() statements in build])],
479    [enable_assert=$enableval],
480    [enable_assert='yes'])
481
482if test "$enable_assert" = 'no'; then
483    AC_DEFINE(NDEBUG,1,[Turn off assert statements])
484fi
485
486# Add configure option --enable-maintainer-mode which enables dependency
487# checking and generation useful to package maintainers.  This is made an
488# option to avoid confusing end users.
489AM_MAINTAINER_MODE
490
491
492# Enable ccmalloc memory debugging support
493AC_ARG_ENABLE([ccmalloc],
494    [AC_HELP_STRING([--enable-ccmalloc],
495                    [enable 'ccmalloc' memory debug support])],
496    [enable_ccmalloc=$enableval],
497    [enable_ccmalloc='no'])
498
499# Enable Electric Fence memory debugging support
500AC_ARG_ENABLE([efence],
501    [AC_HELP_STRING([--enable-efence],
502                    [enable 'efence' memory debug support])],
503    [enable_efence=$enableval],
504    [enable_efence='no'])
505
506# Enable prof-based profiling support
507AC_ARG_ENABLE([prof],
508    [AC_HELP_STRING([--enable-prof],
509                    [enable 'prof' profiling support])],
510    [enable_prof=$enableval],
511    [enable_prof='no'])
512
513# Enable gprof-based profiling support
514AC_ARG_ENABLE([gprof],
515    [AC_HELP_STRING([--enable-gprof],
516                    [enable 'gprof' profiling support])],
517    [enable_gprof=$enableval],
518    [enable_gprof='no'])
519
520# Enable gcov-based profiling support
521AC_ARG_ENABLE([gcov],
522    [AC_HELP_STRING([--enable-gcov],
523                    [enable 'gcov' profiling support])],
524    [enable_gcov=$enableval],
525    [enable_gcov='no'])
526
527enable_profiling='no'
528if test "$enable_prof" = 'yes' || test "$enable_gprof" = 'yes' || test "$enable_gcov" = 'yes'; then
529    enable_profiling='yes'
530    if test "$libtool_build_shared_libs" = 'yes'; then
531        echo "Warning: Can not profile code using shared libraries"
532    fi
533fi
534
535# Magick API method prefix
536AC_ARG_WITH([method-prefix],
537    [AC_HELP_STRING([--with-method-prefix=PREFIX],
538                    [prefix MagickCore API methods])],
539    [with_method_prefix=$enableval],
540    [with_method_prefix=''])
541
542if test "$with_method_prefix" != ''; then
543    AC_DEFINE_UNQUOTED(MagickMethodPrefix,$with_method_prefix,[Magick API method prefix])
544fi
545
546# Number of bits in a Quantum
547AC_ARG_WITH([quantum-depth],
548    [AC_HELP_STRING([--with-quantum-depth=DEPTH],
549                    [number of bits in a pixel quantum (default 16)])],
550    [with_quantum_depth=$withval],
551    [with_quantum_depth=16])
552
553if test "$with_quantum_depth" != '8'; then
554    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-quantum-depth=$with_quantum_depth "
555fi
556
557case "${with_quantum_depth}" in
558    8 )
559    ;;
560    16 )
561    ;;
562    32 )
563    ;;
564    64 )
565    ;;
566    * )
567        AC_MSG_ERROR("Pixel quantum depth must have value of 8, 16, or 32")
568    ;;
569esac
570QuantumDepth="$with_quantum_depth"
571AC_DEFINE_UNQUOTED(QuantumDepth,$QuantumDepth,[Number of bits in a pixel Quantum (8/16/32/64)])
572AC_SUBST(QuantumDepth)dnl
573
574# Set pixel cache threshold
575AC_ARG_WITH([cache],
576    [AC_HELP_STRING([--with-cache=THRESHOLD],
577                    [set pixel cache threshhold in MB (default available memory)])],
578    [with_cache=$withval],
579    [with_cache=''])
580
581if test "$with_cache" != ''; then
582    AC_DEFINE_UNQUOTED(PixelCacheThreshold,$with_cache,[Pixel cache threshold in MB (defaults to available memory)])
583    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-cache=$with_cache "
584fi
585
586# Disable/Enable support for full delegate paths
587AC_ARG_WITH([frozenpaths],
588    [AC_HELP_STRING([--with-frozenpaths],
589                    [freeze delegate paths])],
590    [with_frozenpaths=$withval],
591    [with_frozenpaths='no'])
592
593# Enable build/install of Magick++
594AC_ARG_WITH([magick-plus-plus],
595    [AC_HELP_STRING([--without-magick-plus-plus],
596                    [disable build/install of Magick++])],
597    [with_magick_plus_plus=$withval],
598    [with_magick_plus_plus='yes'])
599
600# Disable build/install of PerlMagick.
601AC_ARG_WITH([perl],
602    [AC_HELP_STRING([--without-perl],
603                    [no not build or install of PerlMagick])],
604    [with_perl=$withval],
605    [with_perl='yes'])
606
607# Options to pass when configuring PerlMagick
608AC_ARG_WITH([perl-options],
609    [AC_HELP_STRING([--with-perl-options=OPTIONS],
610                    [options to pass on command-line when generating PerlMagick's build file])])
611
612PERL_MAKE_OPTIONS=$with_perl_options
613AC_SUBST(PERL_MAKE_OPTIONS)
614
615
616# Disable BZLIB (bzip2 library)
617AC_ARG_WITH([bzlib],
618    [AC_HELP_STRING([--without-bzlib],
619                    [disable BZLIB support])],
620    [with_bzlib=$withval],
621    [with_bzlib='yes'])
622
623if test "$with_bzlib" != 'yes'; then
624    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-bzlib=$with_bzlib "
625fi
626
627# Disable Display Postscript.
628AC_ARG_WITH([dps],
629    [AC_HELP_STRING([--without-dps],
630                    [disable Display Postscript support])],
631    [with_dps=$withval],
632    [with_dps='yes'])
633
634if test "$with_dps" != 'yes'; then
635    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-dps=$with_dps "
636fi
637
638# Disable DJVU.
639AC_ARG_WITH([djvu],
640    [AC_HELP_STRING([--without-djvu],
641                    [disable DjVu support])],
642    [with_djvu=$withval],
643    [with_djvu='yes'])
644
645if test "$with_djvu" != 'yes'; then
646    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-djvu=$with_djvu "
647fi
648
649# Enable FlashPIX.
650AC_ARG_WITH([fpx],
651    [AC_HELP_STRING([--with-fpx],
652                    [enable FlashPIX support])],
653    [with_fpx=$withval],
654    [with_fpx='no'])
655
656if test "$with_fpx" != 'yes'; then
657    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fpx=$with_fpx "
658fi
659
660# Enable Ghostscript library support.
661AC_ARG_WITH([gslib],
662    [AC_HELP_STRING([--without-gslib],
663                    [disable Ghostscript library support])],
664    [with_gslib=$withval],
665    [with_gslib='yes'])
666
667if test "$with_gslib" != 'yes'; then
668    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gslib=$with_gslib "
669fi
670
671# Disable JBIG.
672AC_ARG_WITH([jbig],
673    [AC_HELP_STRING([--without-jbig],
674                    [disable JBIG support])],
675    [with_jbig=$withval],
676    [with_jbig='yes'])
677
678if test "$with_jbig" != 'yes'; then
679    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jbig=$with_jbig "
680fi
681
682# Disable JPEG.
683AC_ARG_WITH([jpeg],
684    [AC_HELP_STRING([--without-jpeg],
685                    [disable JPEG support])],
686    [with_jpeg=$withval],
687    [with_jpeg='yes'])
688
689if test "$with_jpeg" != 'yes'; then
690    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jpeg=$with_jpeg "
691fi
692
693# Disable JPEG Version 2.
694AC_ARG_WITH([jp2],
695    [AC_HELP_STRING([--without-jp2],
696                    [disable JPEG-2000 support])],
697    [with_jp2=$withval],
698    [with_jp2='yes'])
699
700if test "$with_jp2" != 'yes'; then
701    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jp2=$with_jp2 "
702fi
703
704# Disable TIFF.
705AC_ARG_WITH([tiff],
706    [AC_HELP_STRING([--without-tiff],
707                    [disable TIFF support])],
708    [with_tiff=$withval],
709    [with_tiff='yes'])
710
711if test "$with_tiff" != 'yes'; then
712    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-tiff=$with_tiff "
713fi
714
715# Disable WMF.
716AC_ARG_WITH([wmf],
717    [AC_HELP_STRING([--without-wmf],
718                    [disable WMF support])],
719    [with_wmf=$withval],
720    [with_wmf=$with_modules])
721
722if test "$with_wmf" != 'yes'; then
723    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-wmf=$with_wmf "
724fi
725
726# Set default font search path
727AC_ARG_WITH([fontpath],
728    [AC_HELP_STRING([--with-fontpath=DIR],
729                    [prepend to default font search path])],
730    [with_fontpath=$withval],
731    [with_fontpath=''])
732
733if test "$with_fontpath" != "yes" && test -z "$with_fontpath"; then
734    with_fontpath=''
735else
736    AC_DEFINE_UNQUOTED(MAGICK_FONT_PATH,"$with_fontpath",Define to prepend to default font search path.)
737fi
738if test "$with_fontpath=" != ''; then
739    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fontpath=$with_fontpath "   
740fi
741
742# Set Ghostscript font directory
743AC_ARG_WITH([gs-font-dir],
744    [AC_HELP_STRING([--with-gs-font-dir=DIR],
745                    [Ghostscript font directory])],
746    [with_gs_font_dir=$withval],
747    [with_gs_font_dir='default'])
748
749if test "$with_gs_font_dir" != 'default'; then
750    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gs-font-dir=$with_gs_font_dir "
751fi 
752
753# Set Windows font directory
754AC_ARG_WITH([windows-font-dir],
755    [AC_HELP_STRING([--with-windows-font-dir=DIR],
756                    [MS Windows font directory])],
757    [with_windows_font_dir=$withval],
758    [with_windows_font_dir=''])
759
760if test "x$with_windows_font_dir" = "xno"; then
761    with_windows_font_dir=
762fi
763if test "$with_windows_font_dir" != ''; then
764    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-windows-font-dir=$with_windows_font_dir "
765fi
766
767AC_ARG_WITH([zlib],
768    [AC_HELP_STRING([--without-zlib],
769                    [disable ZLIB support])],
770    [with_zlib=$withval],
771    [with_zlib='yes'])
772
773if test "$with_zlib" != 'yes'; then
774    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-zlib=$with_zlib "
775fi
776
777#
778# Specify path to shared libstdc++ if not in normal location
779#
780AC_ARG_WITH([libstdc],
781    [AC_HELP_STRING([--with-libstdc=DIR],
782                    [ use libstdc++ in DIR (for GNU C++)])],
783    [with_libstdc=$withval],
784    [with_libstdc=''])
785
786if test "$with_libstdc" != ''; then
787    if test -d "$with_libstdc"; then
788        LIBSTDCLDFLAGS="-L$with_libstdc"
789    fi
790fi
791AC_SUBST(LIBSTDCLDFLAGS)
792
793# Does gcc required -traditional?
794AC_PROG_GCC_TRADITIONAL
795
796########
797#
798# Set defines required to build DLLs and modules using MinGW
799#
800########
801# These options are set for multi-thread DLL module build
802#  libMagick:           _DLL _MAGICKMOD_ _MAGICKLIB_
803#  module:              _DLL
804#  executable/Magick++: _DLL _MAGICKMOD_
805MODULE_EXTRA_CPPFLAGS=''
806LIBRARY_EXTRA_CPPFLAGS=''
807if test "${native_win32_build}" = 'yes'; then
808    if test "${libtool_build_shared_libs}" = 'yes'; then
809        CPPFLAGS="$CPPFLAGS -D_DLL"
810        MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_DLL"
811        MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_DLL"
812        LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKLIB_"
813        if test "$with_modules" = 'yes'; then
814            LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKMOD_"
815        else
816            MODULE_EXTRA_CPPFLAGS="$MODULE_EXTRA_CPPFLAGS -D_MAGICKLIB_"
817        fi
818    else
819        CPPFLAGS="$CPPFLAGS -D_LIB"
820        MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_LIB"
821        MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_LIB"
822    fi
823    if test "$with_threads" = 'yes'; then
824         CPPFLAGS="$CPPFLAGS -D_MT"
825         MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_MT"
826         MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_MT"
827    fi
828fi
829AC_SUBST(MODULE_EXTRA_CPPFLAGS)
830AC_SUBST(LIBRARY_EXTRA_CPPFLAGS)
831
832# Check standard headers
833AC_HEADER_STDC
834if ! test x"$ac_cv_header_stdc" = x"yes"; then
835    AC_MSG_WARN([configure has detected that you do not have the ANSI standard C
836    header files.  Compilation cannot proceed.  Please install the ANSI C
837    headers and rerun this script.]);
838fi
839AC_HEADER_DIRENT
840
841# Check additional headers
842AC_CHECK_HEADERS(errno.h fcntl.h inttypes.h limits.h locale.h machine/param.h stdarg.h string.h strings.h sys/resource.h sys/time.h sys/timeb.h sys/times.h sys/types.h sys/wait.h unistd.h)
843
844########
845#
846# Checks for typedefs, structures, and compiler characteristics.
847#
848########
849
850# If the C compiler does not fully support the ANSI C qualifier const,
851# define const to be empty.
852AC_HEADER_STDBOOL
853AC_C_CONST
854AC_C_VOLATILE
855AC_C_STRINGIZE
856AC_TYPE_MODE_T
857AC_TYPE_PID_T
858AC_TYPE_OFF_T
859AC_TYPE_SIZE_T
860AC_HEADER_STAT
861AC_HEADER_TIME
862AC_STRUCT_TM
863
864# If the C compiler supports the keyword inline, do nothing. Otherwise
865# define inline to __inline__ or __inline if it accepts one of those,
866# otherwise define inline to be empty.
867AC_C_INLINE
868
869# If words are stored with the most significant byte first (like
870# Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
871AC_C_BIGENDIAN
872
873# If the C compiler supports a working long double type with more range
874# or precision than the double type, define HAVE_LONG_DOUBLE.
875AC_C_LONG_DOUBLE
876
877# If the C type char is unsigned, define __CHAR_UNSIGNED__, unless the
878# C compiler predefines it.
879AC_C_CHAR_UNSIGNED
880
881# Obtain size of an 'short' and define as SIZEOF_SHORT
882AC_CHECK_SIZEOF(short)
883
884# Obtain size of an 'unsigned short' and define as SIZEOF_UNSIGNED_SHORT
885AC_CHECK_SIZEOF(unsigned short)
886
887# Obtain size of an 'int' and define as SIZEOF_INT
888AC_CHECK_SIZEOF(int)
889
890# Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
891AC_CHECK_SIZEOF(unsigned int)
892
893# Obtain size of a 'long' and define as SIZEOF_LONG
894AC_CHECK_SIZEOF(long)
895
896# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
897AC_CHECK_SIZEOF(unsigned long)
898
899# Obtain size of off_t and define as SIZEOF_OFF_T
900AC_CHECK_SIZEOF(off_t)
901
902# Obtain size of a 'size_t' and define as SIZEOF_SIZE_T
903AC_CHECK_SIZEOF(size_t)
904
905# Obtain size of a 'ssize_t' and define as SIZEOF_SSIZE_T
906AC_CHECK_SIZEOF(ssize_t)
907
908# Obtain size of a 'double' and define as SIZEOF_DOUBLE
909AC_CHECK_SIZEOF(double)
910
911# Obtain size of a 'long long' and define as SIZEOF_LONG_LONG.  If
912# 'long long' is not supported then the value defined is zero.
913AC_CHECK_SIZEOF(long long)
914
915# Obtain size of a 'unsigned long long' and define as
916# SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not
917# supported then the value defined is zero.
918AC_CHECK_SIZEOF(unsigned long long)
919
920# Obtain size of a 'unsigned double' and define as SIZEOF_LONG_DOUBLE.  If
921# 'long double' is not supported then the value defined is zero.
922AC_CHECK_SIZEOF(long double)
923
924# Obtain size of an 'void *' and define as SIZEOF_VOID
925AC_CHECK_SIZEOF(void *)
926
927# If the system does not provide a 'mode_t' type, use 'int' instead
928AC_CHECK_TYPE(mode_t, unsigned int)
929
930# If the system does not provide a 'off_t' type, use 'long' instead
931AC_CHECK_TYPE(off_t, long)
932
933# If the system does not provide a 'pid_t' type, use 'int' instead
934AC_CHECK_TYPE(pid_t, int)
935
936# If the system does not provide a 'size_t', use 'unsigned long' instead.
937AC_CHECK_TYPE(size_t, unsigned long)
938
939# If the system does not provide a 'ssize_t', use 'long' instead.
940AC_CHECK_TYPE(ssize_t, long)
941
942AC_MSG_CHECKING([whether our compiler supports __func__])
943AC_TRY_COMPILE([],
944 [{ const char *func = __func__; return(func != 0 ? 0 : 1); }],
945 AC_MSG_RESULT([yes]),
946 AC_MSG_RESULT([no])
947 AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
948 AC_TRY_COMPILE([],
949   [{ const char *func = __FUNCTION__; return(func != 0 ? 0 : 1); }],
950   AC_MSG_RESULT([yes])
951   AC_DEFINE(__func__, __FUNCTION__,
952     [Define to appropriate substitue if compiler does not have __func__]),
953   AC_MSG_RESULT([no])
954   AC_DEFINE(__func__, __FILE__,
955     [Define to appropriate substitue if compiler does not have __func__])))
956
957########
958#
959# Check for functions
960#
961########
962MAGICK_FUNC_MMAP_FILEIO
963AC_FUNC_CLOSEDIR_VOID
964AC_FUNC_MMAP
965AC_FUNC_MEMCMP
966AC_FUNC_SELECT_ARGTYPES
967AC_FUNC_SETVBUF_REVERSED
968AC_TYPE_SIGNAL
969AC_FUNC_STRTOD
970AC_FUNC_VPRINTF
971
972AC_CHECK_FUNCS([_exit atexit clock_gettime execvp floor fork ftime ftruncate getcwd getexecname getdtablesize getpagesize gettimeofday lstat memset mkstemp munmap pclose _pclose poll popen _popen pow pread pwrite raise rand_r select seekdir setlocale sqrt setvbuf stat strcspn strdup strpbrk strspn strstr strtol symlink sysconf sigemptyset sigaction strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times usleep vsprintf vsnprintf waitpid])
973
974########
975#       
976# Check for function prototypes
977#
978########
979
980AC_CHECK_DECLS([pread, pwrite],[],[],[
981#include <unistd.h>])
982
983AC_CHECK_DECLS([strlcpy],[],[],[
984#include <strings.h>])
985
986AC_CHECK_DECLS([vsnprintf],[],[],[
987#include <stdio.h>
988#include <stdarg.h>])
989
990########
991#
992# C++ Support Tests (For Magick++)
993#
994########
995have_magick_plus_plus='no'
996if test "$with_magick_plus_plus" = 'yes'; then
997    OLIBS="$LIBS"
998    LIBS=''
999    AC_LANG_PUSH(C++)
1000
1001    # Full set of headers used ...
1002    # algorithm cctype cerrno cmath cstdio cstdlib cstring ctime exception
1003    # functional iomanip iosfwd iostream iterator list string strstream utility
1004    AC_LANG([C++])
1005    AC_PROG_CXX
1006    AC_CXX_HAVE_BOOL
1007    AC_CXX_HAVE_NAMESPACES
1008    AC_CXX_HAVE_STD_NAMESPACE
1009    AC_CXX_HAVE_STD_LIBS
1010    AC_CXX_HAVE_LSTRING
1011    AC_OPENMP([C++])
1012    CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
1013    AC_LANG_POP
1014
1015    AC_MSG_CHECKING([whether C++ compiler is sufficient for Magick++])
1016    if \
1017        test $ac_cv_cxx_have_bool = 'yes' && \
1018        test $ac_cv_cxx_have_lstring = 'yes' && \
1019        test $ac_cv_cxx_have_namespaces = 'yes' && \
1020        test $ac_cv_cxx_have_std_libs = 'yes' && \
1021        test $ac_cv_cxx_have_std_namespace = 'yes'; then
1022        have_magick_plus_plus='yes'
1023    else
1024        have_magick_plus_plus='no (failed tests)'
1025    fi
1026    AC_MSG_RESULT([$have_magick_plus_plus])
1027    LIBS="$OLIBS"
1028fi
1029AM_CONDITIONAL(WITH_MAGICK_PLUS_PLUS, test "$have_magick_plus_plus" = 'yes')
1030
1031# Only check for delegate libraries in subdirectories if requested.
1032if test "$enable_delegate_build" != 'no'; then
1033    # Check for delegate sub-directories and add -I & -L options as required.
1034    # This presumes that delegates are installed as detailed in the ImageMagick
1035    # README. If delegates are installed in a standard location where the
1036    # compiler will automatically find them then these options should not be
1037    # required.
1038
1039    #
1040    # Most delegates have includes in the same directory as the library, but not all ...
1041    #
1042    # Includes
1043    for dir in bzlib fpx jp2 jp2/src/libjasper/include jbig/libjbig jpeg lcms/include magick png tiff/libtiff ttf/include wand wmf/include xml/include zlib; do
1044        if test -d "$builddir/$dir"; then
1045            CPPFLAGS="$CPPFLAGS -I$builddir/$dir"
1046        else
1047            if test -d "$srcdirfull/$dir"; then
1048                CPPFLAGS="$CPPFLAGS -I$srcdirfull/$dir"
1049            fi
1050        fi
1051    done
1052
1053    # Libraries
1054    for dir in bzlib fpx jp2 jp2/src/libjasper jbig/libjbig jpeg lcms/src magick png tiff/libtiff ttf/objs wand wmf/src xml zlib; do
1055    if test -d "$builddir/$dir/.libs"; then
1056        LDFLAGS="$LDFLAGS -L$builddir/$dir/.libs"
1057    else
1058        if test -d "$srcdirfull/$dir/.libs"; then
1059            LDFLAGS="$LDFLAGS -L$srcdirfull/$dir/.libs"
1060        fi
1061    fi
1062    if test -d "$builddir/$dir"; then
1063        LDFLAGS="$LDFLAGS -L$builddir/$dir"
1064    else
1065        if test -d "$srcdirfull/$dir"; then
1066            LDFLAGS="$LDFLAGS -L$srcdirfull/$dir"
1067        fi
1068    fi
1069  done
1070fi
1071
1072# Assume that delegate headers reside under same directory as ImageMagick
1073# installation prefix.
1074MAGICK_CPPFLAGS="-I$INCLUDE_DIR $MAGICK_CPPFLAGS"
1075
1076#
1077# Find the X11 RGB database
1078#
1079AC_CACHE_CHECK(for X11 configure files,im_cv_x_configure,
1080[# Look for the header file in a standard set of common directories.
1081# Check X11 before X11Rn because it is often a symlink to the current release.
1082    for ac_dir in          \
1083    /lib/usr/lib/X11       \
1084    /usr/X11/lib           \
1085    /usr/X11R4/lib         \
1086    /usr/X11R5/lib         \
1087    /usr/X11R6/lib         \
1088    /usr/X386/lib          \
1089    /usr/XFree86/lib/X11   \
1090    /usr/athena/lib        \
1091    /usr/lib               \
1092    /usr/lib/X11           \
1093    /usr/lib/X11R4         \
1094    /usr/lib/X11R5         \
1095    /usr/lib/X11R6         \
1096    /usr/local/X11/lib     \
1097    /usr/local/X11R4/lib   \
1098    /usr/local/X11R5/lib   \
1099    /usr/local/X11R6/lib   \
1100    /usr/local/lib         \
1101    /usr/local/lib/X11     \
1102    /usr/local/lib/X11R4   \
1103    /usr/local/lib/X11R5   \
1104    /usr/local/lib/X11R6   \
1105    /usr/local/x11r5/lib   \
1106    /usr/lpp/Xamples/lib   \
1107    /usr/openwin/lib       \
1108    /usr/openwin/share/lib \
1109    /usr/unsupported/lib   \
1110    /usr/x386/lib          \
1111    ; do
1112    if test -f "$ac_dir/X11/rgb.txt"; then
1113      im_cv_x_configure="$ac_dir/X11/"
1114      break
1115    elif test -f "$ac_dir/rgb.txt"; then
1116      im_cv_x_configure="$ac_dir/"
1117      break
1118    fi
1119
1120  done])
1121X11ConfigurePath="$im_cv_x_configure"
1122if test "$native_win32_build" = 'yes'; then
1123    X11ConfigurePath=`$WinPathScript "$X11ConfigurePath=" 1`
1124fi
1125AC_DEFINE_UNQUOTED(X11ConfigurePath,"X11ConfigurePath",Location of X11 configure files)
1126
1127#
1128# Find OpenMP library
1129#
1130GOMP_LIBS=''
1131if test "$enable_openmp" != 'no'; then
1132  AC_CHECK_LIB(gomp,GOMP_parallel_start,GOMP_LIBS="-lgomp",,)
1133  LIBS="$GOMP_LIBS $LIBS"
1134fi
1135AC_SUBST(GOMP_LIBS)
1136
1137#
1138# Find Posix threads library
1139#
1140THREAD_LIBS=''
1141if test "$with_threads" != 'no' && test "$have_threads" = 'yes'; then
1142
1143    if test "x$PTHREAD_LIBS" = "x"; then
1144    case "${host_cpu}-${host_os}" in
1145      *-freebsd*)
1146        MAGICK_CHECK_PTHREAD_LIB(c_r,PTHREAD_LIBS=-lc_r) ;;
1147    esac
1148    fi
1149
1150    for lib in pthread pthreads; do
1151        if test "x$PTHREAD_LIBS" = "x"; then
1152            MAGICK_CHECK_PTHREAD_LIB([$lib],[PTHREAD_LIBS=-l$lib])
1153        fi
1154    done
1155
1156    THREAD_LIBS="$PTHREAD_LIBS"
1157    LIBS="$LIBS $THREAD_LIBS"
1158fi
1159AC_SUBST(THREAD_LIBS)
1160
1161#
1162# Add support for ccmalloc memory debugging library if requested
1163#
1164have_ccmalloc='no'
1165CCMALLOC_LIBS=''
1166if test "$enable_ccmalloc" = 'yes'; then
1167    AC_PATH_PROG(CCMALLOCDelegate,ccmalloc,)
1168    if test -n "$CCMALLOCDelegate"; then
1169        eval `grep PREFIX= $CCMALLOCDelegate | sed -e 's/PREFIX/CCMALLOC_PREFIX/'`
1170        OLIBS="$LIBS"
1171        # Assume that gcc is used with ccmalloc.
1172        LIBS="$LIBS $CCMALLOC_PREFIX/lib/ccmalloc-gcc.o"
1173       AC_CHECK_LIB(ccmalloc,ccmalloc_malloc,CCMALLOC_LIBS="$CCMALLOC_PREFIX/lib/ccmalloc-gcc.o -lccmalloc -ldl",,-ldl)
1174        if test -n "$CCMALLOC_LIBS"; then
1175            LIBS="$OLIBS"
1176            LIBS="$LIBS $CCMALLOC_LIBS"
1177            have_ccmalloc='yes'
1178        else
1179            LIBS="$OLIBS"
1180        fi
1181    fi
1182fi
1183
1184#
1185# Add support for efence memory debugging library if requested
1186#
1187if test "$enable_efence" = 'yes'; then
1188    EFENCE_LIBS='-lefence'
1189    LIBS="$EFENCE_LIBS $LIBS"
1190fi
1191
1192#
1193# Find math library
1194#
1195MATH_LIBS=''
1196AC_CHECK_LIB(m,sqrt,MATH_LIBS="-lm",,)
1197LIBS="$MATH_LIBS $LIBS"
1198AC_SUBST(MATH_LIBS)
1199
1200#
1201# Check for ZLIB
1202#
1203have_zlib='no'
1204ZLIB_LIBS=''
1205dnl PNG requires zlib so enable zlib check if PNG is requested
1206if test "$with_zlib" != 'no' || test "$with_png" != 'no'; then
1207    AC_MSG_RESULT([-------------------------------------------------------------])
1208    AC_MSG_RESULT([Checking for ZLIB support])
1209    AC_MSG_RESULT([-------------------------------------------------------------])
1210    ZLIB_LIBS=''
1211    failed=0;
1212    passed=0;
1213    AC_CHECK_HEADER(zconf.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1214    AC_CHECK_HEADER(zlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1215    AC_CHECK_LIB(z,compress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1216    AC_CHECK_LIB(z,uncompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1217    AC_CHECK_LIB(z,deflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1218    AC_CHECK_LIB(z,inflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1219    AC_CHECK_LIB(z,gzseek,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1220    AC_CHECK_LIB(z,gztell,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1221    AC_MSG_CHECKING([if ZLIB package is complete])
1222    if test $passed -gt 0; then
1223        if test $failed -gt 0; then
1224            AC_MSG_RESULT([no -- some components failed test])
1225            have_zlib='no (failed tests)'
1226        else
1227            ZLIB_LIBS='-lz'
1228            LIBS="$ZLIB_LIBS $LIBS"
1229            AC_DEFINE(HasZLIB,1,Define if you have zlib compression library)
1230            AC_MSG_RESULT([yes])
1231            have_zlib='yes'
1232        fi
1233    else
1234        AC_MSG_RESULT([no])
1235    fi
1236fi
1237AM_CONDITIONAL(HasZLIB, test "$have_zlib" = 'yes')
1238AC_SUBST(ZLIB_LIBS)
1239
1240#
1241# Check for BZLIB
1242#
1243have_bzlib='no'
1244if test "$with_bzlib" != 'no'; then
1245    BZLIB_LIBS=''
1246    AC_MSG_RESULT([-------------------------------------------------------------])
1247    AC_MSG_RESULT([Checking for BZLIB support])
1248    AC_MSG_RESULT([-------------------------------------------------------------])
1249    failed=0;
1250    passed=0;
1251    AC_CHECK_HEADER(bzlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1252    AC_CHECK_LIB(bz2,BZ2_bzCompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1253    AC_CHECK_LIB(bz2,BZ2_bzDecompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1254    AC_MSG_CHECKING([if BZLIB package is complete])
1255    if test $passed -gt 0; then
1256        if test $failed -gt 0; then
1257            AC_MSG_RESULT([no -- some components failed test])
1258            have_bzlib='no (failed tests)'
1259        else
1260            BZLIB_LIBS='-lbz2'
1261            LIBS="$BZLIB_LIBS $LIBS"
1262            AC_DEFINE(HasBZLIB,1,Define if you have the bzip2 library)
1263            AC_MSG_RESULT([yes])
1264            have_bzlib='yes'
1265        fi
1266    else
1267        AC_MSG_RESULT([no])
1268    fi
1269fi
1270AM_CONDITIONAL(HasBZLIB, test "$have_bzlib" = 'yes')
1271AC_SUBST(BZLIB_LIBS)
1272
1273#
1274# Find the X11 include and library directories.
1275#
1276IPC_LIBS=''
1277X11_LIBS=''
1278XEXT_LIBS=''
1279XT_LIBS=''
1280AC_PATH_XTRA
1281if test "$no_x" != 'yes'; then
1282    AC_MSG_RESULT([-------------------------------------------------------------])
1283    AC_MSG_RESULT([Checking for X11 support])
1284    AC_MSG_RESULT([-------------------------------------------------------------])
1285    LDFLAGS="$LDFLAGS $X_LIBS"
1286    X11_LIBS="$X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
1287    LIBS="$X11_LIBS $LIBS"
1288    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1289
1290    AC_DEFINE(HasX11,1,Define if you have X11 library)dnl
1291
1292    #
1293    # Check for X11 shared memory extension
1294    #
1295    # shmctl is required to support the shared memory extension
1296    AC_CHECK_FUNC([shmctl],[have_shmctl='yes'],[])
1297    if test "$have_shmctl" != 'yes'; then
1298        PERSIST_LIBS=$LIBS
1299        LIBS="$LIBS -lcygipc"
1300        AC_TRY_LINK_FUNC([shmctl],[have_shmctl='yes'; IPC_LIBS='-lcygipc'],[])
1301        LIBS=$PERSIST_LIBS
1302    fi
1303
1304    if test "$have_shmctl" = 'yes'; then
1305        AC_CHECK_LIB([Xext],[XShmAttach],[XEXT_LIBS='-lXext' ; AC_DEFINE(HasSharedMemory,1,X11 server supports shared memory extension)],[],[])
1306    fi
1307
1308    #
1309    # Check for X11 shape extension
1310    #
1311    AC_CHECK_LIB([Xext],[XShapeCombineMask],[XEXT_LIBS='-lXext' ; AC_DEFINE(HasShape,1,X11 server supports shape extension)],[],[])
1312    AC_CHECK_LIB(Xt,XtSetEventDispatcher,XT_LIBS='-lXt',,)
1313    LIBS="$XEXT_LIBS $XT_LIBS $LIBS"
1314fi
1315if test "$no_x" != 'yes'; then
1316  have_x='yes'
1317else
1318  have_x='no'
1319fi
1320AM_CONDITIONAL(HasX11, test "$have_x" = 'yes')
1321AC_SUBST(X11_LIBS)
1322AC_SUBST(XEXT_LIBS)
1323
1324#
1325# If profiling, then check for -ldl and dlopen (required for Solaris & gcc)
1326#
1327LIB_DL=''
1328if test "$enable_profiling" = 'yes'; then
1329    AC_CHECK_LIB(dl,dlopen,LIB_DL='-ldl',,)
1330    LIBS="$LIB_DL $LIBS"
1331fi
1332AC_SUBST(LIB_DL)
1333
1334#
1335# Check for Display Postscript
1336#
1337have_dps='no'
1338DPS_LIBS=''
1339if test "$with_dps" != 'no' && test "$with_x" != 'no'; then
1340    AC_MSG_RESULT([-------------------------------------------------------------])
1341    AC_MSG_RESULT([Checking for Display Postscript support])
1342    AC_MSG_RESULT([-------------------------------------------------------------])
1343    failed=0;
1344    passed=0;
1345    PERSIST_CPPFLAGS="$CPPFLAGS"
1346    CPPFLAGS="$CPPFLAGS -I${ac_x_includes}/X11"
1347    AC_CHECK_HEADER(DPS/dpsXclient.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1348    # DPS issues:
1349    # XFree86-4.x needs -lXt to provide XtMalloc for -ldps.
1350    # Cygwin doesn't deliver -lXt as a DLL, which prevents a DLL build.
1351    # Adobe DPS (as delivered on Solaris) doesn't require -lXt.
1352    # ImageMagick itself doesn't use -lXt.
1353    have_libdps='no'
1354    LIBDPS_XT=''
1355    AC_CHECK_LIB(dps,DPSInitialize,have_libdps='yes',have_libdps='no',)
1356    if test "$have_libdps" != 'yes'; then
1357        # Unset cache variable so we can try again.
1358        unset ac_cv_lib_dps_DPSInitialize
1359        AC_CHECK_LIB(dps,DPSInitialize,have_libdps='yes',have_libdps='no',-lXt)
1360        if test "$have_libdps" = 'yes'; then
1361            LIBDPS_XT='-lXt'
1362        fi
1363    fi
1364    if test "$have_libdps" = 'yes'; then