-
Notifications
You must be signed in to change notification settings - Fork 85
/
configure.ac
4164 lines (3713 loc) Β· 134 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright Β© 1999 ImageMagick Studio LLC, a non-profit organization
# dedicated to making software imaging solutions freely available.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at
#
# https://imagemagick.org/script/license.php
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright (C) 2003 - 2008 GraphicsMagick Group
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
# Process this file with autoconf to create configure script.
AC_PREREQ([2.69])
# ==============================================================================
# Initalize Automake
# ==============================================================================
m4_include([m4/version.m4])
m4_define([magick_base_version],
[magick_major_version.magick_minor_version.magick_micro_version])
m4_define([magick_version],
[magick_base_version-magick_patchlevel_version])m4_define([magick_lib_version_number],
[magick_major_version,magick_minor_version,magick_micro_version,magick_patchlevel_version])
m4_define([magick_git_revision],
m4_esyscmd([
h=$(git rev-parse --short HEAD)
d=$(git log -1 --format=:%cd --date=format:%Y%m%d || date -u +%Y%m%d -r ./m4/version.m4)
printf %s "$h$d"
]))
m4_define([magick_release_date],
m4_esyscmd([
d=$(git log -1 --format=%cd --date=format:%Y-%m-%d || date -u +%F -r ./m4/version.m4)
printf %s "$d"
]))
AC_INIT([magick_name],[magick_version],[magick_bugreport],[magick_tarname],[magick_url])
AC_CONFIG_SRCDIR([magick/MagickCore.h])
AC_CONFIG_AUX_DIR([config])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config/config.h])
AX_PREFIX_CONFIG_H([magick/magick-baseconfig.h],[MagickCore])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([foreign no-define color-tests parallel-tests -Wall -Wno-portability subdir-objects dist-bzip2 dist-lzip dist-xz dist-zip tar-ustar])
AM_SILENT_RULES([yes])
AC_SUBST([CONFIGURE_DEPENDENCIES],["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/m4/version.m4"])
#
# Save initial user-tunable values
#
USER_LIBS=$LIBS
for var in CC CFLAGS CPPFLAGS CXX CXXCPP LDFLAGS AR_FLAGS LIBS ; do
eval isset=\${$var+set}
if test "$isset" = 'set'; then
eval val=$`echo $var`
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS}'${var}=${val}' "
fi
done
AC_SUBST([DISTCHECK_CONFIG_FLAGS])
CONFIGURE_ARGS="$0 ${ac_configure_args}"
AC_SUBST([CONFIGURE_ARGS])
echo "Configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
MAGICK_TARGET_CPU=$host_cpu
AC_SUBST([MAGICK_TARGET_CPU])
AC_DEFINE_UNQUOTED([MAGICK_TARGET_CPU],[$MAGICK_TARGET_CPU],[Target Host CPU])
MAGICK_TARGET_VENDOR=$host_vendor
AC_SUBST([MAGICK_TARGET_VENDOR])
AC_DEFINE_UNQUOTED([MAGICK_TARGET_VENDOR],[$MAGICK_TARGET_VENDOR],[Target Host Vendor])
MAGICK_TARGET_OS=$host_os
AC_SUBST([MAGICK_TARGET_OS])
AC_DEFINE_UNQUOTED([MAGICK_TARGET_OS],[$MAGICK_TARGET_OS],[Target Host OS])
# Substitute versioning
AC_SUBST([MAGICK_MAJOR_VERSION],[magick_major_version])
AC_SUBST([MAGICK_MINOR_VERSION],[magick_minor_version])
AC_SUBST([MAGICK_MICRO_VERSION],[magick_micro_version])
AC_SUBST([MAGICK_PATCHLEVEL_VERSION],[magick_patchlevel_version])
AC_SUBST([MAGICK_VERSION],[magick_version])
AC_SUBST([MAGICK_GIT_REVISION],[magick_git_revision])
# Substitute library versioning
AC_SUBST([MAGICK_LIBRARY_CURRENT],[magick_library_current])dnl
AC_SUBST([MAGICK_LIBRARY_REVISION],[magick_library_revision])dnl
AC_SUBST([MAGICK_LIBRARY_AGE],[magick_library_age])dnl
AC_SUBST([MAGICK_LIBRARY_CURRENT_MIN],
[`expr $MAGICK_LIBRARY_CURRENT - $MAGICK_LIBRARY_AGE`])
AC_SUBST([MAGICK_LIBRARY_VERSION_INFO],
[$MAGICK_LIBRARY_CURRENT:$MAGICK_LIBRARY_REVISION:$MAGICK_LIBRARY_AGE])
AC_SUBST([MAGICKPP_LIBRARY_CURRENT],[magickpp_library_current])dnl
AC_SUBST([MAGICKPP_LIBRARY_REVISION],[magickpp_library_revision])dnl
AC_SUBST([MAGICKPP_LIBRARY_AGE],[magickpp_library_age])dnl
AC_SUBST([MAGICKPP_LIBRARY_CURRENT_MIN],
[`expr $MAGICKPP_LIBRARY_CURRENT - $MAGICKPP_LIBRARY_AGE`])
AC_SUBST([MAGICKPP_LIBRARY_VERSION_INFO],
[$MAGICKPP_LIBRARY_CURRENT:$MAGICKPP_LIBRARY_REVISION:$MAGICKPP_LIBRARY_AGE])
AC_SUBST([PACKAGE_BASE_VERSION],[magick_base_version])
AC_SUBST([PACKAGE_PATCHLEVEL_VERSION],[magick_patchlevel_version])
if test "magick_is_beta" = 'y'; then
PACKAGE_VERSION_ADDENDUM='-magick_patchlevel_version (Beta)'
else
PACKAGE_VERSION_ADDENDUM=-magick_patchlevel_version
fi
AC_SUBST([PACKAGE_VERSION_ADDENDUM])
AC_SUBST([PACKAGE_LIB_VERSION],[magick_lib_version])
AC_SUBST([PACKAGE_LIB_VERSION_NUMBER],[magick_lib_version_number])
AC_SUBST([PACKAGE_RELEASE_DATE],[magick_release_date])
# Ensure that make can run correctly
AM_SANITY_CHECK
# versioning of library
MAGICK_LIB_VERSION="0x"
if test ${MAGICK_LIBRARY_CURRENT} -lt 10 ; then
MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
fi
MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_CURRENT}
if test ${MAGICK_LIBRARY_AGE} -lt 10 ; then
MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
fi
MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_AGE}
if test ${MAGICK_LIBRARY_REVISION} -lt 10 ; then
MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
fi
MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_REVISION}
AC_SUBST([MAGICK_LIB_VERSION])
# Definition used to define MagickLibVersionText in version.h
MAGICK_LIB_VERSION_TEXT="${PACKAGE_BASE_VERSION}"
AC_SUBST([MAGICK_LIB_VERSION_TEXT])
# Definition used to define MagickLibVersionNumber in version.h
MAGICK_LIB_VERSION_NUMBER="${MAGICK_LIBRARY_CURRENT},${MAGICK_LIBRARY_AGE},${MAGICK_LIBRARY_REVISION}"
AC_SUBST([MAGICK_LIB_VERSION_NUMBER])
MAGICKPP_LIB_VERSION="0x"
if test ${MAGICKPP_LIBRARY_CURRENT} -lt 10 ; then
MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}0
fi
MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}${MAGICKPP_LIBRARY_CURRENT}
if test ${MAGICKPP_LIBRARY_AGE} -lt 10 ; then
MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}0
fi
MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}${MAGICKPP_LIBRARY_AGE}
if test ${MAGICKPP_LIBRARY_REVISION} -lt 10 ; then
MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}0
fi
MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}${MAGICKPP_LIBRARY_REVISION}
AC_SUBST([MAGICKPP_LIB_VERSION])
# Definition used to define MagickLibVersionText in version.h
MAGICKPP_LIB_VERSION_TEXT="${PACKAGE_BASE_VERSION}"
AC_SUBST([MAGICKPP_LIB_VERSION_TEXT])
# Definition used to define MagickLibVersionNumber in version.h
MAGICK_LIB_VERSION_NUMBER="${MAGICK_LIBRARY_CURRENT},${MAGICK_LIBRARY_AGE},${MAGICK_LIBRARY_REVISION}"
AC_SUBST([MAGICK_LIB_VERSION_NUMBER])
PERLMAINCC=$CC
MAGICK_CFLAGS=''
MAGICK_CPPFLAGS=$CPPFLAGS_USER
MAGICK_PCFLAGS=$CPPFLAGS_USER
MAGICK_LDFLAGS=''
MAGICK_LIBS=''
MAGICK_FEATURES=''
#
# Evaluate shell variable equivalents to Makefile directory variables
#
if test "x$prefix" = xNONE; then
prefix=$ac_default_prefix
fi
# Let make expand exec_prefix.
if test "x$exec_prefix" = xNONE; then
exec_prefix='${prefix}'
fi
#
eval "eval PREFIX_DIR=${prefix}"
AC_SUBST([PREFIX_DIR])
eval "eval EXEC_PREFIX_DIR=${exec_prefix}"
AC_SUBST([EXEC_PREFIX_DIR])
eval "eval BIN_DIR=$bindir"
AC_SUBST([BIN_DIR])
eval "eval SBIN_DIR=$sbindir"
AC_SUBST([SBIN_DIR])
eval "eval LIBEXEC_DIR=$libexecdir"
AC_SUBST([LIBEXEC_DIR])
eval "eval DATA_DIR=$datadir"
AC_SUBST([DATA_DIR])
eval "eval DOC_DIR=$datadir/doc"
AC_SUBST([DOC_DIR])
eval "eval SYSCONF_DIR=$sysconfdir"
AC_SUBST([SYSCONF_DIR])
eval "eval SHAREDSTATE_DIR=$sharedstatedir"
AC_SUBST([SHAREDSTATE_DIR])
eval "eval LOCALSTATE_DIR=$localstatedir"
AC_SUBST([LOCALSTATE_DIR])
eval "eval LIB_DIR=$libdir"
AC_SUBST([LIB_DIR])
eval "eval INCLUDE_DIR=$includedir"
AC_SUBST([INCLUDE_DIR])
eval "eval PERSISTINCLUDE_DIR=$oldincludedir"
AC_SUBST([PERSISTINCLUDE_DIR])
eval "eval INFO_DIR=$infodir"
AC_SUBST([INFO_DIR])
eval "eval MAN_DIR=$mandir"
AC_SUBST([MAN_DIR])
# Get full paths to source and build directories
srcdirfull="`cd $srcdir && pwd`"
builddir="`pwd`"
#
# Compute variables useful for running uninstalled software.
#
MAGICK_CODER_MODULE_PATH="${builddir}/coders"
MAGICK_CONFIGURE_SRC_PATH="${srcdirfull}/config"
MAGICK_CONFIGURE_BUILD_PATH="${builddir}/config"
MAGICK_FILTER_MODULE_PATH="${builddir}/filters"
DIRSEP=':'
case "${build_os}" in
mingw* )
MAGICK_CODER_MODULE_PATH=`$WinPathScript "${MAGICK_CODER_MODULE_PATH}" 0`
MAGICK_CONFIGURE_SRC_PATH=`$WinPathScript "${MAGICK_CONFIGURE_SRC_PATH}" 0`
MAGICK_CONFIGURE_BUILD_PATH=`$WinPathScript "${MAGICK_CONFIGURE_BUILD_PATH}" 0`
MAGICK_FILTER_MODULE_PATH=`$WinPathScript "${MAGICK_FILTER_MODULE_PATH}" 0`
DIRSEP=';'
;;
esac
case "${host_os}" in
mingw* )
DIRSEP=';'
;;
esac
AC_SUBST([MAGICK_CODER_MODULE_PATH])
AC_SUBST([MAGICK_CONFIGURE_SRC_PATH])
AC_SUBST([MAGICK_CONFIGURE_BUILD_PATH])
AC_SUBST([MAGICK_FILTER_MODULE_PATH])
AC_SUBST([DIRSEP])
#
# Enable OS features.
#
AC_USE_SYSTEM_EXTENSIONS
# ==============================================================================
# Find required base packages
# ==============================================================================
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_CC
AC_PROG_CPP
LT_PATH_LD
AC_SUBST([LD])
AM_PROG_CC_C_O
AX_CFLAGS_WARN_ALL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_PROG_SED
AC_PROG_AWK
AC_PROG_MKDIR_P
AM_WITH_DMALLOC
AX_C___ATTRIBUTE__
AX_GCC_ARCHFLAG([yes])
PKG_PROG_PKG_CONFIG([0.20])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AX_COMPILER_VENDOR
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -fexceptions"
touch local.exp
else
cat > local.exp <<EOF
set CC_FOR_TARGET "$CC"
EOF
fi
# Check for linker script support
gl_LD_VERSION_SCRIPT
#
# Enable run-time checking.
#
AC_ARG_ENABLE([bounds-checking],
[AS_HELP_STRING([--enable-bounds-checking],
[enable run-time bounds-checking])],
[enable_bounds_checking=$enableval],
[enable_bounds_checking='no'])
if test "$enable_bounds_checking" = yes; then
AC_DEFINE([_FORTIFY_SOURCE], [2],
[enable run-time bounds-checking])
fi
#
# Tests for Windows
#
AC_EXEEXT
AC_OBJEXT
native_win32_build='no'
cygwin_build='no'
case "${host_os}" in
cygwin* )
cygwin_build='yes'
;;
mingw* )
native_win32_build='yes'
;;
esac
AM_CONDITIONAL([WIN32_NATIVE_BUILD],[test "${native_win32_build}" = 'yes'])
AM_CONDITIONAL([CYGWIN_BUILD],[test "${cygwin_build}" = 'yes'])
WinPathScript="${srcdirfull}/winpath.sh"
AC_SUBST([WinPathScript])
#
# Compiler flags tweaks
#
if test "${GCC}" != "yes"; then
case "${host}" in
*-*-hpux* )
# aCC: HP ANSI C++ B3910B A.03.34
CFLAGS="${CFLAGS} -Wp,-H30000"
if test -n "${CXXFLAGS}"; then
CXXFLAGS='-AA'
else
CXXFLAGS="${CXXFLAGS} -AA"
fi
;;
*-dec-osf5.* )
# Compaq alphaev68-dec-osf5.1 compiler
if test -n "${CXXFLAGS}"; then
CXXFLAGS='-std strict_ansi -noimplicit_include'
else
CXXFLAGS="${CXXFLAGS} -std strict_ansi -noimplicit_include"
fi
esac
fi
# Check for lazy-loading.
AC_CACHE_CHECK([for linker lazyload option],[im_cv_ld_lazyload],
[
im_cv_ld_lazyload='none'
case "${host}" in
*-*-solaris2.8 | *-*-solaris2.9 | *-*-solaris2.1? )
if test "$lt_cv_prog_gnu_ld" != 'yes' ; then
im_cv_ld_lazyload='-Wl,-zlazyload'
fi
;;
esac
])
if test "${im_cv_ld_lazyload}" != 'none' ; then
if test -z "${LDFLAGS}" ; then
LDFLAGS="${im_cv_ld_lazyload}"
else
LDFLAGS="${im_cv_ld_lazyload} ${LDFLAGS}"
fi
fi
dnl Platform-specific stuff
case "$host" in
*darwin* | *-macos10*)
dnl Disable FORTIFY_SOURCE to fix a bug in LVVM / OpenMP support
CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=0"
dnl OS X universal binary support, requires --disable-dependency-tracking
AC_ARG_ENABLE([osx-universal-binary],
AS_HELP_STRING([--enable-osx-universal-binary],
[build universal binary on OS X [[default=no]]]),
[build_osxuniversal="${enableval}"], [build_osxuniversal=no])
if test "${build_osxuniversal}" != no ; then
if test "$enable_dependency_tracking" != no ; then
AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
Re-run configure with these options:
--disable-dependency-tracking --enable-osx-universal-binary
])
fi
CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
fi
;;
esac
#
# ARCH specific include directory
#
AC_ARG_WITH([includearch-dir],
[AS_HELP_STRING([--includearch-dir=DIR],
[ARCH specific include directory])],
[includearch_dir=$withval],
[includearch_dir=$INCLUDE_DIR])
eval "eval INCLUDEARCH_DIR=$includearch_dir"
AC_SUBST([INCLUDEARCH_DIR])
#
# ARCH specific configuration directory
#
AC_ARG_WITH([sharearch-dir],
[AS_HELP_STRING([--sharearch-dir=DIR],
[ARCH specific config directory])],
[sharearch_dir=$withval],
[sharearch_dir="${LIB_DIR}"])
eval "eval SHAREARCH_DIR=$sharearch_dir"
AC_SUBST([SHAREARCH_DIR])
# Path to the pkgconfig folder
AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=DIR],
[Path to the pkgconfig directory @<:@LIBDIR/pkgconfig@:>@]),
[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
AC_SUBST([pkgconfigdir])
#
# Enable support for POSIX thread APIs
#
AC_ARG_WITH([threads],
[AS_HELP_STRING([--without-threads], [disable POSIX threads API support])],
[with_threads=$withval],
[with_threads='yes'])
THREAD_LIBS=''
have_threads=no
if test "$with_threads" != 'no'; then
AX_PTHREAD()
if test "$ax_pthread_ok" = yes; then
have_threads=yes
DEF_THREAD="$PTHREAD_CFLAGS"
CFLAGS="$CFLAGS $DEF_THREAD"
CXXFLAGS="$CXXFLAGS $DEF_THREAD"
THREAD_LIBS="$PTHREAD_LIBS"
if test "$CC" != "$PTHREAD_CC"; then
AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
CC="$PTHREAD_CC"
fi
AC_DEFINE([THREAD_SUPPORT],[1],[Define if you have POSIX threads libraries and header files.])
fi
fi
LIBS="$LIBS $THREAD_LIBS"
AC_SUBST([THREAD_LIBS])
# Enable support for OpenMP
if test "$have_threads" != 'yes'; then
ac_cv_prog_c_openmp=unsupported
fi
AC_OPENMP([C])
CFLAGS="$OPENMP_CFLAGS $CFLAGS"
MAGICK_PCFLAGS="$MAGICK_PCFLAGS $OPENMP_CFLAGS"
AC_SUBST([OPENMP_CFLAGS])
AC_CHECK_DECL([_OPENMP],[OPENMP_ENABLED='yes'],[OPENMP_ENABLED='no'],[])
if test "${OPENMP_ENABLED}" = 'yes' && \
test "$ac_cv_prog_c_openmp" != 'unsupported'; then
MAGICK_FEATURES="OpenMP $MAGICK_FEATURES"
fi
# Enable support for OpenCL
no_cl=yes
AX_HAVE_OPENCL([C])
if test "X$no_cl" != 'Xyes'; then
CPPFLAGS="$CL_CPPFLAGS $CPPFLAGS"
MAGICK_FEATURES="OpenCL $MAGICK_FEATURES"
fi
########
#
# Check for large file support
#
########
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
LFS_CPPFLAGS=''
if test "$enable_largefile" != no; then
case $ac_cv_sys_file_offset_bits in
no)
# nothing to do here as the host supports LFS fine
;;
unknown)
AC_MSG_CHECKING([for native large file support])
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>
#include <stdlib.h>
int main () {
exit(!(sizeof(off_t) == 8));
}])],
[ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
;;
*)
if test "$ac_cv_sys_file_offset_bits" = ''; then
ac_cv_sys_file_offset_bits=64;
fi
LFS_CPPFLAGS="$LFS_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
;;
esac
if test "$ac_cv_sys_large_files" != 'no'; then
LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGE_FILES=1"
fi
if test "$ac_cv_sys_largefile_source" != 'no'; then
LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGEFILE_SOURCE=1"
fi
fi
AC_SUBST([LFS_CPPFLAGS])
#
# Check for sendfile support
#
########
AC_CACHE_CHECK([Linux compatible sendfile()],ac_cv_have_linux_sendfile,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#undef _FILE_OFFSET_BITS
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sendfile.h>
], [
sendfile(0, 0, (void *) 0, 0);
])], [
ac_cv_have_linux_sendfile=yes
], [
ac_cv_have_linux_sendfile=no
])])
if test "$ac_cv_have_linux_sendfile" = 'yes'; then
AC_DEFINE([HAVE_LINUX_SENDFILE],[1], [Define if you have Linux-compatible sendfile()])
fi
#
# Set SETJMP_IS_THREAD_SAFE define.
#
case "${host_os}" in
solaris2* ) ;;
*) AC_DEFINE([SETJMP_IS_THREAD_SAFE],[1],[Setjmp/longjmp are thread safe]) ;;
esac
# Configure libtool
: ${AR_FLAGS=cr}
LT_INIT([win32-dll dlopen])
LT_LANG([C++])
AC_SUBST([LIBTOOL_DEPS])
# Check to see if building shared libraries
libtool_build_shared_libs='no'
if test "$enable_shared" = 'yes'; then
libtool_build_shared_libs='yes'
fi
# Check to see if building static libraries
libtool_build_static_libs='no'
if test "$enable_static" = 'yes'; then
libtool_build_static_libs='yes'
fi
AM_CONDITIONAL([WITH_SHARED_LIBS],[test "${libtool_build_shared_libs}" = 'yes'])
#
# Enable support for building loadable modules
#
build_modules='no'
AC_ARG_WITH([modules],
[AS_HELP_STRING([--with-modules],
[enable building dynamically loadable modules])],
[with_modules=$withval],
[with_modules='no'])
# Only allow building loadable modules if we are building shared libraries
if test "$with_modules" != 'no' ; then
if test "$libtool_build_shared_libs" = 'no'; then
AC_MSG_WARN([Modules may only be built if building shared libraries is enabled.])
build_modules='no'
else
build_modules='yes'
fi
fi
if test "$build_modules" != 'no' ; then
AC_DEFINE([BUILD_MODULES],[1],[Define if coders and filters are to be built as modules.])
MAGICK_FEATURES="$MAGICK_FEATURES Modules"
fi
AM_CONDITIONAL([WITH_MODULES],[test "$build_modules" != 'no'])
# Enable build using delegate libraries built in subdirectories rather than installed
# delegate libraries (bzlib fftw fpx gslib jp2 jbig jpeg lcms lzma png tiff ttf wmf xml zlib)
AC_ARG_ENABLE([delegate-build],
[AS_HELP_STRING([--enable-delegate-build],
[look for delegate libraries in build directory])],
[enable_delegate_build=$enableval],
[enable_delegate_build='no'])
AC_ARG_ENABLE([deprecated],
[AS_HELP_STRING([--disable-deprecated],
[exclude deprecated methods in MagickCore and MagickWand APIs])],
[enable_deprecated=$enableval],
[enable_deprecated='no'])
if test "$enable_deprecated" = 'yes'; then
AC_DEFINE([EXCLUDE_DEPRECATED],[1],[exclude deprecated methods in MagickCore API])
else
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-deprecated "
fi
# Build a version of ImageMagick which operates uninstalled.
# Used to build distributions located via MAGICK_HOME / executable path
AC_ARG_ENABLE([installed],
[AS_HELP_STRING([--disable-installed],
[Formally install ImageMagick under PREFIX])],
[enable_installed=$enableval],
[enable_installed='yes'])
if test "$enable_installed" = 'yes'; then
AC_DEFINE([INSTALLED_SUPPORT],[1],[ImageMagick is formally installed under prefix])
else
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-installed "
fi
# Build a zero-configuration version of ImageMagick.
AC_ARG_ENABLE([zero-configuration],
[AS_HELP_STRING([--enable-zero-configuration],
[enable self-contained, embeddable, zero-configuration ImageMagick])],
[enable_zero_configuration=$enableval],
[enable_zero_configuration='no'])
if test "$enable_zero_configuration" = 'yes'; then
AC_DEFINE([ZERO_CONFIGURATION_SUPPORT],[1],[Build self-contained, embeddable, zero-configuration ImageMagick])
MAGICK_FEATURES="Zero-configuration $MAGICK_FEATURES"
fi
AM_CONDITIONAL([MAGICKCORE_ZERO_CONFIGURATION_SUPPORT],[test "$enable_zero_configuration" = yes])
# Build a high dynamic range version of ImageMagick.
AC_ARG_ENABLE([hdri],
[AS_HELP_STRING([--enable-hdri],
[accurately represent the wide range of intensity levels found in real scenes])],
[enable_hdri=$enableval],
[enable_hdri='no'])
MAGICK_HDRI=""
if test "$enable_hdri" = 'yes'; then
MAGICK_HDRI="HDRI"
magick_hdri_enable='1';
MAGICK_FEATURES="HDRI $MAGICK_FEATURES"
else
magick_hdri_enable='0'
fi
AC_DEFINE_UNQUOTED([HDRI_ENABLE_OBSOLETE_IN_H],[$magick_hdri_enable],[Whether hdri is enabled or not])
AC_SUBST([MAGICK_HDRI])dnl
MAGICK_PCFLAGS="$MAGICK_PCFLAGS -DMAGICKCORE_HDRI_ENABLE=$magick_hdri_enable"
CFLAGS="$CFLAGS -DMAGICKCORE_HDRI_ENABLE=$magick_hdri_enable"
CPPFLAGS="$CPPFLAGS -DMAGICKCORE_HDRI_ENABLE=$magick_hdri_enable"
# Enable pipes (|) in filenames.
AC_ARG_ENABLE([pipes],
[AS_HELP_STRING([--enable-pipes],
[enable pipes (|) in filenames. Be sure to properly validate and sanitize user input to prevent malicious behaviors.])],
[enable_pipes=$enableval],
[enable_pipes='no'])
if test "$enable_pipes" = 'yes'; then
AC_DEFINE([PIPES_SUPPORT],[1],[enable pipes (|) in filenames])
MAGICK_FEATURES="Pipes $MAGICK_FEATURES"
fi
# Don't emit "rebuild rules" for configure, Makefile.ins, etc.
AM_MAINTAINER_MODE
# Enable hugepages support
AC_ARG_ENABLE([hugepages],
[AS_HELP_STRING([--enable-hugepages],
[enable 'huge pages' support])],
[enable_hugepages=$enableval],
[enable_hugepages='no'])
# Enable ccmalloc memory debugging support
AC_ARG_ENABLE([ccmalloc],
[AS_HELP_STRING([--enable-ccmalloc],
[enable 'ccmalloc' memory debug support])],
[enable_ccmalloc=$enableval],
[enable_ccmalloc='no'])
# Enable Electric Fence memory debugging support
AC_ARG_ENABLE([efence],
[AS_HELP_STRING([--enable-efence],
[enable 'efence' memory debug support])],
[enable_efence=$enableval],
[enable_efence='no'])
# Enable prof-based profiling support
AC_ARG_ENABLE([prof],
[AS_HELP_STRING([--enable-prof],
[enable 'prof' profiling support])],
[enable_prof=$enableval],
[enable_prof='no'])
# Enable gprof-based profiling support
AC_ARG_ENABLE([gprof],
[AS_HELP_STRING([--enable-gprof],
[enable 'gprof' profiling support])],
[enable_gprof=$enableval],
[enable_gprof='no'])
# Enable gcov-based profiling support
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[enable 'gcov' profiling support])],
[enable_gcov=$enableval],
[enable_gcov='no'])
enable_profiling='no'
if test "$enable_prof" = 'yes' || test "$enable_gprof" = 'yes' || test "$enable_gcov" = 'yes'; then
enable_profiling='yes'
if test "$libtool_build_shared_libs" = 'yes'; then
echo "Warning: Can not profile code using shared libraries"
fi
fi
# Magick API method prefix
AC_ARG_WITH([method-prefix],
[AS_HELP_STRING([--with-method-prefix=PREFIX],
[prefix MagickCore API methods])],
[with_method_prefix=$withval],
[with_method_prefix='no'])
if test "$with_method_prefix" != 'no'; then
AC_DEFINE_UNQUOTED([NAMESPACE_PREFIX],[$with_method_prefix],[Magick API method prefix])
AC_DEFINE_UNQUOTED([NAMESPACE_PREFIX_TAG],[$with_method_prefix],[Magick API method prefix tag])
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-method-prefix "
fi
# Enable legacy support (default no)
AC_ARG_ENABLE([legacy-support],
[ --enable-legacy-support install legacy command-line utilities (default disabled)],
[with_legacy_support=$enableval],
[with_legacy_support='no'])
AM_CONDITIONAL([LEGACY_SUPPORT],[test "$with_legacy_support" != 'no'])
# Number of bits in a Quantum
AC_ARG_WITH([quantum-depth],
[AS_HELP_STRING([--with-quantum-depth=DEPTH],
[number of bits in a pixel quantum (default 16)])],
[with_quantum_depth=$withval],
[with_quantum_depth=16])
if test "$with_quantum_depth" != '8'; then
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-quantum-depth=$with_quantum_depth "
fi
case "${with_quantum_depth}" in
8 ) ;;
16 ) ;;
32 ) ;;
64 ) ;;
* ) AC_MSG_ERROR("Pixel quantum depth must have value of 8, 16, 32, or 64") ;;
esac
QUANTUM_DEPTH="$with_quantum_depth"
AC_DEFINE_UNQUOTED([QUANTUM_DEPTH_OBSOLETE_IN_H],[$QUANTUM_DEPTH],[Number of bits in a pixel Quantum (8/16/32/64)])
AC_SUBST([QUANTUM_DEPTH])dnl
MAGICK_PCFLAGS="$MAGICK_PCFLAGS -DMAGICKCORE_QUANTUM_DEPTH=$QUANTUM_DEPTH"
CFLAGS="$CFLAGS -DMAGICKCORE_QUANTUM_DEPTH=$QUANTUM_DEPTH"
CPPFLAGS="$CPPFLAGS -DMAGICKCORE_QUANTUM_DEPTH=$QUANTUM_DEPTH"
# define a lib suffix for abi purpose
MAGICK_ABI_SUFFIX="Q${QUANTUM_DEPTH}"
if test "$enable_hdri" = 'yes'; then
MAGICK_ABI_SUFFIX="Q${QUANTUM_DEPTH}${MAGICK_HDRI}"
fi
AC_SUBST([MAGICK_ABI_SUFFIX])
# Set pixel cache threshold
AC_ARG_WITH([cache],
[AS_HELP_STRING([--with-cache=THRESHOLD],
[set pixel cache memory threshold (default available memory)])],
[with_cache=$withval],
[with_cache=''])
if test "$with_cache" != ''; then
AC_DEFINE_UNQUOTED([PixelCacheThreshold],["$with_cache"],[Pixel cache memory threshold (defaults to available memory)])
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-cache=$with_cache "
fi
# Set security policy
security_policy="open"
m4_define([_MAGICK_SECURITY_POLICY],
[m4_define([MAGICK_SECURITY_POLICY_DEFAULT], [m4_if($1, limited, limited, m4_if($1, secure, secure, open))])dnl
AC_MSG_CHECKING([which variant of security policy to enforce])
AC_ARG_WITH([security-policy],
[AS_HELP_STRING([--with-security-policy=open|limited|secure|websafe],
[security policy variant to enforce, @<:@default=]MAGICK_SECURITY_POLICY_DEFAULT[@:>@.])],
[case $withval in
open|limited|secure|websafe)
security_policy=$withval
;;
*)
AC_MSG_ERROR([Unknown argument to --with-security-policy])
;;
esac
magick_cv_with_security_policy=$security_policy],
[AC_CACHE_VAL([magick_cv_with_security_policy],
[magick_cv_with_security_policy=]MAGICK_SECURITY_POLICY_DEFAULT)
MAGICK_SECURITY_POLICY=$magick_cv_with_security_policy])
AC_MSG_RESULT([$security_policy])
]) # MAGICK_SECURITY_POLICY
_MAGICK_SECURITY_POLICY([open])
AC_SUBST([MAGICK_SECURITY_POLICY])
# Disable/Enable support for full delegate paths
AC_ARG_WITH([frozenpaths],
[AS_HELP_STRING([--with-frozenpaths],
[freeze delegate paths])],
[with_frozenpaths=$withval],
[with_frozenpaths='no'])
# Enable build/install of Magick++
AC_ARG_WITH([magick-plus-plus],
[AS_HELP_STRING([--without-magick-plus-plus],
[disable build/install of Magick++])],
[with_magick_plus_plus=$withval],
[with_magick_plus_plus='yes'])
# Encode the this name into the shared library.
AC_ARG_WITH([package-release-name],
[AS_HELP_STRING([--with-package-release-name=NAME],
[encode this name into the shared library])],
[MAGICK_LT_RELEASE_OPTS="-release $withval"])
AC_SUBST([MAGICK_LT_RELEASE_OPTS])
# Disable build/install of PerlMagick.
AC_ARG_WITH([perl],
[AS_HELP_STRING([--with-perl],
[enable build/install of PerlMagick])],
[with_perl=$withval],
[with_perl='no'])
# Options to pass when configuring PerlMagick
AC_ARG_WITH([perl-options],
[AS_HELP_STRING([--with-perl-options=OPTIONS],
[options to pass on command-line when generating PerlMagick build file])],
PERL_MAKE_OPTIONS=$withval)
AC_SUBST([PERL_MAKE_OPTIONS])
# Enable jemalloc, object-caching memory allocation library.
AC_ARG_WITH([jemalloc],
[ --with-jemalloc enable jemalloc memory allocation library support],
[with_jemalloc=$withval],
[with_jemalloc='no'])
if test "$with_jemalloc" != 'yes' ; then
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jemalloc=$with_jemalloc "
fi
# Enable use of MTMalloc library.
AC_ARG_WITH([mtmalloc],
AS_HELP_STRING([--with-mtmalloc],
[enable mtmalloc memory allocation library support]),
[with_mtmalloc=$withval],
[with_mtmalloc='no'])
if test "$with_mtmalloc" != 'no' ; then
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-mtmalloc=$with_mtmalloc "
fi
# Enable use of TCMalloc library.
AC_ARG_WITH([tcmalloc],
AS_HELP_STRING([--with-tcmalloc],
[enable tcmalloc memory allocation library support]),
[with_tcmalloc=$withval],
[with_tcmalloc='no'])
if test "$with_tcmalloc" != 'no' ; then
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-tcmalloc=$with_tcmalloc "
fi
# Enable umem, object-caching memory allocation library.
AC_ARG_WITH([umem],
[ --with-umem enable umem memory allocation library support],
[with_umem=$withval],
[with_umem='no'])
if test "$with_umem" != 'yes' ; then
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-umem=$with_umem "
fi
#
# Specify path to shared libstdc++ if not in normal location
#
AC_ARG_WITH([libstdc],
[AS_HELP_STRING([--with-libstdc=DIR],
[ use libstdc++ in DIR (for GNU C++)])],
[with_libstdc=$withval],
[with_libstdc=''])
if test "$with_libstdc" != ''; then
if test -d "$with_libstdc"; then
LIBSTDCLDFLAGS="-L$with_libstdc"
fi
fi
AC_SUBST([LIBSTDCLDFLAGS])
########
#
# Set defines required to build DLLs and modules using MinGW
#
########
# These options are set for multi-thread DLL module build
# libMagickCore: _DLL _MAGICKMOD_ _MAGICKLIB_
# module: _DLL
# executable/Magick++: _DLL _MAGICKMOD_
MODULE_EXTRA_CPPFLAGS=''
LIBRARY_EXTRA_CPPFLAGS=''
if test "${native_win32_build}" = 'yes'; then
MAGICK_LDFLAGS="$MAGICK_LDFLAGS -municode"
if test "${libtool_build_shared_libs}" = 'yes'; then
CPPFLAGS="$CPPFLAGS -D_DLL"
MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_DLL"
MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_DLL"
LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKLIB_"
if test "$build_modules" = 'yes'; then
LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKMOD_"
else
MODULE_EXTRA_CPPFLAGS="$MODULE_EXTRA_CPPFLAGS -D_MAGICKLIB_"
fi
else
CPPFLAGS="$CPPFLAGS -D_LIB"
MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_LIB"
MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_LIB"
fi
if test "$with_threads" = 'yes'; then
CPPFLAGS="$CPPFLAGS -D_MT"
MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_MT"
MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_MT"
fi
fi
AC_SUBST([MODULE_EXTRA_CPPFLAGS])
AC_SUBST([LIBRARY_EXTRA_CPPFLAGS])
# Check standard headers
AC_HEADER_ASSERT
AC_HEADER_DIRENT
# Check additional headers
AC_CHECK_HEADERS(arm/limits.h arpa/inet.h complex.h errno.h fcntl.h float.h inttypes.h limits.h linux/unistd.h locale.h malloc.h machine/param.h mach-o/dyld.h netdb.h netinet/in.h OS.h process.h stddef.h stdint.h sun_prefetch.h stdarg.h strings.h sys/ipc.h sys/mman.h sys/resource.h sys/sendfile.h sys/socket.h sys/syslimits.h sys/time.h sys/times.h sys/uio.h sys/wait.h unistd.h utime.h wchar.h xlocale.h)
########
#
# Checks for typedefs, structures, and compiler characteristics.
#
########
AC_HEADER_STDBOOL
AC_C_VOLATILE
AC_C_STRINGIZE
AC_HEADER_STAT
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_SYS_INTERPRETER
#
# Checks for language qualifiers and semantics.
#
AC_C_CHAR_UNSIGNED
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_C_VOLATILE
# If words are stored with the most significant byte first (like
# Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
AC_C_BIGENDIAN
# Define to a suitable type, if standard headers do not define it.
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INTMAX_T
AC_TYPE_INTPTR_T
AC_TYPE_MBSTATE_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT8_T