forked from MonetDB/MonetDB-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ag
3100 lines (2857 loc) · 109 KB
/
configure.ag
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
# -*- Autoconf -*-
# vim: ft=config :
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl
dnl Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V.
dnl Process this file with autoconf to produce a configure script.
dnl Some help with the syntax:
dnl AS_IF(test, body [, test, body]* [, body])
dnl All tests are executed in order until one returns true, then
dnl the corresponding body is executed, if no tests succeed, the
dnl last body (if present) is executed.
dnl This translates to a shell if statement with a bunch of elif
dnl clauses and an else clause.
dnl AS_CASE(word [, pattern, body]* [,body])
dnl The word is tested against each successive pattern, the body
dnl of the first matching pattern is executed, if no patterns
dnl match, the final body (if present) is executed.
dnl This translates to a shell case command with patterns and
dnl bodies, the final body gets the pattern *.
dnl AS_VERSION_COMPARE(version1, version2, lt-body, eq-body, gt-body)
dnl The two versions are compared, the body corresponding with
dnl whether the first version is less than, equal to, or greater
dnl than the second version is executed.
dnl AS_VAR_IF(var, word, eq-body, ne-body)
dnl If $var is equal to word, execute eq-body, else execute ne-body.
dnl @%:@
dnl This is a quadrigraph for #. We use this in C preprocessor
dnl code that we inline in the script so that it doesn't get
dnl confused with a start-of-comment.
dnl Note that by using this syntax, there should not be any
dnl unbalanced parentheses (due to there not being loose case
dnl statements). This makes editing easier.
dnl Also note that comments that start with # are copied to the
dnl configure file, whereas comments starting with dnl are elided
dnl (including their trailing newline).
AC_PREREQ([2.63])
AC_INIT([MonetDB], [11.26.0], [https://bugs.monetdb.org/], [MonetDB], [https://www.monetdb.org/])
AC_CONFIG_AUX_DIR([buildtools/conf])
AC_CONFIG_MACRO_DIR([buildtools/conf])
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
# use tar-ustar since we have long (longer than 99 characters) file names
AM_INIT_AUTOMAKE([tar-ustar no-dist-gzip dist-bzip2])
AC_CONFIG_SRCDIR([gdk/gdk.h])
AC_CONFIG_HEADERS([monetdb_config.h])
AC_SUBST([CONFIG_H], [monetdb_config.h])
HOST=[$target]
AC_DEFINE_UNQUOTED([HOST], ["$HOST"], [Host identifier])
AC_DEFINE([MONETDB_RELEASE], ["unreleased"], [Release name or "unreleased"])
AS_VAR_IF([target_os], [cygwin],
[AC_DEFINE([WIN32], 1, [Define on Microsoft Windows (also under Cygwin)])])
AM_CONDITIONAL([NOT_WIN32], [test x"$target_os" != xcygwin])
AM_CONDITIONAL([NATIVE_WIN32], [false])
m4_ifndef([PKG_PROG_PKG_CONFIG],
[m4_fatal([Could not locate the pkg-config autoconf
macros. These are usually located in /usr/share/aclocal/pkg.m4.
If your macros are in a different location, try setting the
environment variable M4DIRS="-I/other/macro/dir" before running
./bootstrap or autoreconf again.])])
PKG_PROG_PKG_CONFIG
AS_VAR_IF([PKG_CONFIG], [],
[AC_MSG_ERROR([pkg-config is required to configure MonetDB])])
# BUILD and SOURCE are *only* used for testing.
# The Q versions of various variables are used in places where \'s
# need to be escapes with an extra \. Configure does not support \'s
# in path names, so there is no need to do anything special here
# except set the variables. The command to set them in case we do
# need to escape the \'s is Qvar=`echo "$var" | sed 's/\\\\/\\\\\\\\/g'`
BUILD=[`pwd`]
AC_SUBST([BUILD])
SOURCE=[`(cd $srcdir && pwd)`]
AC_SUBST([SOURCE])
. $srcdir/libversions
AC_SUBST([GDK_VERSION])
AC_SUBST([MAPI_VERSION])
AC_SUBST([MONETDB5_VERSION])
AC_SUBST([STREAM_VERSION])
# if no --prefix option, we must set Qprefix to the default value
# the problem is that prefix is set very late in the process if it
# wasn't set by --prefix
AS_VAR_IF([prefix], [NONE],
[Qprefix="${ac_default_prefix}"].
[Qprefix="${prefix}"])
Qprefix=`echo "$Qprefix" | sed 's/\\\\/\\\\\\\\/g'`
AC_SUBST([Qprefix])
# exec_prefix is created very late, so let make do the expansion
AS_VAR_IF([exec_prefix], [NONE],
[Qexec_prefix='${prefix}'],
[Qexec_prefix=`echo "$exec_prefix" | sed 's/\\\\/\\\\\\\\/g'`])
AC_SUBST([Qexec_prefix])
# small hack to get icc -no-gcc, done here because AC_PROG_CC shouldn't
# set GCC=yes if we use icc.
AS_CASE([$CC],
[*icc*-no-gcc*], [],
[*icc*], [
# Since version 8.0, ecc/ecpc are also called icc/icpc,
# and icc/icpc requires "-no-gcc" to avoid predefining
# __GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__ macros.
icc_ver=`$CC -dumpversion 2>/dev/null`
AS_CASE([$icc_ver],
[8.*], [CC="$CC -no-gcc"],
[9.*], [CC="$CC -no-gcc"],
[10.*], [CC="$CC -no-gcc"],
[11.*], [CC="$CC -no-gcc"],
[15.*], [CC="$CC -no-gcc"],
[17.*], [CC="$CC -no-gcc"],
[AC_MSG_WARN([icc ($CC) $icc_ver not handled, yet])])])
AS_IF([test -f "$srcdir"/vertoo.data],
[
# Developers compiling from Mercurial:
# default is --enable-strict --enable-assert --enable-debug --disable-optimize --enable-developer
dft_strict=yes
dft_assert=yes
dft_debug=yes
dft_optimize=no
dft_developer=yes],
[
# Users compiling from source tarball(s):
# default is --disable-strict --disable-assert --disable-debug --disable-optimize --disable-developer
dft_strict=no
dft_assert=no
dft_debug=no
dft_optimize=no
dft_developer=no])
AC_ARG_ENABLE([developer],
[AS_HELP_STRING([--enable-developer],
[enable support for MonetDB development (default=yes for development sources)])],
[enable_developer=$enableval],
[enable_developer=$dft_developer])
dft_testing=auto
AC_ARG_ENABLE([testing],
[AS_HELP_STRING([--enable-testing],
[enable support for testing (default=auto)])],
[enable_testing=$enableval],
[enable_testing=$dft_testing])
dft_mapi=yes
AC_ARG_ENABLE([mapi],
[AS_HELP_STRING([--enable-mapi],
[Enable MAPI (default=yes)])],
[enable_mapi=$enableval],
[enable_mapi=$dft_mapi])
AM_CONDITIONAL([HAVE_MAPI], [test x$enable_mapi != xno])
AS_VAR_IF([enable_mapi], [no],
[],
[AC_DEFINE([HAVE_MAPI], 1, [Enable MAPI])])
dft_odbc=auto
AC_ARG_ENABLE([odbc],
[AS_HELP_STRING([--enable-odbc],
[compile the MonetDB ODBC driver (default=auto)])],
[enable_odbc=$enableval],
[enable_odbc=$dft_odbc])
dft_gdk=yes
AC_ARG_ENABLE([gdk],
[AS_HELP_STRING([--enable-gdk],
[enable support for GDK (default=yes)])],
[enable_gdk=$enableval],
[enable_gdk=$dft_gdk])
dft_monetdb5=yes
AC_ARG_ENABLE([monetdb5],
[AS_HELP_STRING([--enable-monetdb5],
[enable support for MonetDB5 (default=yes)])],
[enable_monetdb5=$enableval],
[enable_monetdb5=$dft_monetdb5])
AS_CASE([$enable_gdk-$enable_monetdb5],
[no-yes], [AC_MSG_ERROR([MonetDB5 requires GDK.])],
[no-auto], [
enable_monetdb5=no
disable_monetdb5="(MonetDB5 requires GDK.)"])
dft_sql=yes
AC_ARG_ENABLE([sql],
[AS_HELP_STRING([--enable-sql],
[enable support for MonetDB/SQL (default=yes)])],
[enable_sql=$enableval],
[enable_sql=$dft_sql])
AS_CASE([$enable_monetdb5-$enable_sql],
[no-yes], [
AC_MSG_ERROR([MonetDB/SQL requires MonetDB5.])],
[no-auto], [
enable_sql=no
disable_sql="(MonetDB/SQL requires MonetDB5.)"])
dft_geom=auto
AC_ARG_ENABLE([geom],
[AS_HELP_STRING([--enable-geom],
[enable support for geom module (default=auto)])],
[enable_geom=$enableval],
[enable_geom=$dft_geom])
AS_CASE([$enable_monetdb5-$enable_geom],
[no-yes], [
AC_MSG_ERROR([geom module requires MonetDB5])],
[no-auto], [
enable_geom=no
disable_geom="(geom module requires MonetDB5)"])
dft_fits=auto
AC_ARG_ENABLE([fits],
[AS_HELP_STRING([--enable-fits],
[enable support for FITS (default=auto)])],
[enable_fits=$enableval],
[enable_fits=$dft_fits])
dft_netcdf=auto
AC_ARG_ENABLE([netcdf],
[AS_HELP_STRING([--enable-netcdf],
[enable support for netcdf (default=auto)])],
[enable_netcdf=$enableval],
[enable_netcdf=$dft_netcdf])
dft_lidar=auto
AC_ARG_ENABLE([lidar],
[AS_HELP_STRING([--enable-lidar],
[enable support for LiDAR data (default=auto)])],
[have_lidar=$enableval],
[have_lidar=$dft_lidar])
dft_shp=auto
AC_ARG_ENABLE([shp],
[AS_HELP_STRING([--enable-shp],
[enable support for ESRI Shapefiles (default=auto)])],
[have_shp=$enableval],
[have_shp=$dft_shp])
AS_CASE([$enable_geom-$have_shp],
[no-yes], [
AC_MSG_ERROR([ESRI Shapefile vault requires the geom module])],
[no-auto], [
have_shp=no
disable_shp="(ESRI Shapefile vault requires the geom module)"])
dft_embedded=no
AC_ARG_ENABLE([embedded],
[AS_HELP_STRING([--enable-embedded],
[enable support for running MonetDB as a library (default=no)])],
[enable_embedded=$enableval],
[enable_embedded=$dft_embedded])
AM_CONDITIONAL([HAVE_EMBEDDED], [test x$enable_embedded != xno])
AS_VAR_IF([enable_embedded], [no], [],
[AC_DEFINE([HAVE_EMBEDDED], 1, [Support for MonetDB as a library])])
dft_embedded_r=no
AC_ARG_ENABLE([embedded-r],
[AS_HELP_STRING([--enable-embedded-r],
[enable support for running MonetDB as a library for R (default=no)])],
[enable_embedded_r=$enableval],
[enable_embedded_r=$dft_embedded_r])
AM_CONDITIONAL([HAVE_EMBEDDED_R], [test x$enable_embedded_r != xno])
AS_VAR_IF([enable_embedded_r], [no], [],
[AC_DEFINE([HAVE_EMBEDDED_R], 1, [Support for MonetDB as a library for R])])
dft_rintegration=auto
AC_ARG_ENABLE([rintegration],
[AS_HELP_STRING([--enable-rintegration],
[enable support for R integration into MonetDB (default=auto)])],
[enable_rintegration=$enableval],
[enable_rintegration=$dft_rintegration])
dft_pyintegration=auto
AC_ARG_ENABLE([pyintegration],
[AS_HELP_STRING([--enable-pyintegration],
[enable support for Python integration into MonetDB (default=auto)])],
[enable_pyintegration=$enableval],
[enable_pyintegration=$dft_pyintegration])
# The console is a direct client hooked onto the kernel with full
# administrative privileges, bypassing any security checks. It is
# handy only during development.
# We simply can't disable it for now because Testing gets hopelessly
# upset about it, but we can offer to the user to disable it for
# increased security.
dft_console=yes
AC_ARG_ENABLE([console],
[AS_HELP_STRING([--enable-console],
[enables direct console on the server (involves security risks) (default=yes)])],
[enable_console="$enableval"],
[enable_console=$dft_console])
AS_VAR_IF([enable_console], [no], [],
[AC_DEFINE([HAVE_CONSOLE], 1, [If the console should be used])])
dft_int128=auto
AC_ARG_ENABLE([int128],
[AS_HELP_STRING([--enable-int128],
[enable support for 128-bit integers (default=auto)])],
[enable_int128=$enableval],
[enable_int128=$dft_int128])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable full debugging (default=yes for development sources)])],
[enable_debug=$enableval],
[enable_debug=def_$dft_debug])
AC_ARG_ENABLE([assert],
[AS_HELP_STRING([--enable-assert],
[enable assertions in the code (default=yes for development sources)])],
[enable_assert=$enableval],
[enable_assert=def_$dft_assert])
AC_ARG_ENABLE([optimize],
[AS_HELP_STRING([--enable-optimize],
[enable extra optimization (default=no)])],
[enable_optimize=$enableval],
[enable_optimize=def_$dft_optimize])
AC_ARG_ENABLE([strict],
[AS_HELP_STRING([--enable-strict],
[enable strict compiler flags (default=yes for development sources)])],
[enable_strict=$enableval],
[enable_strict=$dft_strict])
dft_sanitizer=no
AC_ARG_ENABLE([sanitizer],
[AS_HELP_STRING([--enable-sanitizer],
[enable support for the GCC address sanitizer (default=no)])],
[enable_sanitizer=$enableval],
[enable_sanitizer=$dft_sanitizer])
AC_ARG_ENABLE([static-analysis],
[AS_HELP_STRING([--enable-static-analysis], [configure for static code analysis (use only if you know what you are doing)])],
AC_DEFINE([STATIC_CODE_ANALYSIS], 1, [compiling for static code analysis]))
need_profile=no
dft_profile=$need_profile
AC_ARG_ENABLE([profile],
[AS_HELP_STRING([--enable-profile], [enable profiling (default=no)])],
[enable_profile=$enableval],
[enable_profile=def_$dft_profile])
need_instrument=no
dft_instrument=$need_instrument
AC_ARG_ENABLE([instrument],
[AS_HELP_STRING([--enable-instrument],
[enable instrument (default=no)])],
[enable_instrument=$enableval],
[enable_instrument=def_$dft_instrument])
# RIPEMD160 is patent free, academic and European, but unfortunately
# can't use it by default, as that would exclude JDBC usage (Java
# doesn't natively support RIPEMD160).
MONETDB5_PASSWDHASH="SHA512"
AC_ARG_WITH([password-backend],
[AS_HELP_STRING([--with-password-backend=HASHALG],
[password hash algorithm, one of MD5, SHA1, RIPEMD160, SHA224, SHA256, SHA384, SHA512, defaults to SHA512])],
[password_backend="$withval"])
AS_CASE([$password_backend],
[yes|no|auto|""],
[],
[MD5|SHA1|RIPEMD160|SHA224|SHA256|SHA384|SHA512],
[MONETDB5_PASSWDHASH="$password_backend"],
[AC_MSG_ERROR(['$password_backend' invalid, choose one of MD5, SHA1, RIPEMD160, SHA224, SHA256, SHA384, SHA512])])
AC_DEFINE_UNQUOTED([MONETDB5_PASSWDHASH], ["$MONETDB5_PASSWDHASH"],
[The used password hash algorithm])
AC_DEFINE_UNQUOTED([MONETDB5_PASSWDHASH_TOKEN], [$MONETDB5_PASSWDHASH],
[The used password hash algorithm])
AC_SUBST([MONETDB5_PASSWDHASH])
AC_DISABLE_STATIC
AC_ENABLE_SHARED
AM_CONDITIONAL([CROSS_COMPILING], [test x$cross_compiling = xyes])
# logs usually end up in /var/log
logdir='${localstatedir}/log/monetdb'
AC_ARG_WITH([logdir],
[AS_HELP_STRING([--with-logdir=DIR],
[Where to put log files (LOCALSTATEDIR/log/monetdb/)])],
[AS_CASE([$withval],
[yes|no|auto],
[AC_MSG_WARN([--with-logdir called without argument - will use default])],
[logdir="$withval"])])
# pidfiles usually end up in /var/run
rundir='${localstatedir}/run/monetdb'
AC_ARG_WITH([rundir],
[AS_HELP_STRING([--with-rundir=DIR],
[Where to put pid files (LOCALSTATEDIR/run/monetdb/)])],
[AS_CASE([$withval],
[yes|no|auto],
[AC_MSG_WARN([--with-rundir called without argument - will use default])],
[rundir="$withval"])])
# checks for programs
AC_LANG([C])
# autoconf-2.60: enable extensions on systems that normally disable them
AC_USE_SYSTEM_EXTENSIONS()
# enable 64-bits file offsets, check this early, since it breaks other
# stuff (in particular on Solaris), which we do not want to detect as
# usable below in that case
AC_SYS_LARGEFILE
AC_PROG_CPP()
# check for compiler (also set GCC (yes/no)).
AC_PROG_CC()
# What do we need to get the msg_control and msg_controllen fields on
# struct msg (filedescriptor passing)? In the future this could be a
# check to see if we can find it, such that we can disable it compile
# time if absent. It looks however, as if it's available everywhere
# we try where UNIX domain sockets also exist. So we go by the
# following simple implementation for now.
AS_CASE([$host],
[*-solaris*], [
# Solaris needs this to get msg_control and msg_controllen;
# it disables, however, the availability of madvise, which is
# in use use by GDK, so we cannot just AC_DEFINE this, but
# rather have to enable it where it is necessary
MSGCONTROL_FLAGS="-D_XOPEN_SOURCE=500"
AC_SUBST([MSGCONTROL_FLAGS])])
# (try to) determine compiler type (gcc, icc, clang) (and version)
# independent of call ($CC) and result of AC_PROG_CC() ($GCC)
# (e.g., on OSX, Apple pretends its clang is gcc)
AC_MSG_CHECKING([compiler type & version])
gcc_ver=""
icc_ver=""
CC_ver=""
CC_version=`$CC --version 2>&1`
AS_CASE([$CC_version],
[*'(GCC)'*|*'Copyright (C) '*' Free Software Foundation, Inc.'*], [
gcc_ver=`$CC -dumpversion 2>/dev/null`
CC_ver="gcc-$gcc_ver"],
[*'(ICC)'*|*'Copyright (C) '*' Intel Corporation. All rights reserved.'*], [
icc_ver=`$CC -dumpversion 2>/dev/null`
CC_ver="icc-$icc_ver"],
[*clang*], [
# `clang -dumpversion` reports the original/old gcc version it is based on
gcc_ver=`$CC -v 2>&1 | grep -w '[[Vv]]ersion [[0-9]]\+\.[[0-9]]\+' | sed 's|^.*[[Vv]]ersion \([[0-9]][[0-9]]*\(\.[[0-9]][[0-9]]*\)\(\.[[0-9]][[0-9]]*\)*\).*$|\1|'`
CC_ver="clang-$gcc_ver"],
[CC_V=`$CC -V 2>&1`
AS_CASE([$CC_V],
[*'Sun Ceres C '*|*'Sun C '*], [
# developer/sunstudioexpress and
# developer/sunstudio12u1 respectively
CC_ver="suncc-`echo "$CC_version" | sed -n 's/.*Sun Ceres C \(.*\) SunOS.*/\1/p;s/.*Sun C \(.*\) SunOS.*/\1/p'`"
CC_version="$CC_V"],
[AC_MSG_WARN([compiler not recognized:
`$CC --version` says
$CC_version
`$CC -V` says
$CC_V])])])
AC_MSG_RESULT([$CC_ver])
# sanity/consistency check
AS_CASE([$GCC!$CC!$CC_ver],
[yes!*clang*!clang-*], [],
[yes!*gcc*!clang-*], [],
[yes!*gcc*!gcc-*], [],
[!*icc*!icc-*], [],
[*!*!suncc-*], [],
[AC_MSG_WARN([compiler potentially not (correctly) recognized:
GCC=$GCC
CC=$CC
CC_ver=$CC_ver
CC_version=
$CC_version])])
AC_CHECK_SIZEOF([long])
bits=`expr $ac_cv_sizeof_long \* 8`
AC_SUBST([bits])
AM_CONDITIONAL([BITS32], [test x"$bits" = x32])
AM_CONDITIONAL([BITS64], [test x"$bits" = x64])
AC_C_BIGENDIAN()
LINUX_DIST=''
AS_CASE([$host_os],
[linux*], [
# Please keep this aligned / in sync with testing/Mtest.py.in !
AC_MSG_CHECKING([which Linux distribution we're using])
AS_IF([test -s /etc/os-release], [
# this is the new way of getting release information
# works for Fedora >= 17, Ubuntu >= 12.04 (Precise Pangolin)
LINUX_DIST=`source /etc/os-release; echo ${ID}:${VERSION_ID}`],
[test -s /etc/fedora-release ], [
LINUX_DIST=`cat /etc/fedora-release | head -n1 \
| sed 's|^.*\(Fedora\).* release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`],
[test -s /etc/centos-release ], [
LINUX_DIST=`cat /etc/centos-release | head -n1 \
| sed 's|^\(CentOS\).* release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`],
[test -s /etc/yellowdog-release ], [
LINUX_DIST=`cat /etc/yellowdog-release | head -n1 \
| sed 's|^\(Yellow\) Dog Linux release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`],
[test -s /etc/redhat-release ], [
LINUX_DIST=`cat /etc/redhat-release | head -n1 \
| sed 's|^.*\(Red\) \(Hat\).* Linux *\([[A-Z]]*\) release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1\2:\4\3|' \
| sed 's|^Red Hat Enterprise Linux \([[AW]]S\) release \([[0-9]][[^ \n]]*\)\( .*\)*$|RHEL:\2\1|' \
| sed 's|^\(CentOS\).* release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|' \
| sed 's|^\(Scientific\) Linux.* release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`],
[test -s /etc/SuSE-release ], [
LINUX_DIST=`cat /etc/SuSE-release | head -n1 \
| sed 's|^.*\(S[[Uu]]SE\) LINUX Enterprise \([[SD]]\)[[ervsktop]]* \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\3E\2|' \
| sed 's|^S[[Uu]]SE LINUX Enterprise \([[SD]]\)[[ervsktop]]* \([[0-9]][[^ \n]]*\)\( .*\)*$|SLE\1:\2|' \
| sed 's|^.*\(S[[Uu]]SE\) [[Ll]][[Ii]][[Nn]][[Uu]][[Xx]].* \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|' \
| sed 's|^open\(S[[Uu]]SE\) \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`],
[test -s /etc/gentoo-release ], [
LINUX_DIST=`cat /etc/gentoo-release | head -n1 \
| sed 's|^.*\(Gentoo\) Base System.* [[versionrelease]]* \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`],
[test -s /etc/lsb-release ], [
LINUX_DIST=`grep '^DISTRIB_ID=' /etc/lsb-release | cut -d'=' -f2`:`grep '^DISTRIB_RELEASE=' /etc/lsb-release | cut -d'=' -f2`],
[test -s /etc/debian_version ], [
LINUX_DIST=Debian:`cat /etc/debian_version | head -n1`],
[LINUX_DIST=`uname -s`:`uname -r | sed 's|^\([[0-9\.]]*\)\([[^0-9\.]].*\)$|\1|'`])
LINUX_DIST=`echo "$LINUX_DIST" | sed 's|:||'`
AC_MSG_RESULT([$LINUX_DIST])])
AC_SUBST([LINUX_DIST])
AC_DEFUN([MCHECK_ADD_FLAG], [
cache_var=AS_TR_SH([m_cv_cc_has_$1])
AC_CACHE_CHECK([whether ${CC} supports $1], [${cache_var}], [
SAVE_FLAGS="${CFLAGS}"
# compile a small program that has enough challenges to trigger
# the compiler to actually do something, such that it needs to
# actually look at the flags given
CFLAGS="${SAVE_FLAGS} ${X_CFLAGS} $1"
dnl do not use AC_LANG_PROGRAM here, because it generates a program
dnl with "int main() {" function, which triggers
dnl old-style-definition warnings
AC_LINK_IFELSE([
AC_LANG_SOURCE([[
@%:@include <stdio.h>
@%:@include <stdlib.h>
@%:@ifdef HAVE_STRING_H
@%:@include <string.h>
@%:@endif
@%:@if -_LARGEFILE64_SOURCE - -1 == 1
@%:@include <stdio.h>
@%:@endif
int main(int argc, char **av) {
char buf[24];
double d = atof("4.2");
if (argc == 0 || strchr(av[0], av[0][0]) != NULL)
snprintf(buf, sizeof(buf), "%f", d);
return 0;
}
]])],
[eval ${cache_var}=yes],
[eval ${cache_var}=no])
CFLAGS="${SAVE_FLAGS}"
])
eval "test \"x\$${cache_var}\" = xyes && X_CFLAGS=\"${X_CFLAGS} $1\""
])
# Set compiler switches.
# The idea/goal is to be as strict as possible, i.e., enable preferably
# *all* warnings and make them errors. This should help keep the code
# as clean and portable as possible.
# It turned out, though, that this, especially turning all warnings into
# errors, is a bit too ambitious for configure/autoconf. Hence, we set
# all flags that enable specific warnings and those that make the
# compiler die on them (-Werror) in X_CFLAGS, which are added to the
# standard CFLAGS once configure/autoconf are done with their job,
# i.e., at the end of this configure[.ag] script.
# Only GNU (gcc) and Intel ([ie]cc/[ie]cpc on Linux) are done so far.
AS_VAR_IF([enable_strict], [yes], [
AS_CASE([$GCC-$CC-$host_os],
[yes-*-*], [
# keep this one first
MCHECK_ADD_FLAG([-Werror])
MCHECK_ADD_FLAG([-Wall])
MCHECK_ADD_FLAG([-Wextra])
MCHECK_ADD_FLAG([-W])
MCHECK_ADD_FLAG([-Werror-implicit-function-declaration])
MCHECK_ADD_FLAG([-Wpointer-arith])
MCHECK_ADD_FLAG([-Wdeclaration-after-statement])
MCHECK_ADD_FLAG([-Wundef])
MCHECK_ADD_FLAG([-Wformat=2])
MCHECK_ADD_FLAG([-Wno-format-nonliteral])
MCHECK_ADD_FLAG([-Winit-self])
MCHECK_ADD_FLAG([-Winvalid-pch])
MCHECK_ADD_FLAG([-Wmissing-declarations])
MCHECK_ADD_FLAG([-Wmissing-format-attribute])
MCHECK_ADD_FLAG([-Wmissing-prototypes])
MCHECK_ADD_FLAG([-Wold-style-definition])
MCHECK_ADD_FLAG([-Wpacked])
MCHECK_ADD_FLAG([-Wunknown-pragmas])
MCHECK_ADD_FLAG([-Wvariadic-macros])
MCHECK_ADD_FLAG([-fstack-protector-all])
MCHECK_ADD_FLAG([-Wstack-protector])
MCHECK_ADD_FLAG([-Wpacked-bitfield-compat])
MCHECK_ADD_FLAG([-Wsync-nand])
MCHECK_ADD_FLAG([-Wjump-misses-init])
MCHECK_ADD_FLAG([-Wmissing-include-dirs])
MCHECK_ADD_FLAG([-Wlogical-op])
# With clang 2.8, 3.3, 5.0 (no other tested) and gcc < 4.5
# (tested 3.4.6, 4.2.1, 4.3.2, 4.4.4, 4.4.5, 4.5.1, 4.5.2),
# "-Wunreachable-code" triggers numerous "will never be
# executed" (at least) in our stream code, mostly (if
# not all) false positives, though, as well as in
# YACC/BISON-generated code; thus, we do not use
# "-Wunreachable-code" with clang and gcc < 4.5 .
# At the same time, Apple deprecated OpenSSL in favour of
# their own CommonCrypto API. We don't mind about that.
AS_CASE([$CC_ver],
[clang-*|gcc-[[0-3]].*|gcc-4.[[0-4]].*],
[MCHECK_ADD_FLAG([-Wno-deprecated-declarations])],
[MCHECK_ADD_FLAG([-Wunreachable-code])])
dnl Our code is not (yet?) up to these:
dnl MCHECK_ADD_FLAG([-pedantic-errors])
dnl MCHECK_ADD_FLAG([-Wno-long-long])
dnl MCHECK_ADD_FLAG([-Waggregate-return])
dnl MCHECK_ADD_FLAG([-Wbad-function-cast])
dnl MCHECK_ADD_FLAG([-Wcast-qual])
dnl MCHECK_ADD_FLAG([-Wconversion])
dnl MCHECK_ADD_FLAG([-Wdisabled-optimization])
dnl MCHECK_ADD_FLAG([-Wfloat-equal])
dnl MCHECK_ADD_FLAG([-Winline])
dnl MCHECK_ADD_FLAG([-Wmissing-noreturn])
dnl MCHECK_ADD_FLAG([-Wnested-externs])
dnl MCHECK_ADD_FLAG([-Wpadded])
dnl MCHECK_ADD_FLAG([-Wredundant-decls])
dnl MCHECK_ADD_FLAG([-Wshadow])
dnl MCHECK_ADD_FLAG([-Wstrict-prototypes])
dnl MCHECK_ADD_FLAG([-Wswitch-default])
dnl MCHECK_ADD_FLAG([-Wswitch-enum])
dnl MCHECK_ADD_FLAG([-Wtraditional])
dnl MCHECK_ADD_FLAG([-Wtraditional-conversion])
dnl MCHECK_ADD_FLAG([-Wwrite-strings])
dnl MCHECK_ADD_FLAG([-Wc++-compat])
dnl MCHECK_ADD_FLAG([-Woverlength-strings])
dnl MCHECK_ADD_FLAG([-Wsign-conversion])
dnl MCHECK_ADD_FLAG([-Wstrict-overflow=5])
dnl MCHECK_ADD_FLAG([-Wvla])
dnl MCHECK_ADD_FLAG([-Wunsuffixed-float-constants])
],
[-*icc*-linux*|-*ecc*-linux*] ,[
# Intel ([ie]cc/[ie]cpc on Linux)
AS_CASE([$icc_ver],
[?.*], [LDFLAGS="$LDFLAGS -i_dynamic"],
[??.*], [LDFLAGS="$LDFLAGS -shared-intel"])
# Let warning #140 "too many arguments in function call"
# become an error to make configure tests work properly.
CFLAGS="$CFLAGS -we140"
# Let warning #147 "declaration is incompatible"
# become an error to make configure tests work properly.
CFLAGS="$CFLAGS -we147"
# Check for PIC does not work with Version 8.1, unless we disable
# remark #1418: external definition with no prior declaration ... !?
AS_CASE([$icc_ver],
[8.1*], [CFLAGS="$CFLAGS -wd1418"],
[9.*], [CFLAGS="$CFLAGS -wd1418"],
[10.*], [CFLAGS="$CFLAGS -wd1418"],
[11.*], [CFLAGS="$CFLAGS -wd1418"])
# Version 8.* doesn't find sigset_t when -ansi is set... !?
AS_CASE([$icc_ver],
[8.*], [],
[9.*], [],
[10.*], [],
[11.*], [],
[15.*], [],
[17.*], [],
[CFLAGS="$CFLAGS -ansi"])
# Be picky; "-Werror" seems to be too rigid for autoconf...
CFLAGS="$CFLAGS -Wall -w2 -Wcheck"
# Be rigid; MonetDB code is supposed to adhere to this... ;-)
# Let the follows remarks and warning become errors:
# #266: "function declared implicitly"
# #181: "argument is incompatible with corresponding format string conversion"
# #810: "conversion from "." to "." may lose significant bits"
# #111: "statement is unreachable"
# #271: "trailing comma is nonstandard"
# #593: "variable "." was set but never used"
X_CFLAGS="$X_CFLAGS -we266,181,810,271,593"
X_CFLAGS="$X_CFLAGS -Werror -Werror-all"
# ... however, some things aren't solved, yet:
# (for the time being,) we need to disable some warnings (making them remarks doesn't seem to work with -Werror):
X_CFLAGS="$X_CFLAGS -wd1418,1419,981,193,1357"
# ICC 11 & 15 warn about non-pointer conversion from "<type>" to
# "<smaller>" may lose significant bits, it does however, also for
# constants like short s = 1234, which is too much
AS_CASE([$icc_ver],
[11.*], [X_CFLAGS="$X_CFLAGS,2259"],
[15.*], [X_CFLAGS="$X_CFLAGS,2259"],
[17.*], [X_CFLAGS="$X_CFLAGS,2259"])
AS_CASE([$icc_ver],
[8.[[1-9]]*], [X_CFLAGS="$X_CFLAGS,1572"],
[9.[[1-9]]*], [X_CFLAGS="$X_CFLAGS,1572,1599"],
[10.*], [X_CFLAGS="$X_CFLAGS,1572,1599"],
[11.*], [X_CFLAGS="$X_CFLAGS,1572,1599"])
# #1418: external definition with no prior declaration
# #1419: external declaration in primary source file
# # 981: operands are evaluated in unspecified order
# # 193: zero used for undefined preprocessing identifier
# #1357: optimization disabled due to excessive resource requirements; contact Intel Premier Support for assistance
# #1572: floating-point equality and inequality comparisons are unreliable
# #1599: declaration hides variable
# #2259: non-pointer conversion from "." to "." may lose significant bits
])
])
AS_VAR_IF([enable_sanitizer], [no], [], [
AS_CASE([$GCC],
[yes], [
# if no specific sanitizer was specified, use
# address sanitizer
AS_VAR_IF([enable_sanitizer], [yes],
[MCHECK_ADD_FLAG([-fsanitize=address])],
[MCHECK_ADD_FLAG([-fsanitize=$enable_sanitizer])
AS_VAR_IF([enable_sanitizer], [thread],
[X_CFLAGS="$X_CFLAGS -DNO_ATOMIC_INSTRUCTIONS"])])
MCHECK_ADD_FLAG([-fno-omit-frame-pointer])],
[AC_MSG_ERROR([--enable-sanitizer only supported with GCC])])])
AC_SUBST([CFLAGS])
AC_SUBST([X_CFLAGS])
# icc needs -fPIC (but the current autoconf still uses -KPIC)
AS_CASE([$GCC-$CC-$host_os],
[-*icc*-linux*|-*ecc*-linux*], [
AS_CASE([$icc_ver],
[10.*], [CC="$CC -fPIC"],
[11.*], [CC="$CC -fPIC"])])
# some dirty hacks
THREAD_SAVE_FLAGS="\$(thread_safe_flag_spec) -D_REENTRANT"
# only needed in monet
AS_CASE([$host_os],
[solaris*], [
AS_CASE([$GCC],
[yes], [],
[THREAD_SAVE_FLAGS="$THREAD_SAVE_FLAGS -mt"])],
[aix*], [
THREAD_SAVE_FLAGS="$THREAD_SAVE_FLAGS -D_THREAD_SAFE"
AS_CASE([$GCC],
[yes], [THREAD_SAVE_FLAGS="$THREAD_SAVE_FLAGS -mthreads"],
[THREAD_SAVE_FLAGS="$THREAD_SAVE_FLAGS -qthreaded"])])
AC_SUBST([thread_safe_flag_spec])
AC_SUBST([THREAD_SAVE_FLAGS])
AC_PROG_INSTALL
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_SETUP
AC_PROG_LIBTOOL
AM_PROG_LIBTOOL
READLINK='readlink -f'
AC_MSG_CHECKING([for $READLINK])
AS_IF([$READLINK /tmp >/dev/null 2>&1],
[],
[READLINK=echo])
AC_MSG_RESULT([$READLINK])
AC_SUBST([READLINK])
translatepath=echo
anttranslatepath=$READLINK
# --with-translatepath
AC_ARG_WITH([translatepath],
[AS_HELP_STRING([--with-translatepath=PROG],
[program to translate paths from configure-time format to execute-time format. Take care that this program can be given paths like ${prefix}/etc which should be translated carefully.])],
[translatepath="$withval"
anttranslatepath="$withval"],
[AS_VAR_IF([cross_compiling], [yes],
[AC_MSG_WARN([Cross compiling, but no --with-translatepath option given])])])
AC_SUBST([translatepath])
# --with-anttranslatepath
AC_ARG_WITH([anttranslatepath],
[AS_HELP_STRING([--with-anttranslatepath=PROG],
[program to translate paths from configure-time format to a format that can be given to the ant program (default: 'readlink -f' or value for --with-translatepath)])],
[anttranslatepath="$withval"])
AC_SUBST([anttranslatepath])
# check whether no (explictly chosen) mutual exclusive combinations
# were made, compatability matrix:
# deb ass opt pro ins
# debug \ C X C C
# assert C \ C C C
# optimize X C \ X X
# profile C C X \ C
# instrument C C X C \
# find conflicts
AS_CASE([x$enable_debug.$enable_optimize.$enable_profile.$enable_instrument],
[xyes.yes.*.*],
[AC_MSG_ERROR([combining --enable-optimize and --enable-debug is not possible])],
[x*.yes.yes.*],
[AC_MSG_ERROR([combining --enable-optimize and --enable-profile is not possible])],
[x*.yes.*.yes],
[AC_MSG_ERROR([combining --enable-optimize and --enable-instrument is not possible])],
# handle defaults after user requests
[xyes.*.*.*], [
enable_debug=yes
AS_VAR_IF([enable_optimize], [no], [],
[disable_optimize="(as debug is enabled)"])
enable_optimize=no
enable_profile=`echo $enable_profile | sed 's:^def_::'`
enable_instrument=`echo $enable_instrument | sed 's:^def_::'`
],
[x*.*.yes.*], [
enable_debug=`echo $enable_debug | sed 's:^def_::'`
AS_VAR_IF([enable_optimize], [no], [],
[disable_optimize="(as profile is enabled)"])
enable_optimize=no
enable_profile=yes
enable_instrument=`echo $enable_instrument | sed 's:^def_::'`
],
[x*.*.*.yes], [
enable_debug=`echo $enable_debug | sed 's:^def_::'`
AS_VAR_IF([enable_optimize], [no], [],
[disable_optimize="(as instrument is enabled)"])
enable_optimize=no
enable_profile=`echo $enable_profile | sed 's:^def_::'`
enable_instrument=yes
],
[x*.*no.*.*], [
enable_debug=`echo $enable_debug | sed 's:^def_::'`
enable_optimize=no
enable_profile=`echo $enable_profile | sed 's:^def_::'`
enable_instrument=`echo $enable_instrument | sed 's:^def_::'`
],
[x*.*yes.*.*], [
# enable-optimize overrules other defaults
enable_optimize=yes
AS_VAR_IF([enable_debug], [no], [],
[disable_debug="(as optimize is enabled)"])
enable_debug=no
AS_VAR_IF([enable_profile], [no], [],
[disable_profile="(as optimize is enabled)"])
enable_profile=no
AS_VAR_IF([enable_instrument], [no], [],
[disable_instrument="(as optimize is enabled)"])
enable_instrument=no
],
[x*],
[AC_MSG_WARN([unhandled configuration $enable_debug.$enable_optimize.$enable_profile.$enable_instrument, please file a bug on bugs.monetdb.org])])
# make defaults real for flags which don't conflict with anything
enable_assert=`echo $enable_assert | sed 's:^def_::'`
AC_MSG_CHECKING([for --enable-debug])
AS_VAR_IF([enable_debug], [yes], [
origCFLAGS=$CFLAGS
# remove "-Ox" as some compilers don't like "-g -Ox" combinations
CFLAGS=" $CFLAGS "
CFLAGS=`echo "$CFLAGS" | sed -e 's| -O[[0-9]] | |g' -e 's| -g | |g' -e 's|^ ||' -e 's| $||'`
# add "-g"
CFLAGS="$CFLAGS -g"
AS_CASE([$GCC-$host_os],
[yes-aix*], [CFLAGS="$CFLAGS -gxcoff"])
changedCFLAGS=
for flag in $origCFLAGS ; do
AS_CASE([" $CFLAGS "],
[*" $flag "*], [],
[changedCFLAGS="$changedCFLAGS, removed $flag"])
done
for flag in $CFLAGS ; do
AS_CASE([" $origCFLAGS "],
[*" $flag "*], [],
[changedCFLAGS="$changedCFLAGS, added $flag"])
done
changedCFLAGS=`echo $changedCFLAGS | sed -e 's|^, ||'`
AC_MSG_RESULT([$enable_debug: $changedCFLAGS])],
[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([for --enable-assert])
AS_VAR_IF([enable_assert], [no], [
AC_DEFINE([NDEBUG], 1, [Define if you do not want assertions])
AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])])
AC_MSG_CHECKING([for --enable-optimize])
AS_VAR_IF([enable_optimize], [yes], [
origCFLAGS="$CFLAGS"
# remove "-g" as some compilers don't like "-g -Ox" combinations
# remove "-O2" as we add "-Ox" and some compilers don't like "-Oy -Ox" combinations
CFLAGS=" $CFLAGS "
CFLAGS=`echo "$CFLAGS" | sed -e 's| -g | |g' -e 's| -O2 | |g' -e 's|^ ||' -e 's| $||'`
# Optimization flags
AS_CASE([$GCC-$CC_ver],
[yes-clang-*],
[CFLAGS="$CFLAGS -O3 -fomit-frame-pointer" # -finline-functions is no longer supported in llvm 3.6
],
[yes-*], [
# -fomit-frame-pointer crashes memprof
# -O1 on gcc enables all slight optimisations:
# -fauto-inc-dec -fcprop-registers -fdce -fdefer-pop
# -fdelayed-branch -fdse -fguess-branch-probability
# -fif-conversion2 -fif-conversion -fipa-pure-const
# -fipa-reference -fmerge-constants -fsplit-wide-types
# -ftree-builtin-call-dce -ftree-ccp -ftree-ch
# -ftree-copyrename -ftree-dce -ftree-dominator-opts
# -ftree-dse -ftree-forwprop -ftree-fre -ftree-phiprop
# -ftree-sra -ftree-pta -ftree-ter -funit-at-a-time
# on top of this -fomit-frame-pointer is enabled on machines
# where this does not interfere with debugging.
# -O2 on gcc enables optimisations which do not involve a
# speed-space tradeoff on top of -O1:
# -fthread-jumps -falign-functions -falign-jumps
# -falign-loops -falign-labels -fcaller-saves -fcrossjumping
# -fcse-follow-jumps -fcse-skip-blocks
# -fdelete-null-pointer-checks -fexpensive-optimizations
# -fgcse -fgcse-lm -finline-small-functions
# -findirect-inlining -fipa-sra -foptimize-sibling-calls
# -fpeephole2 -fregmove -freorder-blocks -freorder-functions
# -frerun-cse-after-loop -fsched-interblock -fsched-spec
# -fschedule-insns -fschedule-insns2 -fstrict-aliasing
# -fstrict-overflow -ftree-switch-conversion -ftree-pre
# -ftree-vrp
# (Gentoo enables -D_FORTIFY_SOURCE=2 starting at -O2)
# -O3 on gcc enables some more expensive optimisations on top
# of -O2:
# -finline-functions, -funswitch-loops,
# -fpredictive-commoning, -fgcse-after-reload,
# -ftree-vectorize and -fipa-cp-clone
CFLAGS="-O3 -fomit-frame-pointer -pipe ${CFLAGS}"
# because we explicitly disable debugging, we can explicitly
# enable -fomit-frame-pointer here
# notes on -funroll-all-loops:
# - does nothing on i?86-linux and
# x86_64-linux
# - speeds up and causes crashes on
# powerpc-linux
# - slows down and makes output incorrect on
# sparc-solaris
# - speeds up and fixes some outputs on
# sparcv9-solaris
# notes on -fast for Darwin:
# - ppc: -fast switch causes arithmetic
# differences, and slower running code for
# SQL, some faster for M5
# - x86/x64: -fast switch results in json
# code producing wrong results, or
# segfaults (when used with Mtest)
],
[
AS_CASE([$host-$icc_ver],
dnl handle non-Intel compilers ($icc_ver=""), first
[*solaris*-], [CFLAGS="$CFLAGS -xO5"],
[*-*-*-], [CFLAGS="$CFLAGS -O2"],
dnl With icc-8.*, Interprocedural (IP) Optimization does not seem to work with MonetDB:
dnl With "-ipo -ipo_obj", pass-through linker options ("-Wl,...") are not handled correctly,
dnl and with "-ip -ipo_obj", the resulting Mserver segfaults immediately.
dnl Hence, we skip Interprocedural (IP) Optimization with icc-8.*.
[x86_64-*-*-8.*], [CFLAGS="$CFLAGS -mp1 -O3 -restrict -unroll -tpp7 -axWP "],
[x86_64-*-*-9.*], [CFLAGS="$CFLAGS -mp1 -O3 -restrict -unroll -tpp7 -axWP "],
dnl [x86_64-*-*-10.*], [CFLAGS="$CFLAGS -mp1 -O1 -restrict -unroll -axWPT "], # K.O.!
dnl [x86_64-*-*-10.*], [CFLAGS="$CFLAGS "], # OK.
dnl [x86_64-*-*-10.*], [CFLAGS="$CFLAGS -mp1 "], # OK.
dnl [x86_64-*-*-10.*], [CFLAGS="$CFLAGS -O1 "], # K.O.!
dnl [x86_64-*-*-10.*], [CFLAGS="$CFLAGS -O2 "], # OK.
[x86_64-*-*-10.*], [CFLAGS="$CFLAGS -O3 "], # OK.
dnl [x86_64-*-*-10.*], [CFLAGS="$CFLAGS -restrict "],
dnl [x86_64-*-*-10.*], [CFLAGS="$CFLAGS -unroll "],
dnl [x86_64-*-*-10.*], [CFLAGS="$CFLAGS -axWPT "],
# We need to use -mp instead of -mp1 as
# otherwise nextafter() & nextafterf() do
# not work correctly for 0
[x86_64-*-*-11.*], [CFLAGS="$CFLAGS -mp -O3 -restrict -unroll -axSSE4.2"],
# -mp does no longer exist with icc 15;
# using -mieee-fp, instead. adding
# -axSSE4.2 (or even -axCORE-AVX512)
# results in errors like "error: ODBCFetch
# has been targeted for automatic cpu
# dispatch" ...
[x86_64-*-*-15.*], [CFLAGS="$CFLAGS -mieee-fp -O3 -restrict -unroll -no-inline-max-size -no-inline-max-total-size -inline-level=1 -xHost"],
[i*86-*-*-8.*], [CFLAGS="$CFLAGS -mp1 -O3 -restrict -unroll -tpp6 -axKWNPB"],
[i*86-*-*-9.*], [CFLAGS="$CFLAGS -mp1 -O3 -restrict -unroll -tpp6 -axKWNPB"],
dnl [i*86-*-*-10.*], [CFLAGS="$CFLAGS -mp1 -O1 -restrict -unroll -axWPT "], # K.O.!
dnl [i*86-*-*-10.*], [CFLAGS="$CFLAGS "], # OK.