-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathconfigure.ac
3491 lines (3258 loc) · 106 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
# -*- 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 - 2016 MonetDB B.V.
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT([MonetDB], [11.21.19], [[email protected]], [MonetDB], [http://www.monetdb.org/])
AC_CONFIG_AUX_DIR([buildtools/conf])
AC_CONFIG_MACRO_DIR([buildtools/conf])
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
dnl 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])
if test x"$target_os" = xcygwin; then
AC_DEFINE(WIN32, 1, [Define on Microsoft Windows (also under Cygwin)])
fi
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
if test x"$PKG_CONFIG" = x ; then
AC_MSG_ERROR([pkg-config is required to configure MonetDB])
fi
dnl VERSION_TO_NUMBER macro (copied from libxslt)
AC_DEFUN([MONETDB_VERSION_TO_NUMBER],
[`$1 | sed 's|[[_\-]][[a-zA-Z0-9]]*$||' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
# BUILD and SOURCE are *only* used for monetdb-config and RunMserver
# SOURCE is the absolute path name of the source directory
# (srcdir can be relative)
# 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
if test "${prefix}x" = "NONEx"; then
Qprefix="${ac_default_prefix}"
else
Qprefix="${prefix}"
fi
Qprefix="`echo "$Qprefix" | sed 's/\\\\/\\\\\\\\/g'`"
AC_SUBST(Qprefix)
# exec_prefix is created very late, so let make do the expansion
if test "${exec_prefix}x" = "NONEx"; then
Qexec_prefix='${prefix}'
else
Qexec_prefix="`echo "$exec_prefix" | sed 's/\\\\/\\\\\\\\/g'`"
fi
AC_SUBST(Qexec_prefix)
if test -f "$srcdir"/vertoo.data; then
dnl Developers compiling from Mercurial:
dnl 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
else
dnl Users compiling from source tarball(s):
dnl 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
fi
dnl small hack to get icc -no-gcc, done here because AC_PROG_CC shouldn't
dnl set GCC=yes if we use icc.
case "$CC" in
*icc*-no-gcc*) ;;
*icc*)
dnl Since version 8.0, ecc/ecpc are also called icc/icpc,
dnl and icc/icpc requires "-no-gcc" to avoid predefining
dnl __GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__ macros.
icc_ver="`$CC -dumpversion 2>/dev/null`"
case $icc_ver in
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";;
*) AC_MSG_WARN([icc ($CC) $icc_ver not handled, yet]);;
esac
;;
esac
AC_DEFINE(MONETDB_RELEASE, "Jul2015-SP4", [Release name or "unreleased"])
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)
case "$enable_gdk-$enable_monetdb5" in
no-yes)
AC_MSG_ERROR([MonetDB5 requires GDK.])
;;
no-auto)
enable_monetdb5=no
disable_monetdb5="(MonetDB5 requires GDK.)"
;;
esac
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_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)
case "$enable_monetdb5-$enable_sql" in
no-yes)
AC_MSG_ERROR([MonetDB/SQL requires MonetDB5.])
;;
no-auto)
enable_sql=no
disable_sql="(MonetDB/SQL requires MonetDB5.)"
;;
esac
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)
case "$enable_monetdb5-$enable_geom" in
no-yes)
AC_MSG_ERROR([geom module requires MonetDB5])
;;
no-auto)
enable_geom=no
disable_geom="(geom module requires MonetDB5)"
;;
esac
dft_microhttpd=no
AC_ARG_ENABLE(microhttpd,
AS_HELP_STRING([--enable-microhttpd],
[enable support for the builtin MircoHTTPD daemon]),
enable_microhttpd=$enableval,
enable_microhttpd=$dft_microhttpd)
dft_gsl=auto
AC_ARG_ENABLE(gsl,
AS_HELP_STRING([--enable-gsl],
[enable support for GSL (default=auto)]),
enable_gsl=$enableval,
enable_gsl=$dft_gsl)
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_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_testing=auto
AC_ARG_ENABLE(testing,
AS_HELP_STRING([--enable-testing],
[enable support for testing (default=auto)]),
enable_testing=$enableval,
enable_testing=$dft_testing)
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)
dnl The console is a direct client hooked onto the kernel with full
dnl administrative privileges, bypassing any security checks. It is
dnl handy only during development.
dnl We simply can't disable it for now because Testing gets hopelessly
dnl upset about it, but we can offer to the user to disable it for
dnl 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)
if test x$enable_console != xno ; then
AC_DEFINE([HAVE_CONSOLE], 1, [If the console should be used])
fi
dft_jdbc=auto
AC_ARG_ENABLE(jdbc,
AS_HELP_STRING([--enable-jdbc], [build the MonetDB JDBC driver]),
enable_jdbc="$enableval",
enable_jdbc=$dft_jdbc)
case $enable_jdbc in
yes|auto) ;;
*) enable_jdbc=no;;
esac
dft_control=auto
AC_ARG_ENABLE(merocontrol,
AS_HELP_STRING([--enable-merocontrol], [build the Merovingian control driver]),
enable_control="$enableval",
enable_control=$dft_control)
case $enable_control in
yes|auto) ;;
*) enable_control=no;;
esac
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]))
dnl RIPEMD160 is patent free, academic and European, but unfortunately
dnl can't use it by default, as that would exclude JDBC usage (Java
dnl 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")
case "$password_backend" in
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])
;;
esac
AC_DEFINE_UNQUOTED([MONETDB5_PASSWDHASH], "$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)
dnl 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/)]),
[case "$withval" in
yes|no|auto)
AC_MSG_WARN([--with-logdir called without argument - will use default])
;;
*)
logdir="$withval"
;;
esac]
)
dnl 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/)]),
[case "$withval" in
yes|no|auto)
AC_MSG_WARN([--with-rundir called without argument - will use default])
;;
*)
rundir="$withval"
;;
esac]
)
dnl 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()
dnl check for compiler (also set GCC (yes/no)).
AC_PROG_CC()
dnl What do we need to get the msg_control and msg_controllen fields on
dnl struct msg (filedescriptor passing)? In the future this could be a
dnl check to see if we can find it, such that we can disable it compile
dnl time if absent. It looks however, as if it's available everywhere
dnl we try where UNIX domain sockets also exist. So we go by the
dnl following simple implementation for now.
case $host in
*-solaris*)
dnl Solaris needs this to get msg_control and msg_controllen
dnl it disables, however, the availability of madvise, which is
dnl in use use by GDK, so we cannot just AC_DEFINE this, but
dnl rather have to enable it where it is necessary
MSGCONTROL_FLAGS="-D_XOPEN_SOURCE=500"
AC_SUBST(MSGCONTROL_FLAGS)
;;
esac
dnl (try to) determine compiler type (gcc, icc, clang) (and version)
dnl independent of call ($CC) and result of AC_PROG_CC() ($GCC)
dnl (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`"
case "$CC_version" in
*\(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*)
dnl `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`"
case "$CC_V" in
*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
])
;;
esac
;;
esac
AC_MSG_RESULT($CC_ver)
dnl sanity/consistency check
case "$GCC!$CC!$CC_ver" in
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
]);;
esac
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)
oids=$bits
AC_ARG_ENABLE(oid32,
AS_HELP_STRING([--enable-oid32],
[use 32 bits for OIDs on a 64-bit architecture]),
enable_oid32=$enableval,
enable_oid32=no)
AC_MSG_CHECKING(size of OIDs)
case $bits-$enable_oid32 in
64-yes) AC_DEFINE(MONET_OID32, 1, [Define if the oid type should use 32 bits on a 64-bit architecture])
oids=32
;;
esac
AM_CONDITIONAL(BITS64OID32, test x"$bits-$enable_oid32" = x64-yes)
AC_SUBST(oids)
AC_MSG_RESULT($oids bits)
AC_C_BIGENDIAN()
LINUX_DIST=''
case "$host_os" in
linux*)
dnl Please keep this aligned / in sync with testing/Mtest.py.in !
AC_MSG_CHECKING(which Linux distribution we're using)
if test -s /etc/os-release; then
# 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}`
elif test -s /etc/fedora-release ; then
LINUX_DIST="`cat /etc/fedora-release | head -n1 \
| sed 's|^.*\(Fedora\).* release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`"
elif test -s /etc/centos-release ; then
LINUX_DIST="`cat /etc/centos-release | head -n1 \
| sed 's|^\(CentOS\).* release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`"
elif test -s /etc/yellowdog-release ; then
LINUX_DIST="`cat /etc/yellowdog-release | head -n1 \
| sed 's|^\(Yellow\) Dog Linux release \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`"
elif test -s /etc/redhat-release ; then
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|'`"
elif test -s /etc/SuSE-release ; then
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|'`"
elif test -s /etc/gentoo-release ; then
LINUX_DIST="`cat /etc/gentoo-release | head -n1 \
| sed 's|^.*\(Gentoo\) Base System.* [[versionrelease]]* \([[0-9]][[^ \n]]*\)\( .*\)*$|\1:\2|'`"
elif test -s /etc/lsb-release ; then
LINUX_DIST="`grep '^DISTRIB_ID=' /etc/lsb-release | cut -d'=' -f2`:`grep '^DISTRIB_RELEASE=' /etc/lsb-release | cut -d'=' -f2`"
elif test -s /etc/debian_version ; then
LINUX_DIST="Debian:`cat /etc/debian_version | head -n1`"
else
LINUX_DIST="`uname -s`:`uname -r | sed 's|^\([[0-9\.]]*\)\([[^0-9\.]].*\)$|\1|'`"
fi
LINUX_DIST="`echo "$LINUX_DIST" | sed 's|:||'`"
AC_MSG_RESULT($LINUX_DIST)
;;
esac
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\""
])
dnl --enable-strict
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)
dnl Set compiler switches.
dnl The idea/goal is to be as strict as possible, i.e., enable preferably
dnl *all* warnings and make them errors. This should help keep the code
dnl as clean and portable as possible.
dnl It turned out, though, that this, especially turning all warnings into
dnl errors, is a bit too ambitious for configure/autoconf. Hence, we set
dnl all flags that enable specific warnings and those that make the
dnl compiler die on them (-Werror) in X_CFLAGS, which are added to the
dnl standard CFLAGS once configure/autoconf are done with their job,
dnl i.e., at the end of this configure[.ag] script.
dnl Only GNU (gcc) and Intel ([ie]cc/[ie]cpc on Linux) are done so far.
: ${X_CFLAGS=} # initialize to empty if not set
if test "x$enable_strict" = xyes; then
case "$GCC-$CC-$host_os" in
yes-*-*)
MCHECK_ADD_FLAG([-Werror]) dnl keep this one first
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])
dnl With clang 2.8, 3.3, 5.0 (no other tested) and gcc < 4.5
dnl (tested 3.4.6, 4.2.1, 4.3.2, 4.4.4, 4.4.5, 4.5.1, 4.5.2),
dnl "-Wunreachable-code" triggers numerous "will never be
dnl executed" (at least) in our stream code, mostly (if
dnl not all) false positives, though, as well as in
dnl YACC/BISON-generated code; thus, we do not use
dnl "-Wunreachable-code" with clang and gcc < 4.5 .
dnl At the same time, Apple deprecated OpenSSL in favour of
dnl their own CommonCrypto API. We don't mind about that.
case "$CC_ver" in
clang-*|gcc-[[0-3]].*|gcc-4.[[0-4]].*)
MCHECK_ADD_FLAG([-Wno-deprecated-declarations])
;;
*)
MCHECK_ADD_FLAG([-Wunreachable-code])
;;
esac
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*)
dnl Intel ([ie]cc/[ie]cpc on Linux)
case $icc_ver in
?.*) LDFLAGS="$LDFLAGS -i_dynamic";;
??.*) LDFLAGS="$LDFLAGS -shared-intel";;
esac
dnl Let warning #140 "too many arguments in function call"
dnl become an error to make configure tests work properly.
CFLAGS="$CFLAGS -we140"
dnl Let warning #147 "declaration is incompatible"
dnl become an error to make configure tests work properly.
CFLAGS="$CFLAGS -we147"
dnl Check for PIC does not work with Version 8.1, unless we disable
dnl remark #1418: external definition with no prior declaration ... !?
case $icc_ver in
8.1*) CFLAGS="$CFLAGS -wd1418" ;;
9.*) CFLAGS="$CFLAGS -wd1418" ;;
10.*) CFLAGS="$CFLAGS -wd1418" ;;
11.*) CFLAGS="$CFLAGS -wd1418" ;;
*) ;;
esac
dnl Version 8.* doesn't find sigset_t when -ansi is set... !?
case $icc_ver in
8.*) ;;
9.*) ;;
10.*) ;;
11.*) ;;
15.*) ;;
*) CFLAGS="$CFLAGS -ansi";;
esac
dnl Be picky; "-Werror" seems to be too rigid for autoconf...
CFLAGS="$CFLAGS -Wall -w2 -Wcheck"
dnl Be rigid; MonetDB code is supposed to adhere to this... ;-)
dnl Let the follows remarks and warning become errors:
dnl #266: "function declared implicitly"
dnl #181: "argument is incompatible with corresponding format string conversion"
dnl #810: "conversion from "." to "." may lose significant bits"
dnl #111: "statement is unreachable"
dnl #271: "trailing comma is nonstandard"
dnl #593: "variable "." was set but never used"
X_CFLAGS="$X_CFLAGS -we266,181,810,271,593"
X_CFLAGS="$X_CFLAGS -Werror -Werror-all"
dnl ... however, some things aren't solved, yet:
dnl (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"
dnl ICC 11 & 15 warn about non-pointer conversion from "<type>" to
dnl "<smaller>" may lose significant bits, it does however, also for
dnl constants like short s = 1234, which is too much
case $icc_ver in
11.*) X_CFLAGS="$X_CFLAGS,2259" ;;
15.*) X_CFLAGS="$X_CFLAGS,2259" ;;
esac
case $icc_ver in
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" ;;
esac
dnl #1418: external definition with no prior declaration
dnl #1419: external declaration in primary source file
dnl # 981: operands are evaluated in unspecified order
dnl # 193: zero used for undefined preprocessing identifier
dnl #1357: optimization disabled due to excessive resource requirements; contact Intel Premier Support for assistance
dnl #1572: floating-point equality and inequality comparisons are unreliable
dnl #1599: declaration hides variable
dnl #2259: non-pointer conversion from "." to "." may lose significant bits
;;
esac
fi
AC_SUBST(CFLAGS)
AC_SUBST(X_CFLAGS)
dnl icc needs -fPIC (but the current autoconf still uses -KPIC)
case "$GCC-$CC-$host_os" in
-*icc*-linux*|-*ecc*-linux*)
case $icc_ver in
10.*) CC="$CC -fPIC" ;;
11.*) CC="$CC -fPIC" ;;
*) ;;
esac
esac
dnl some dirty hacks
THREAD_SAVE_FLAGS="\$(thread_safe_flag_spec) -D_REENTRANT"
# only needed in monet
case "$host_os" in
solaris*)
case "$GCC" in
yes) ;;
*)
THREAD_SAVE_FLAGS="$THREAD_SAVE_FLAGS -mt"
;;
esac
;;
aix*)
THREAD_SAVE_FLAGS="$THREAD_SAVE_FLAGS -D_THREAD_SAFE"
case "$GCC" in
yes)
THREAD_SAVE_FLAGS="$THREAD_SAVE_FLAGS -mthreads"
;;
*)
THREAD_SAVE_FLAGS="$THREAD_SAVE_FLAGS -qthreaded"
;;
esac
;;
esac
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])
$READLINK /tmp >/dev/null 2>&1
if test $? -ne 0; then
READLINK=echo
fi
AC_MSG_RESULT($READLINK)
AC_SUBST(READLINK)
translatepath=echo
anttranslatepath=$READLINK
dnl --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"],
[if test x$cross_compiling = xyes; then
AC_MSG_WARN([Cross compiling, but no --with-translatepath option given])
fi])
AC_SUBST(translatepath)
dnl --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)
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)
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)
dnl check whether no (explictly chosen) mutual exclusive combinations
dnl were made, compatability matrix:
dnl deb ass opt pro ins
dnl debug \ C X C C
dnl assert C \ C C C
dnl optimize X C \ X X
dnl profile C C X \ C
dnl instrument C C X C \
case "x$enable_debug.$enable_optimize.$enable_profile.$enable_instrument" in
# find conflicts
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
if test x$enable_optimize != xno ; then
disable_optimize="(as debug is enabled)"
fi
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_::'`"
if test x$enable_optimize != xno ; then
disable_optimize="(as profile is enabled)"
fi
enable_optimize=no
enable_profile=yes
enable_instrument="`echo $enable_instrument | sed 's:^def_::'`"
;;
x*.*.*.yes)
enable_debug="`echo $enable_debug | sed 's:^def_::'`"
if test x$enable_optimize != xno ; then
disable_optimize="(as instrument is enabled)"
fi
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
if test x$enable_debug != xno ; then
disable_debug="(as optimize is enabled)"
fi
enable_debug=no
if test x$enable_profile != xno ; then
disable_profile="(as optimize is enabled)"
fi
enable_profile=no
if test x$enable_instrument != xno ; then
disable_instrument="(as optimize is enabled)"
fi
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])
;;
esac
# 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])
if test "x$enable_debug" = xyes; then
origCFLAGS=$CFLAGS
dnl 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| $||'`"
JAVACFLAGS=" $JAVACFLAGS "
JAVACFLAGS="`echo "$JAVACFLAGS" | sed -e 's| -O | |g' -e 's| -g | |g' -e 's| -g:[[a-z]]* | |g' -e 's|^ ||' -e 's| $||'`"
dnl add "-g"
CFLAGS="$CFLAGS -g"
JAVACFLAGS="$JAVACFLAGS -g"
case "$GCC-$host_os" in
yes-aix*)
CFLAGS="$CFLAGS -gxcoff"
;;
esac
changedCFLAGS=
for flag in $origCFLAGS ; do
case " $CFLAGS " in
*" $flag "*) ;;
*) changedCFLAGS="$changedCFLAGS, removed $flag";;
esac
done
for flag in $CFLAGS ; do
case " $origCFLAGS " in
*" $flag "*) ;;
*) changedCFLAGS="$changedCFLAGS, added $flag";;
esac
done
changedCFLAGS="`echo $changedCFLAGS | sed -e 's|^, ||'`"
AC_MSG_RESULT([$enable_debug: $changedCFLAGS])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([for --enable-assert])
if test "x$enable_assert" = xno; then
AC_DEFINE(NDEBUG, 1, [Define if you do not want assertions])
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
AC_MSG_CHECKING([for --enable-optimize])
if test "x$enable_optimize" = xyes; then
origCFLAGS="$CFLAGS"
dnl remove "-g" as some compilers don't like "-g -Ox" combinations
dnl 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| $||'`"
JAVACFLAGS=" $JAVACFLAGS "
JAVACFLAGS="`echo "$JAVACFLAGS" | sed -e 's| -g | |g' -e 's| -g:[[a-z]]* | |g' -e 's|^ ||' -e 's| $||'`"
dnl Optimization flags
JAVACFLAGS="$JAVACFLAGS -g:none -O"
case "$GCC-$CC_ver" in
yes-clang-*)
CFLAGS="$CFLAGS -O3 -fomit-frame-pointer" # -finline-functions is no longer supported in llvm 3.6
;;
yes-*)
dnl -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 segaults (when used with Mtest)
;;
*)
case "$host-$icc_ver" in
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.