-
Notifications
You must be signed in to change notification settings - Fork 12
/
configure.ac
5838 lines (4655 loc) · 196 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
dnl ***************************************************************************
dnl $Id$
dnl
dnl Project: GDAL
dnl Purpose: Configure source file.
dnl Author: Frank Warmerdam, [email protected]
dnl
dnl ***************************************************************************
dnl Copyright (c) 2000, Frank Warmerdam
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, including without limitation
dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
dnl and/or sell copies of the Software, and to permit persons to whom the
dnl Software is furnished to do so, subject to the following conditions:
dnl
dnl The above copyright notice and this permission notice shall be included
dnl in all copies or substantial portions of the Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dnl DEALINGS IN THE SOFTWARE.
dnl ***************************************************************************
dnl Disable configure caching ... it causes lots of hassles.
define([AC_CACHE_LOAD], )
define([AC_CACHE_SAVE], )
dnl Process this file with autoconf to produce a configure script.
AC_INIT(GDALmake.opt.in)
AC_CONFIG_MACRO_DIR(m4)
AC_CONFIG_HEADERS([port/cpl_config.h:port/cpl_config.h.in])
AH_BOTTOM([#include "cpl_config_extras.h"])
dnl We require autoconf 2.52+ for libtool support on cygwin/mingw hosts
AC_PREREQ(2.52)
dnl Compute the canonical host-system (the system we are building for)
dnl type variable $host
AC_CANONICAL_HOST
dnl Enable as much warnings as possible
AX_CFLAGS_WARN_ALL(C_WFLAGS)
AX_CXXFLAGS_WARN_ALL(CXX_WFLAGS)
dnl For ICC: it needs -we10006 instead of -Werror to turn unknown options to errors
dnl Some gcc/clang versions might succeed on this test, so also include -Werror in ERROR_ON_UNKNOWN_OPTIONS
AX_CHECK_COMPILE_FLAG([-Werror -we10006],[ERROR_ON_UNKNOWN_OPTIONS="-Werror -we10006"],[ERROR_ON_UNKNOWN_OPTIONS="-Werror"])
dnl A few ICC warnings to turn off
dnl warning #188: enumerated type mixed with another type (needed on libcsf)
dnl warning #1684: conversion from pointer to same-sized integral type (potential portability problem) (needed on frmts/mrf)
dnl warning #2259: non-pointer conversion from "size_t={unsigned long}" to "int" may lose significant bits
dnl warning #2304: non-explicit constructor with single argument may cause implicit type conversion
dnl warning #3280: declaration hides member
dnl remark #11074: Inlining inhibited by limit max-size
dnl remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo
AX_CHECK_COMPILE_FLAG([-diag-disable 188,1684,2259,2304,3280,11074,11076],[C_WFLAGS="$C_WFLAGS -diag-disable 188,1684,2259,2304,3280,11074,11076" CXX_WFLAGS="$CXX_WFLAGS -diag-disable 188,1684,2259,2304,3280,11074,11076"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wextra],[C_WFLAGS="$C_WFLAGS -Wextra" CXX_WFLAGS="$CXX_WFLAGS -Wextra"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Winit-self],[C_WFLAGS="$C_WFLAGS -Winit-self" CXX_WFLAGS="$CXX_WFLAGS -Winit-self"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [C_WFLAGS="$C_WFLAGS -Wunused-parameter" CXX_WFLAGS="$CXX_WFLAGS -Wunused-parameter" NO_UNUSED_PARAMETER_FLAG="-Wno-unused-parameter"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [C_WFLAGS="$C_WFLAGS -Wmissing-prototypes"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [C_WFLAGS="$C_WFLAGS -Wmissing-declarations"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wformat], [C_WFLAGS="$C_WFLAGS -Wformat" CXX_WFLAGS="$CXX_WFLAGS -Wformat"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wformat -Werror=format-security -Wno-format-nonliteral], [C_WFLAGS="$C_WFLAGS -Werror=format-security -Wno-format-nonliteral" CXX_WFLAGS="$CXX_WFLAGS -Werror=format-security -Wno-format-nonliteral"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wshorten-64-to-32], [C_WFLAGS="$C_WFLAGS -Wshorten-64-to-32" CXX_WFLAGS="$CXX_WFLAGS -Wshorten-64-to-32"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wlogical-op], [C_WFLAGS="$C_WFLAGS -Wlogical-op" CXX_WFLAGS="$CXX_WFLAGS -Wlogical-op" NO_LOGICAL_OP_FLAG="-Wno-logical-op"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wshadow], [C_WFLAGS="$C_WFLAGS -Wshadow" CXX_WFLAGS="$CXX_WFLAGS -Wshadow"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl Error out on things that will fail with MSVC
AX_CHECK_COMPILE_FLAG([-Werror=vla], [C_WFLAGS="$C_WFLAGS -Werror=vla" CXX_WFLAGS="$CXX_WFLAGS -Werror=vla"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Werror=declaration-after-statement], [C_WFLAGS="$C_WFLAGS -Wdeclaration-after-statement"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl -Wclobbered is not reliable on most gcc versions
dnl AX_CHECK_COMPILE_FLAG([-Wno-clobbered], [C_WFLAGS="$C_WFLAGS -Wno-clobbered" CXX_WFLAGS="$CXX_WFLAGS -Wno-clobbered"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl Warn when macros __TIME__, __DATE__ or __TIMESTAMP__ are encountered as they might prevent bit-wise-identical reproducible compilations.
AX_CHECK_COMPILE_FLAG([-Wdate-time], [C_WFLAGS="$C_WFLAGS -Wdate-time" CXX_WFLAGS="$CXX_WFLAGS -Wdate-time"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl GCC 6 warnings
AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [C_WFLAGS="$C_WFLAGS -Wnull-dereference" CXX_WFLAGS="$CXX_WFLAGS -Wnull-dereference"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], [C_WFLAGS="$C_WFLAGS -Wduplicated-cond" CXX_WFLAGS="$CXX_WFLAGS -Wduplicated-cond"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl GCC 7 warnings
dnl Do not enable yet. Causes warning in alg/gdalthinplate.cpp due to armadillo templates
dnl AX_CHECK_COMPILE_FLAG([-Wduplicated-branches], [C_WFLAGS="$C_WFLAGS -Wduplicated-branches" CXX_WFLAGS="$CXX_WFLAGS -Wduplicated-branches"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl GCC 8 warnings
AC_LANG_PUSH([C++])
AX_CHECK_COMPILE_FLAG([-Wextra-semi], [CXX_WFLAGS="$CXX_WFLAGS -Wextra-semi"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AC_LANG_POP([C++])
AX_CHECK_COMPILE_FLAG([-Wno-sign-compare], [NO_SIGN_COMPARE="-Wno-sign-compare"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl clang >= 3.9
AX_CHECK_COMPILE_FLAG([-Wcomma], [C_WFLAGS="$C_WFLAGS -Wcomma" CXX_WFLAGS="$CXX_WFLAGS -Wcomma"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl clang and gcc 5
AX_CHECK_COMPILE_FLAG([-Wfloat-conversion], [C_WFLAGS="$C_WFLAGS -Wfloat-conversion" CXX_WFLAGS="$CXX_WFLAGS -Wfloat-conversion"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl clang >= 3.2
AX_CHECK_COMPILE_FLAG([-Wdocumentation -Wno-documentation-deprecated-sync], [C_WFLAGS="$C_WFLAGS -Wdocumentation -Wno-documentation-deprecated-sync" CXX_WFLAGS="$CXX_WFLAGS -Wdocumentation -Wno-documentation-deprecated-sync"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl C++ specific stuff
AC_LANG_PUSH([C++])
AX_CHECK_COMPILE_FLAG([-Wunused-private-field], [CXX_WFLAGS="$CXX_WFLAGS -Wunused-private-field"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CXX_WFLAGS="$CXX_WFLAGS -Wmissing-prototypes"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CXX_WFLAGS="$CXX_WFLAGS -Wmissing-declarations"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AX_CHECK_COMPILE_FLAG([-Wnon-virtual-dtor], [CXX_WFLAGS="$CXX_WFLAGS -Wnon-virtual-dtor" NO_NON_VIRTUAL_DTOR_FLAG="-Wno-non-virtual-dtor"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl Clang enables -Woverloaded-virtual if -Wall is defined, but not GCC
AX_CHECK_COMPILE_FLAG([-Woverloaded-virtual], [CXX_WFLAGS="$CXX_WFLAGS -Woverloaded-virtual"],,[$ERROR_ON_UNKNOWN_OPTIONS])
dnl Forbid use of 'or', 'and', ... alias operators
AX_CHECK_COMPILE_FLAG([-fno-operator-names], [CXX_WFLAGS="$CXX_WFLAGS -fno-operator-names"],,[$ERROR_ON_UNKNOWN_OPTIONS])
HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT=no
AX_CHECK_COMPILE_FLAG([-Wzero-as-null-pointer-constant], [CXX_WFLAGS="$CXX_WFLAGS -Wzero-as-null-pointer-constant" HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT=yes],,[$ERROR_ON_UNKNOWN_OPTIONS])
if test "$HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT" = "yes"; then
AC_DEFINE_UNQUOTED(HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT, 1,
[Define to 1 if the compiler supports -Wzero-as-null-pointer-constant])
fi
AC_LANG_POP([C++])
CXX14_SUPPORT=no
AC_ARG_WITH([cpp14],
AS_HELP_STRING([--with-cpp14],
[Enable C++14 compiler options]),,)
AC_MSG_CHECKING([if use C++14 compiler options])
if test "$with_cpp14" = "yes"; then
dnl Check C++ compiler compatibility with C++14
AC_MSG_CHECKING([C++ compiler compatibility with C++14])
AX_CXX_COMPILE_STDCXX([14],[noext],[optional])
if [test "$HAVE_CXX14" = "1"]; then
CXX14_SUPPORT=yes
fi
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled by user])
fi
AC_SUBST(CXX14_SUPPORT,$CXX14_SUPPORT)
if [test "$CXX14_SUPPORT" = "no"]; then
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
fi
dnl Available in GCC 5.1
AC_LANG_PUSH([C++])
AX_CHECK_COMPILE_FLAG([-Wsuggest-override], [CXX_WFLAGS="$CXX_WFLAGS -Wsuggest-override"],,[$ERROR_ON_UNKNOWN_OPTIONS])
AC_LANG_POP([C++])
dnl Enable -Wimplicit-fallthrough only if C++11 is enabled since CPL_FALLTHROUGH is only active then
AC_LANG_PUSH([C++])
SAVED_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wimplicit-fallthrough"
AC_MSG_CHECKING([if -Wimplicit-fallthrough can be enabled])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#if !(__cplusplus >= 201103L && ( (defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))) || ((defined(__GNUC__) && __GNUC__ >= 7)) ) )
#error "not (C++11 and (clang >= 3.7 or gcc >= 7))"
#endif]])],
[CXX_WFLAGS="$CXX_WFLAGS -Wimplicit-fallthrough"]
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
CXXFLAGS=$SAVED_CXXFLAGS
AC_LANG_POP([C++])
AC_SUBST(CXX_WFLAGS,$CXX_WFLAGS)
AC_SUBST(C_WFLAGS,$C_WFLAGS)
AC_SUBST(NO_UNUSED_PARAMETER_FLAG,$NO_UNUSED_PARAMETER_FLAG)
AC_SUBST(NO_SIGN_COMPARE,$NO_SIGN_COMPARE)
AC_SUBST(NO_NON_VIRTUAL_DTOR_FLAG,$NO_NON_VIRTUAL_DTOR_FLAG)
AC_SUBST(NO_LOGICAL_OP_FLAG,$NO_LOGICAL_OP_FLAG)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
dnl Check that CXX is really a working compiler
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#ifndef __cplusplus
#error "broken C++"
#endif]])],,
[CXX=;])
AC_LANG_POP([C++])
if test "x$CXX" = x ; then
AC_MSG_ERROR("You don't have a working C++ compiler.")
fi
AC_MSG_CHECKING([for std::isnan])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <cmath>
int CPLIsNan(float f) { return std::isnan(f); }]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_STD_IS_NAN, 1,
[Define to 1 if you have the `std::isnan' function.])
], [
AC_MSG_RESULT([no])
])
AC_LANG_POP([C++])
dnl switch between libtool and native build system
AC_ARG_WITH(libtool, [ --without-libtool Don't use libtool to build the library],,)
if test "$with_libtool" = "no"; then
AC_PROG_RANLIB
dnl AC_COMPILER_PIC as expanded by autoconf-2.68 doesn't work for the C++ part with clang++ 3.0 that doesn't like compiling .c programs
dnl so we inline the expanded code and fix it at hand.
dnl AC_COMPILER_PIC
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} $CFLAGS -fPIC -c conftest.c 2>&1`"; then
CFLAGS="$CFLAGS -fPIC"
fi
echo 'void f(){}' > conftest.cpp
if test -z "`${CXX-g++} $CXXFLAGS -fPIC -c conftest.cpp 2>&1`"; then
CXXFLAGS="$CXXFLAGS -fPIC"
fi
rm -f conftest*
AC_LD_SHARED
else
with_libtool=yes
fi
AC_SUBST(HAVE_LIBTOOL,$with_libtool)
dnl Checks for libraries.
AC_CHECK_LIB(dl,dlopen,,,)
dnl Needed on Solaris.
AC_CHECK_LIB(rt,nanosleep,,,)
dnl We don't need to add math library to all targets
case "${host_os}" in
cygwin* | mingw32* | pw32* | beos* | darwin*)
;;
*)
AC_CHECK_LIB(m,sin,,,)
;;
esac
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(assert.h fcntl.h unistd.h dbmalloc.h dlfcn.h stdint.h limits.h locale.h values.h float.h errno.h direct.h)
AC_C_BIGENDIAN
dnl Check for 64 bit file API
AC_HAVE_LONG_LONG
AC_UNIX_STDIO_64
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(void*)
dnl Some compilers (IBM VisualAge) has these types defined, so check it here.
dnl These types are used in internal libtiff.
AC_CHECK_TYPES([int8, int16, int32],,,
[
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
])
AC_CHECK_TYPES(uintptr_t)
dnl We need the following lines for libtiff too.
HAVE_IEEEFP=1
AC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format supported by the machine])
dnl Check the native cpu bit order (also libtiff stuff).
AC_MSG_CHECKING([native cpu bit order])
case "$host_cpu" in
i*86*|x86_64*)
HOST_FILLORDER=FILLORDER_LSB2MSB
AC_MSG_RESULT([lsb2msb])
;;
*)
HOST_FILLORDER=FILLORDER_MSB2LSB
AC_MSG_RESULT([msb2lsb])
;;
esac
AC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(snprintf vsnprintf)
AC_CHECK_FUNCS(atoll)
AC_CHECK_FUNCS(strtof)
AC_CHECK_FUNCS(getcwd)
dnl Check for declarations
AC_CHECK_DECLS(strtof)
AC_CHECK_FUNCS(readlink)
AC_CHECK_FUNCS(lstat)
AC_CHECK_FUNCS(posix_spawnp)
AC_CHECK_FUNCS(posix_memalign)
AC_CHECK_FUNCS(vfork)
AC_CHECK_FUNCS(mmap)
AC_CHECK_FUNCS(sigaction)
AC_CHECK_FUNCS(statvfs)
AC_CHECK_FUNCS(statvfs64)
dnl Make sure at least these are checked under C++. Prototypes missing on
dnl some platforms.
AC_LANG_PUSH(C++)
AC_CHECK_FUNC_CUSTOM(gmtime_r,[#include <time.h>],[time_t t; struct tm ltime; t = time(0); gmtime_r( &t, <ime );])
AC_CHECK_FUNC_CUSTOM(localtime_r,[#include <time.h>],[time_t t; struct tm ltime; t = time(0); localtime_r( &t, <ime );])
AC_LANG_POP(C++)
AC_MSG_CHECKING([for uselocale])
AC_LANG_PUSH(C++)
AC_TRY_COMPILE(
[
#define _XOPEN_SOURCE 700
#include <locale.h>
], [
locale_t alocale = newlocale (LC_NUMERIC_MASK, "C", 0);
locale_t oldlocale = uselocale(alocale);
uselocale(oldlocale);
freelocale(alocale);
return 0;
],
[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_USELOCALE, 1,
[Define to 1 if you have the `uselocale' function.])
], [
AC_MSG_RESULT([no])
])
AC_LANG_POP(C++)
OPT_GDAL_FORMATS=
EXTRA_INCLUDES=
dnl ---------------------------------------------------------------------------
dnl Check for --enable-debug
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING([to enable debug build])
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[enable debugging (disabled by default)]),
[HAVE_DEBUG=$enableval], [HAVE_DEBUG=yes])
CFLAGS_NOFTRAPV="$CFLAGS"
CXXFLAGS_NOFTRAPV="$CXXFLAGS"
if test "x$enable_debug" = "xyes" ; then
dnl Try to strip out optimization.
CXXFLAGS=`echo "$CXXFLAGS " | sed "s/-O2 //"`
CFLAGS=`echo "$CFLAGS " | sed "s/-O2 //"`
CXXFLAGS=`echo "$CXXFLAGS" | sed "s/-O //"`
CFLAGS=`echo "$CFLAGS" | sed "s/-O //"`
dnl remove existing -g to avoid duplicates.
CXXFLAGS=`echo "$CXXFLAGS" | sed "s/-g //"`
CFLAGS=`echo "$CFLAGS" | sed "s/-g //"`
dnl add -g and -DDEBUG
CXXFLAGS="$CXXFLAGS -g -DDEBUG"
CFLAGS="$CFLAGS -g -DDEBUG"
CFLAGS_NOFTRAPV="$CFLAGS"
CXXFLAGS_NOFTRAPV="$CXXFLAGS"
AC_MSG_RESULT([yes, modified CFLAGS="$CFLAGS"])
# Some clang version on 32 bits have linking error with 64bit operations (undefined reference to `__mulodi4')
AC_MSG_CHECKING([whether -ftrapv can be used])
rm -f testftrapv.c
echo 'int main(int argc, char** argv) { return (long long)argc * argc; } ' > testftrapv.c
if test -z "`${CC} ${CFLAGS} -ftrapv testftrapv.c -o testftrapv 2>&1`" ; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -ftrapv"
CXXFLAGS="$CXXFLAGS -ftrapv"
else
AC_MSG_RESULT([no])
fi
rm -f testftrapv.* testftrapv
else
AC_MSG_RESULT([no, CFLAGS="$CFLAGS"])
fi
AC_SUBST(CFLAGS_NOFTRAPV,$CFLAGS_NOFTRAPV)
AC_SUBST(CXXFLAGS_NOFTRAPV,$CXXFLAGS_NOFTRAPV)
dnl ---------------------------------------------------------------------------
dnl Check if GCC 4.1 atomic builtins are really available
dnl (some GCC versions are broken w.r.t this on some exotic architectures...)
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING([whether GCC 4.1 atomic builtins are available])
rm -f atomicbuiltins.c
echo 'int main(int argc, char** argv) { int i; __sync_add_and_fetch(&i, 1); __sync_sub_and_fetch(&i, 1); __sync_bool_compare_and_swap(&i, 0, 1); return 0; } ' > atomicbuiltins.c
if test -z "`${CC} ${CFLAGS} atomicbuiltins.c -o atomicbuiltins 2>&1`" ; then
HAVE_GCC_ATOMIC_BUILTINS=yes
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GCC_ATOMIC_BUILTINS,1, [Define to 1 if GCC atomic builtins are available])
else
HAVE_GCC_ATOMIC_BUILTINS=no
AC_MSG_RESULT([no])
fi
rm -rf atomicbuiltins.* atomicbuiltins
AC_SUBST(HAVE_GCC_ATOMIC_BUILTINS,$HAVE_GCC_ATOMIC_BUILTINS)
dnl ---------------------------------------------------------------------------
dnl Check if GCC bswap builtins are available
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING([whether GCC bswap builtins are available])
rm -f bswapbuiltins.c
echo '#include <x86intrin.h>' > bswapbuiltins.c
echo 'int main(int argc, char** argv) { (void)__builtin_bswap32(0); (void)__builtin_bswap64(0); return 0; } ' >> bswapbuiltins.c
if test -z "`${CC} ${CFLAGS} bswapbuiltins.c -o bswapbuiltins 2>&1`" ; then
HAVE_GCC_BSWAP=yes
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GCC_BSWAP,1, [Define to 1 if GCC bswap builtins are available])
else
HAVE_GCC_BSWAP=no
AC_MSG_RESULT([no])
fi
rm -rf bswapbuiltins.* bswapbuiltins
AC_SUBST(HAVE_GCC_BSWAP,$HAVE_GCC_BSWAP)
dnl ---------------------------------------------------------------------------
dnl Check if __uint128_t is available and usable
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING([for __uint128_t])
AC_TRY_COMPILE(
[
], [
unsigned long long v1 = 1024ULL;
unsigned long long v2 = 0x8000000000000000ULL;
__uint128_t u = ((__uint128_t)v1)*((__uint128_t)v2);
return u == 0;
],
[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_UINT128_T, 1,
[Define to 1 if the system has the type __uint128_t])
], [
AC_MSG_RESULT([no])
])
dnl ---------------------------------------------------------------------------
dnl Check SSE availability
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(sse,
[ --with-sse[=ARG] Detect SSE availability for some optimized routines (ARG=yes(default), no)],,)
AC_MSG_CHECKING([whether SSE is available at compile time])
if test "$with_sse" = "yes" -o "$with_sse" = ""; then
rm -f detectsse.cpp
echo '#ifdef __SSE__' > detectsse.cpp
echo '#include <xmmintrin.h>' >> detectsse.cpp
echo 'void foo() { float fEpsilon = 0.0000000000001f; __m128 xmm_small = _mm_load1_ps(&fEpsilon); } int main() { return 0; }' >> detectsse.cpp
echo '#else' >> detectsse.cpp
echo 'some_error' >> detectsse.cpp
echo '#endif' >> detectsse.cpp
if test -z "`${CXX} ${CXXFLAGS} -o detectsse detectsse.cpp 2>&1`" ; then
AC_MSG_RESULT([yes])
SSEFLAGS=""
HAVE_SSE_AT_COMPILE_TIME=yes
else
if test -z "`${CXX} ${CXXFLAGS} -msse -o detectsse detectsse.cpp 2>&1`" ; then
AC_MSG_RESULT([yes])
SSEFLAGS="-msse"
HAVE_SSE_AT_COMPILE_TIME=yes
else
AC_MSG_RESULT([no])
if test "$with_sse" = "yes"; then
AC_MSG_ERROR([--with-sse was requested, but SSE is not available])
fi
fi
fi
dnl On Solaris, the presence of SSE instructions is flagged in the binary
dnl and prevent it to run on non SSE hardware even if the instructions are
dnl not executed. So if the user did not explicitly requires SSE, test that
dnl we can run SSE binaries
if test "$HAVE_SSE_AT_COMPILE_TIME" = "yes"; then
case $host_os in
solaris*)
AC_MSG_CHECKING([whether SSE is available and needed at runtime])
if ./detectsse; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
if test "$with_sse" = "yes"; then
echo "Caution: the generated binaries will not run on this system."
else
echo "Disabling SSE as it is not explicitly required"
HAVE_SSE_AT_COMPILE_TIME=""
SSEFLAGS=""
fi
fi
;;
esac
fi
if test "$HAVE_SSE_AT_COMPILE_TIME" = "yes"; then
CFLAGS="-DHAVE_SSE_AT_COMPILE_TIME $CFLAGS"
CXXFLAGS="-DHAVE_SSE_AT_COMPILE_TIME $CXXFLAGS"
fi
rm -rf detectsse*
else
AC_MSG_RESULT([no])
fi
AC_SUBST(SSEFLAGS,$SSEFLAGS)
dnl ---------------------------------------------------------------------------
dnl Check SSSE3 availability
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(ssse3,
[ --with-ssse3[=ARG] Detect SSSE3 availability for some optimized routines (ARG=yes(default), no)],,)
AC_MSG_CHECKING([whether SSSE3 is available at compile time])
if test "$with_ssse3" = "yes" -o "$with_ssse3" = ""; then
rm -f detectssse3.cpp
echo '#ifdef __SSSE3__' > detectssse3.cpp
echo '#include <tmmintrin.h>' >> detectssse3.cpp
echo 'void foo() { __m128i xmm_i = _mm_set1_epi16(0); xmm_i = _mm_shuffle_epi8(xmm_i, xmm_i); } int main() { return 0; }' >> detectssse3.cpp
echo '#else' >> detectssse3.cpp
echo 'some_error' >> detectssse3.cpp
echo '#endif' >> detectssse3.cpp
if test -z "`${CXX} ${CXXFLAGS} -o detectssse3 detectssse3.cpp 2>&1`" ; then
AC_MSG_RESULT([yes])
SSSE3FLAGS=""
HAVE_SSSE3_AT_COMPILE_TIME=yes
else
if test -z "`${CXX} ${CXXFLAGS} -mssse3 -o detectssse3 detectssse3.cpp 2>&1`" ; then
AC_MSG_RESULT([yes])
SSSE3FLAGS="-mssse3"
HAVE_SSSE3_AT_COMPILE_TIME=yes
else
AC_MSG_RESULT([no])
if test "$with_ssse3" = "yes"; then
AC_MSG_ERROR([--with-ssse3 was requested, but SSSE3 is not available])
fi
fi
fi
dnl On Solaris, the presence of SSSE3 instructions is flagged in the binary
dnl and prevent it to run on non SSSE3 hardware even if the instructions are
dnl not executed. So if the user did not explicitly requires SSSE3, test that
dnl we can run SSSE3 binaries
if test "$HAVE_SSSE3_AT_COMPILE_TIME" = "yes"; then
case $host_os in
solaris*)
AC_MSG_CHECKING([whether SSSE3 is available and needed at runtime])
if ./detectssse3; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
if test "$with_ssse3" = "yes"; then
echo "Caution: the generated binaries will not run on this system."
else
echo "Disabling SSSE3 as it is not explicitly required"
HAVE_SSSE3_AT_COMPILE_TIME=""
SSSE3FLAGS=""
fi
fi
;;
esac
fi
if test "$HAVE_SSSE3_AT_COMPILE_TIME" = "yes"; then
CFLAGS="-DHAVE_SSSE3_AT_COMPILE_TIME $CFLAGS"
CXXFLAGS="-DHAVE_SSSE3_AT_COMPILE_TIME $CXXFLAGS"
fi
rm -rf detectssse3*
else
AC_MSG_RESULT([no])
fi
AC_SUBST(SSSE3FLAGS,$SSSE3FLAGS)
dnl ---------------------------------------------------------------------------
dnl Check AVX availability
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(avx,
[ --with-avx[=ARG] Detect AVX availability for some optimized routines (ARG=yes(default), no)],,)
AC_MSG_CHECKING([whether AVX is available at compile time])
if test "$with_avx" = "yes" -o "$with_avx" = ""; then
rm -f detectavx.cpp
echo '#ifdef __AVX__' > detectavx.cpp
echo '#include <immintrin.h>' >> detectavx.cpp
echo 'int foo() { unsigned int nXCRLow, nXCRHigh;' >> detectavx.cpp
echo '__asm__ ("xgetbv" : "=a" (nXCRLow), "=d" (nXCRHigh) : "c" (0));' >> detectavx.cpp
echo 'float fEpsilon = 0.0000000000001f;' >> detectavx.cpp
echo '__m256 ymm_small = _mm256_set_ps(fEpsilon,fEpsilon,fEpsilon,fEpsilon,fEpsilon,fEpsilon,fEpsilon,fEpsilon);' >> detectavx.cpp
echo 'return (int)nXCRLow + _mm256_movemask_ps(ymm_small); }' >> detectavx.cpp
echo 'int main(int argc, char**) { if( argc == 0 ) return foo(); return 0; }' >> detectavx.cpp
echo '#else' >> detectavx.cpp
echo 'some_error' >> detectavx.cpp
echo '#endif' >> detectavx.cpp
if test -z "`${CXX} ${CXXFLAGS} -o detectavx detectavx.cpp 2>&1`" ; then
AC_MSG_RESULT([yes])
AVXFLAGS=""
HAVE_AVX_AT_COMPILE_TIME=yes
else
if test -z "`${CXX} ${CXXFLAGS} -mavx -o detectavx detectavx.cpp 2>&1`" ; then
AC_MSG_RESULT([yes])
AVXFLAGS="-mavx"
HAVE_AVX_AT_COMPILE_TIME=yes
else
AC_MSG_RESULT([no])
if test "$with_avx" = "yes"; then
AC_MSG_ERROR([--with-avx was requested, but AVX is not available])
fi
fi
fi
dnl On Solaris, the presence of AVX instructions is flagged in the binary
dnl and prevent it to run on non AVX hardware even if the instructions are
dnl not executed. So if the user did not explicitly requires AVX, test that
dnl we can run AVX binaries
if test "$HAVE_AVX_AT_COMPILE_TIME" = "yes"; then
case $host_os in
solaris*)
AC_MSG_CHECKING([whether AVX is available and needed at runtime])
if ./detectavx; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
if test "$with_avx" = "yes"; then
echo "Caution: the generated binaries will not run on this system."
else
echo "Disabling AVX as it is not explicitly required"
AVXFLAGS=""
HAVE_AVX_AT_COMPILE_TIME=""
fi
fi
;;
esac
fi
if test "$HAVE_AVX_AT_COMPILE_TIME" = "yes"; then
CFLAGS="-DHAVE_AVX_AT_COMPILE_TIME $CFLAGS"
CXXFLAGS="-DHAVE_AVX_AT_COMPILE_TIME $CXXFLAGS"
fi
rm -rf detectavx*
else
AC_MSG_RESULT([no])
fi
AC_SUBST(AVXFLAGS,$AVXFLAGS)
dnl ---------------------------------------------------------------------------
dnl Check for --enable-lto
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING([to enable LTO (link time optimization) build])
AC_ARG_ENABLE(lto,
AS_HELP_STRING([--enable-lto],
[enable LTO(link time optimization) (disabled by default)]))
CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT="$CXXFLAGS"
CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT="$CXXFLAGS"
if test "x$enable_lto" = "xyes" ; then
dnl remove existing -g.
CXXFLAGS=`echo "$CXXFLAGS" | sed "s/-g //"`
CFLAGS=`echo "$CFLAGS" | sed "s/-g //"`
dnl add -flto
CXXFLAGS="$CXXFLAGS -flto"
CFLAGS="$CFLAGS -flto"
LDFLAGS="$LDFLAGS -flto"
dnl in case we have avx available by default, then we can compile everything
dnl with -flto
if test "$HAVE_AVX_AT_COMPILE_TIME" = "yes"; then
if test "$AVXFLAGS" = ""; then
CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT="$CXXFLAGS"
fi
fi
if test "$HAVE_SSSE3_AT_COMPILE_TIME" = "yes"; then
if test "$SSSE3FLAGS" = ""; then
CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT="$CXXFLAGS"
fi
fi
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT,$CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT)
AC_SUBST(CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT,$CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT)
dnl ---------------------------------------------------------------------------
dnl Check if we need -lws2_32 (mingw)
dnl ---------------------------------------------------------------------------
echo "#include <winsock2.h>" > test_ws2_32.c
echo "#include <ws2tcpip.h>" >> test_ws2_32.c
echo "void foo() {}" >> test_ws2_32.c
if test -z "`${CC} -c test_ws2_32.c 2>&1`" ; then
LIBS="$LIBS -lws2_32"
fi
rm -f test_ws2_32*
dnl ---------------------------------------------------------------------------
dnl Check if we need -lpsapi (mingw)
dnl ---------------------------------------------------------------------------
echo "#include <windows.h>" > test_psapi.c
echo "#include <psapi.h>" >> test_psapi.c
echo "void foo() {}" >> test_psapi.c
if test -z "`${CC} -c test_psapi.c 2>&1`" ; then
LIBS="$LIBS -lpsapi"
fi
rm -f test_psapi*
dnl ---------------------------------------------------------------------------
dnl Check if we have getaddrinfo
dnl ---------------------------------------------------------------------------
echo "#include <sys/types.h>" > test_getaddrinfo.c
echo "#include <sys/socket.h>" >> test_getaddrinfo.c
echo "#include <netdb.h>" >> test_getaddrinfo.c
echo "void test() { getaddrinfo(0,0,0,0); }" >> test_getaddrinfo.c
HAVE_GETADDRINFO=NO
if test -z "`${CC} -c test_getaddrinfo.c 2>&1`" ; then
AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO,1, [Define to 1 if you have the `getaddrinfo' function.])
fi
rm -f test_getaddrinfo*
dnl ---------------------------------------------------------------------------
dnl Check if user requests hiding internal symbols
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(hide_internal_symbols,[ --with-hide-internal-symbols[=ARG] Try to hide internal symbols (ARG=yes/no)],,)
HAVE_HIDE_INTERNAL_SYMBOLS=no
if test "$with_hide_internal_symbols" = "yes"; then
AC_MSG_CHECKING([whether we should hide internal symbols])
rm -f hiddensymbols.c
echo 'int visible() { return 0; } __attribute__ ((visibility("default")))' >> hiddensymbols.c
echo 'int hidden() { return 0; }' >> hiddensymbols.c
if test -z "`${CC} -fvisibility=hidden -c hiddensymbols.c 2>&1`" ; then
HAVE_HIDE_INTERNAL_SYMBOLS=yes
else
HAVE_HIDE_INTERNAL_SYMBOLS=no
fi
if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes"; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
CFLAGS_NOFTRAPV="$CFLAGS_NOFTRAPV -fvisibility=hidden"
CXXFLAGS_NOFTRAPV="$CXXFLAGS_NOFTRAPV -fvisibility=hidden"
CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT="$CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT -fvisibility=hidden"
CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT="$CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT -fvisibility=hidden"
else
AC_MSG_RESULT([no])
fi
rm -f hiddensymbols.*
else
AC_MSG_CHECKING([whether we should hide internal symbols])
AC_MSG_RESULT([no])
fi
if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes" ; then
AC_DEFINE_UNQUOTED(USE_GCC_VISIBILITY_FLAG,1, [Define to 1 if you want to use the -fvisibility GCC flag])
fi
AC_SUBST(HAVE_HIDE_INTERNAL_SYMBOLS,$HAVE_HIDE_INTERNAL_SYMBOLS)
dnl ---------------------------------------------------------------------------
dnl Check if user requests renaming internal libtiff symbols
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(rename_internal_libtiff_symbols,[ --with-rename-internal-libtiff-symbols[=ARG] Prefix internal libtiff symbols with gdal_ (ARG=yes/no)],,)
if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes" ; then
with_rename_internal_libtiff_symbols=yes
if test "x$with_rename_internal_libtiff_symbols" = "x$no"; then
with_rename_internal_libtiff_symbols=no
fi
else
with_rename_internal_libtiff_symbols=no
if test "x$with_rename_internal_libtiff_symbols" = "x$yes" -o "x$with_rename_internal_libtiff_symbols" = "x"; then
with_rename_internal_libtiff_symbols=yes
fi
fi
AC_SUBST(RENAME_INTERNAL_LIBTIFF_SYMBOLS,$with_rename_internal_libtiff_symbols)
dnl ---------------------------------------------------------------------------
dnl Check if user requests renaming internal libgeotiff symbols
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(rename_internal_libgeotiff_symbols,[ --with-rename-internal-libgeotiff-symbols[=ARG] Prefix internal libgeotiff symbols with gdal_ (ARG=yes/no)],,)
if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes" ; then
with_rename_internal_libgeotiff_symbols=yes
if test "x$with_rename_internal_libgeotiff_symbols" = "x$no"; then
with_rename_internal_libgeotiff_symbols=no
fi
else
with_rename_internal_libgeotiff_symbols=no
if test "x$with_rename_internal_libgeotiff_symbols" = "x$yes" -o "x$with_rename_internal_libgeotiff_symbols" = "x"; then
with_rename_internal_libgeotiff_symbols=yes
fi
fi
AC_SUBST(RENAME_INTERNAL_LIBGEOTIFF_SYMBOLS,$with_rename_internal_libgeotiff_symbols)
dnl ---------------------------------------------------------------------------
dnl Check if user requests renaming internal shapelib symbols
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(rename_internal_shapelib_symbols,[ --with-rename-internal-shapelib-symbols[=ARG] Prefix internal shapelib symbols with gdal_ (ARG=yes/no)],,)
if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes" ; then
with_rename_internal_shapelib_symbols=yes
if test "x$with_rename_internal_shapelib_symbols" = "x$no"; then
with_rename_internal_shapelib_symbols=no
fi
else
with_rename_internal_shapelib_symbols=no
if test "x$with_rename_internal_shapelib_symbols" = "x$yes" -o "x$with_rename_internal_shapelib_symbols" = "x"; then
with_rename_internal_shapelib_symbols=yes
fi
fi
AC_SUBST(RENAME_INTERNAL_SHAPELIB_SYMBOLS,$with_rename_internal_shapelib_symbols)
dnl ---------------------------------------------------------------------------
dnl Check if user requests /usr/local to be included.
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING([for local include/lib path])
AC_ARG_WITH(local,[ --with-local[=dir] Include /usr/local or other local tree for INCLUDE/LIBS],,)
if test "$with_local" != "no" -a "$with_local" != "" ; then
if test "$with_local" = "yes" ; then
ADD_PREFIX=/usr/local
else
ADD_PREFIX=$with_local
fi
AC_MSG_RESULT(adding $ADD_PREFIX)
LIBS="$LIBS -L$ADD_PREFIX/lib"
CPPFLAGS="$CPPFLAGS -I$ADD_PREFIX/include"
else
AC_MSG_RESULT([none])
fi
dnl ---------------------------------------------------------------------
dnl ENABLE THREADS ONLY IF REQUESTED.
dnl ---------------------------------------------------------------------
THREAD_LIB=""
THREAD_FLAG=""
PTHREAD_ENABLED="no"
AC_ARG_WITH(threads,
[ --with-threads[=ARG] Include thread safe support (ARG=yes(default), no or linkopt)],,)
if test "$with_threads" = "yes" -o "$with_threads" = "" ; then
AC_CHECK_LIB(pthread,pthread_create,THREAD_FLAG=CPL_MULTIPROC_PTHREAD,,,)
if test -n "$THREAD_FLAG" ; then
THREAD_LIB="-lpthread"
else
# For Android, pthread_create is in Bionic libc
unset ac_cv_lib_pthread_pthread_create
AC_CHECK_LIB(c,pthread_create,THREAD_FLAG=CPL_MULTIPROC_PTHREAD,,,)
fi
AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE])
AC_TRY_COMPILE(
[
#define _GNU_SOURCE
#include <pthread.h>
], [
return (PTHREAD_MUTEX_RECURSIVE);
],
[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_PTHREAD_MUTEX_RECURSIVE, 1,
[Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE' constant.])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
AC_TRY_COMPILE(
[
#define _GNU_SOURCE
#include <pthread.h>
], [
return PTHREAD_MUTEX_ADAPTIVE_NP;
],
[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_PTHREAD_MUTEX_ADAPTIVE_NP, 1,
[Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([for pthread_spinlock_t])
AC_TRY_COMPILE(
[
#define _GNU_SOURCE
#include <pthread.h>
], [
pthread_spinlock_t spin;
return 1;
],
[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SPINLOCK, 1,
[Define to 1 if you have the `pthread_spinlock_t' type.])
], [
AC_MSG_RESULT([no])
])
elif test "$with_threads" != "no" ; then
THREAD_FLAG=CPL_MULTIPROC_PTHREAD
THREAD_LIB="$with_threads"
AC_CHECKING(whether we should include thread/mutex support...)
AC_MSG_RESULT([ using threads with link options "$THREAD_LIB".])
else
AC_CHECKING(whether we should include thread/mutex support...)
AC_MSG_RESULT([ thread safe support disabled.])
fi
if test "$THREAD_FLAG" = "CPL_MULTIPROC_PTHREAD" ; then
AC_DEFINE_UNQUOTED(CPL_MULTIPROC_PTHREAD,1, [Define if you want to use pthreads based multiprocessing support])
PTHREAD_ENABLED="yes"