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

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