-
Notifications
You must be signed in to change notification settings - Fork 245
/
configure.ac
1594 lines (1382 loc) · 45.1 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
################################################################################
# preamble
################################################################################
define(FLINT_COPYRIGHT,[[
Copyright (C) 2023, 2024 Albin Ahlbäck
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
]])
define(FLINT_COPYRIGHT_C,[[/*
Copyright (C) 2023, 2024 Albin Ahlbäck
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/]])
# Copyright 1996-2022 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
#
# The GNU MP Library is free software; you can redistribute it and/or modify
# it under the terms of either:
#
# * the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# or
#
# * the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any
# later version.
#
# or both in parallel, as here.
#
# The GNU MP Library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received copies of the GNU General Public License and the
# GNU Lesser General Public License along with the GNU MP Library. If not,
# see https://www.gnu.org/licenses/.
AC_COPYRIGHT(FLINT_COPYRIGHT)
AH_TOP(FLINT_COPYRIGHT_C)
AC_PREREQ(2.62)
m4_define(FLINT_VERSION,m4_include([VERSION]))
AC_INIT(FLINT, FLINT_VERSION, [https://github.com/flintlib/flint/issues/], flint, [https://flintlib.org/])
AC_CONFIG_AUX_DIR([config])
AC_LANG(C)
# Every major version of Flint (1.0, 1.1, 1.2, etc.) gets
# a new major soname number.
# Every time a release happens where interfaces are added
# to Flint, the minor soname number gets incremented.
# Every patch that is made that doesn't change the Flint
# interface updates the patch number.
# However, if backwards incompatible changes are made, both
# the minor and patch numbers are set to 0. (Hopefully this
# doesn't happen in practice.)
# flint => soname
# 2.5.0 => 13.5.0
# 2.5.1 => 13.5.1
# 2.5.2 => 13.5.2
# 2.6.0 => 14.0.0
# 2.6.1 => 14.0.1
# 2.6.2 => 14.0.2
# 2.6.3 => 14.0.3
# 2.7.0 => 15.0.0
# 2.7.1 => 15.0.1
# 2.8.0 => 16.1.0
# 2.8.1 => 16.1.1
# 2.8.2 => 16.1.2
# 2.8.3 => 16.1.3
# 2.8.4 => 16.1.4
# 2.8.5 => 16.1.5
# 2.9.0 => 17.0.0
# 3.0.0 => 18.0.0
# 3.1.0 => 19.0.0
# 3.2.0 => 20.0.0
# NOTE: This must be after AC_INIT
FLINT_MAJOR_SO=20
FLINT_MINOR_SO=0
FLINT_PATCH_SO=0
# Make sure that we are in the right directory
AC_CONFIG_SRCDIR(src/fmpz/link/fmpz_reentrant.c)
# Ensure that source directory is not already configured, so there are no
# clashes between different configurations.
AX_INIT
################################################################################
# initialize libtool
################################################################################
# Later we want to overwrite the default CFLAGS. Check now whether they are set
# or not as Libtool overwrites CFLAGS.
if test -n "${CFLAGS+x}";
then
cflags_set="yes"
else
cflags_set="no"
fi
if test -n "${TESTCFLAGS+x}";
then
testcflags_set="yes"
else
testcflags_set="no"
fi
if test -n "${CXXFLAGS+x}";
then
cxxflags_set="yes"
else
cxxflags_set="no"
fi
LT_INIT([disable-static])
if test "$cflags_set" = "no";
then
CFLAGS=
fi
if test "$cxxflags_set" = "no";
then
CXXFLAGS=
fi
################################################################################
# build system
################################################################################
if test -n "$target_alias";
then
AC_MSG_ERROR([FLINT does not support the use of specifying --target.])
fi
dnl Get system triplet
dnl NOTE: This is already invoked from LT_INIT
dnl AC_CANONICAL_HOST
################################################################################
# configure headers
################################################################################
AC_CONFIG_HEADERS(src/config.h src/flint-config.h)
################################################################################
# features
################################################################################
AC_ARG_ENABLE(pthread,
[AS_HELP_STRING([--enable-pthread],[Enable pthread [default=yes]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-pthread. Need yes or no.])
;;
esac],
enable_pthread="yes")
AC_ARG_ENABLE(reentrant,
[AS_HELP_STRING([--enable-reentrant],[Build reentrant version of library [default=no]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-reentrant. Need yes or no.])
;;
esac],
enable_reentrant="no")
AC_ARG_ENABLE(thread-safe,
[AS_HELP_STRING([--enable-thread-safe],[Enable thread-local storage [default=yes]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-tls. Need yes or no.])
;;
esac],
enable_thread_safe="yes")
if test -n "$enable_tls";
then
AC_MSG_ERROR([--enable-tls is an old feature. Please use --enable-thread-safe instead.])
fi
AC_ARG_ENABLE(assert,
[AS_HELP_STRING([--enable-assert],[Enable use of asserts [default=no]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-assert. Need yes or no.])
;;
esac],
enable_assert="no")
AC_ARG_ENABLE(coverage,
[AS_HELP_STRING([--enable-coverage],[Enable test coverage [default=no]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-coverage. Need yes or no.])
;;
esac],
enable_coverage="no")
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],[Compile FLINT with debug information [default=yes]])],
[case $enableval in
yes|no)
if test "$enableval" = "no" && test "$enable_coverage" = "yes";
then
AC_MSG_ERROR([Debug information is required by coverage.])
fi
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-debug. Need yes or no.])
;;
esac],
enable_debug="yes")
AC_ARG_ENABLE(dependency-tracking,
[AS_HELP_STRING([--enable-dependency-tracking],[Enable GCC automated dependency tracking [default=yes]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-dependency-tracking. Need yes or no.])
;;
esac],
enable_dependency_tracking="yes")
AC_ARG_ENABLE(pretty-tests,
[AS_HELP_STRING([--enable-pretty-tests],[Enable pretty printing for tests [default=yes]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-pretty-tests. Need yes or no.])
;;
esac],
enable_pretty_tests="yes")
AC_ARG_ENABLE(gmp-internals,
[AS_HELP_STRING([--enable-gmp-internals],[Enable calling GMP internals directly [default=yes]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-gmp-internals. Need yes or no.])
;;
esac],
enable_gmp_internals="yes")
AC_ARG_ENABLE(assembly,
[AS_HELP_STRING([--enable-assembly],[Enable assembly routines (if available) [default=yes]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-assembly. Need yes or no.])
;;
esac],
enable_assembly="yes")
AC_ARG_ENABLE(avx2,
[AS_HELP_STRING([--enable-avx2],[Enable AVX2 instructions [default=no]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-avx2. Need yes or no.])
;;
esac],
enable_avx2="no")
AC_ARG_ENABLE(avx512,
[AS_HELP_STRING([--enable-avx512],[Enable AVX512 instructions [default=no]])],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-avx512. Need yes or no.])
;;
esac],
enable_avx512="no")
# NOTE: This is maintainer level only. Currently only used for Nemo CI.
AC_ARG_ENABLE(mpfr-check,[],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-mpfr-check. Need yes or no.])
;;
esac],
enable_mpfr_check="yes")
# NOTE: Maintainer level only. Avoids any sort of optimization to speed up
# builds.
AC_ARG_ENABLE(fast-build,[],
[case $enableval in
yes|no)
;;
*)
AC_MSG_ERROR([Bad value $enableval for --enable-fast-build. Need yes or no.])
;;
esac],
enable_fast_build="no")
################################################################################
# packages
################################################################################
AC_ARG_WITH(gmp_include,
[AS_HELP_STRING([--with-gmp-include=DIR],[GMP include directory])],
CPPFLAGS="$CPPFLAGS -I$withval"
gmp_include_path="$withval"
)
AC_ARG_WITH(gmp_lib,
[AS_HELP_STRING([--with-gmp-lib=DIR],[GMP library directory])],
LDFLAGS="$LDFLAGS -L$withval"
gmp_lib_path="$withval"
)
AC_ARG_WITH(gmp,
[AS_HELP_STRING([--with-gmp[[=DIR]]],[GMP install directory])],
if test "$with_gmp" = "no";
then
AC_MSG_FAILURE([The use of GMP is mandatory.])
elif test "$with_gmp" = "yes";
then
:
elif test -z "$gmp_include_path" && test -z "$gmp_lib_path";
then
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
gmp_include_path="$withval/include"
gmp_lib_path="$withval/lib"
with_gmp="yes"
else
AC_MSG_FAILURE([Cannot use --with-gmp along with --with-gmp-include or --with-gmp-lib.])
fi,
with_gmp="yes"
)
AC_ARG_WITH(mpfr_include,
[AS_HELP_STRING([--with-mpfr-include=DIR],[MPFR include directory])],
CPPFLAGS="$CPPFLAGS -I$withval"
mpfr_include_path="$withval"
)
AC_ARG_WITH(mpfr_lib,
[AS_HELP_STRING([--with-mpfr-lib=DIR],[MPFR library directory])],
LDFLAGS="$LDFLAGS -L$withval"
mpfr_lib_path="$withval"
)
AC_ARG_WITH(mpfr,
[AS_HELP_STRING([--with-mpfr[[=DIR]]],[MPFR install directory])],
if test "$with_mpfr" = "no";
then
AC_MSG_FAILURE([The use of MPFR is mandatory.])
elif test "$with_mpfr" = "yes";
then
:
elif test -z "$mpfr_include_path" && test -z "$mpfr_lib_path";
then
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
mpfr_include_path="$withval/include"
mpfr_lib_path="$withval/lib"
with_mpfr="yes"
else
AC_MSG_FAILURE([Cannot use --with-mpfr along with --with-mpfr-include or --with-mpfr-lib.])
fi,
with_mpfr="yes"
)
AC_ARG_WITH(blas_include,
[AS_HELP_STRING([--with-blas-include=DIR],[Use BLAS and specify its include directory])],
CPPFLAGS="$CPPFLAGS -I$withval"
blas_include_path="$withval"
)
AC_ARG_WITH(blas_lib,
[AS_HELP_STRING([--with-blas-lib=DIR],[Use BLAS and specify its library directory])],
LDFLAGS="$LDFLAGS -L$withval"
blas_lib_path="$withval"
)
AC_ARG_WITH(blas,
[AS_HELP_STRING([--with-blas[[=DIR]]],[Use BLAS and specify its install directory])],
if test "$with_blas" = "yes";
then
:
elif test "$with_blas" = "no";
then
if test -n "$blas_include_path" || test -n "$blas_lib_path";
then
AC_MSG_FAILURE([--with-blas-include or --with-blas-lib was specified but --with-blas=no.])
fi
elif test -z "$blas_include_path" && test -z "$blas_lib_path";
then
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
blas_include_path="$withval/include"
blas_lib_path="$withval/lib"
with_blas="yes"
else
AC_MSG_FAILURE([Cannot use --with-blas along with --with-blas-include or --with-blas-lib.])
fi,
with_blas="no"
)
if test "$with_blas" != "no" || test -n "$blas_include_path" || test -n "$blas_lib_path";
then
with_blas="yes"
fi
AC_ARG_WITH(gc_include,
[AS_HELP_STRING([--with-gc-include=DIR],[Use GC and specify its include directory])],
CPPFLAGS="$CPPFLAGS -I$withval"
gc_include_path="$withval",
with_gc_include="no"
)
AC_ARG_WITH(gc_lib,
[AS_HELP_STRING([--with-gc-lib=DIR],[Use GC and specify its library directory])],
LDFLAGS="$LDFLAGS -L$withval"
gc_lib_path="$withval",
with_gc_lib="no"
)
AC_ARG_WITH(gc,
[AS_HELP_STRING([--with-gc[[=DIR]]],[Use GC and optionally specify its install directory])],
if test "$with_gc" = "yes";
then
:
elif test "$with_gc" = "no";
then
if test -n "$gc_include_path" || test -n "$gc_lib_path";
then
AC_MSG_FAILURE([--with-gc-include or --with-gc-lib was specified but --with-gc=no.])
fi
elif test -z "$gc_include_path" && test -z "$gc_lib_path";
then
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
gc_include_path="$withval/include"
gc_lib_path="$withval/lib"
with_gc="yes"
else
AC_MSG_FAILURE([Cannot use --with-gc along with --with-gc-include or --with-gc-lib.])
fi,
with_gc="no"
)
if test "$with_gc" != "no" || test -n "$gc_include_path" || test -n "$gc_lib_path";
then
with_gc="yes"
fi
AC_ARG_WITH(ntl_include,
[AS_HELP_STRING([--with-ntl-include=DIR],[Use NTL (in tests) and specify its include directory])],
CPPFLAGS="$CPPFLAGS -I$withval"
ntl_include_path="$withval"
)
AC_ARG_WITH(ntl_lib,
[AS_HELP_STRING([--with-ntl-lib=DIR],[Use NTL (in tests) and specify its library directory])],
LDFLAGS="$LDFLAGS -L$withval"
ntl_lib_path="$withval"
)
AC_ARG_WITH(ntl,
[AS_HELP_STRING([--with-ntl[[=DIR]]],[Use NTL (in tests) and optionally specify its install directory])],
if test "$with_ntl" = "yes";
then
:
elif test "$with_ntl" = "no";
then
if test -n "$ntl_include_path" || test -n "$ntl_lib_path";
then
AC_MSG_FAILURE([--with-ntl-include or --with-ntl-lib was specified but --with-ntl=no.])
fi
elif test -z "$ntl_include_path" && test -z "$ntl_lib_path";
then
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
ntl_include_path="$withval/include"
ntl_lib_path="$withval/lib"
with_ntl="yes"
else
AC_MSG_FAILURE([Cannot use --with-ntl along with --with-ntl-include or --with-ntl-lib.])
fi,
with_ntl="no"
)
if test "$with_ntl" != "no" || test -n "$ntl_include_path" || test -n "$ntl_lib_path";
then
with_ntl="yes"
fi
################################################################################
# architecture specifics
################################################################################
if test "$enable_fast_build" = "no";
then
gcc_cflags="-O3 "
fi
gcc_cflags="$gcc_cflags-pedantic -std=c11"
gcc_warnings="-Werror=implicit-function-declaration -Wall -Wno-stringop-overread -Wno-stringop-overflow -Wno-maybe-uninitialized"
dnl We only try to provide specifics for those systems that currently supports
dnl our assembly routines. If more combinations are wished for than what is
dnl specified, please open up an issue at
dnl <https://github.com/flintlib/flint/issues/> and we will consider it.
dnl
dnl For these systems we aim to provide:
dnl
dnl gcc_cflags flags for GCC-compatible compilers
dnl
dnl asm_path directory for assembly, relative to src/mpn_extras
dnl param_path directory for flint-mparam.h, relative to src/mpn_extras
dnl
dnl For x86_64 systems, we can also set:
dnl
dnl have_avx512 system has AVX512F and AVX512DQ (we assume this implies have_avx2)
dnl have_avx2 system has AVX2 and FMA
case $host in
ARM64_PATTERN)
gcc_cflags="$gcc_cflags"
gcc_cflags_optlist="arch tune"
asm_path="arm64"
param_path="arm64"
flint_cv_have_fft_small_arm_i="yes"
# NOTE: Cortex values where taken from
# https://developer.arm.com/Processors/Cortex-XXX
case $host_cpu in
armcortexa35 | armcortexa35neon)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=cortex-a35"
;;
armcortexa53 | armcortexa53neon)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=cortex-a53"
;;
armcortexa55 | armcortexa55neon)
gcc_cflags_arch="-march=armv8.2-a"
gcc_cflags_tune="-mtune=cortex-a55"
;;
armcortexa57 | armcortexa57neon)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=cortex-a57"
;;
armcortexa72 | armcortexa72neon)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=cortex-a72"
;;
armcortexa73 | armcortexa73neon)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=cortex-a73"
;;
armcortexa75 | armcortexa75neon)
gcc_cflags_arch="-march=armv8.2-a"
gcc_cflags_tune="-mtune=cortex-a75"
;;
armcortexa76 | armcortexa76neon)
gcc_cflags_arch="-march=armv8.2-a"
gcc_cflags_tune="-mtune=cortex-a76"
;;
armcortexa77 | armcortexa77neon)
gcc_cflags_arch="-march=armv8.2-a"
gcc_cflags_tune="-mtune=cortex-a77"
;;
armcortexa65 | armcortexa65neon)
gcc_cflags_arch="-march=armv8.2-a"
gcc_cflags_tune="-mtune=cortex-a65"
;;
armcortexa34 | armcortexa34neon)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=cortex-a34"
;;
armcortexa78 | armcortexa78neon)
gcc_cflags_arch="-march=armv8.2-a"
gcc_cflags_tune="-mtune=cortex-a78"
;;
armexynosm1)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=exynos-m1"
;;
armthunderx)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=thunderx"
;;
armxgene1)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune="-mtune=xgene1"
;;
applem1*)
gcc_cflags_arch="-march=armv8.5-a"
gcc_cflags_tune=""
;;
applem2*)
gcc_cflags_arch="-march=armv8.6-a"
gcc_cflags_tune=""
;;
applem3*)
gcc_cflags_arch="-march=armv8.6-a"
gcc_cflags_tune=""
;;
aarch64* | armv8*)
gcc_cflags_arch="-march=armv8-a"
gcc_cflags_tune=""
;;
*)
AC_MSG_ERROR([Error in deciding flags for $host.
Please report at <https://github.com/flintlib/flint/issues/>])
;;
esac
;;
X86_64_ADX_PATTERN)
gcc_cflags="$gcc_cflags"
gcc_cflags_optlist="arch"
asm_path="x86_64/broadwell"
param_path="x86_64/broadwell"
have_avx512="no"
have_avx2="yes"
case $host_cpu in
zen)
gcc_cflags_arch="-march=znver1"
param_path="x86_64/zen3"
;;
zen2)
gcc_cflags_arch="-march=znver2"
param_path="x86_64/zen3"
;;
zen3)
gcc_cflags_arch="-march=znver3"
param_path="x86_64/zen3"
;;
zen4)
gcc_cflags_arch="-march=znver4"
param_path="x86_64/zen4"
have_avx512="yes"
;;
coreibwl | broadwell)
gcc_cflags_arch="-march=broadwell"
param_path="x86_64/broadwell"
;;
skylake)
gcc_cflags_arch="-march=skylake"
param_path="x86_64/skylake"
;;
skylake_server)
gcc_cflags_arch="-march=skylake-avx512"
param_path="x86_64/skylake"
have_avx512="yes"
;;
cannonlake)
gcc_cflags_arch="-march=cannonlake"
param_path="x86_64/skylake"
have_avx512="yes"
;;
kabylake)
gcc_cflags_arch="-march=skylake"
param_path="x86_64/skylake"
;;
icelake)
gcc_cflags_arch="-march=icelake-client"
param_path="x86_64/icelake"
have_avx512="yes"
;;
icelake_server)
gcc_cflags_arch="-march=icelake-server"
param_path="x86_64/icelake"
have_avx512="yes"
;;
rocketlake)
gcc_cflags_arch="-march=rocketlake"
param_path="x86_64/skylake"
have_avx512="yes"
;;
tigerlake)
gcc_cflags_arch="-march=tigerlake"
param_path="x86_64/skylake"
have_avx512="yes"
;;
alderlake)
gcc_cflags_arch="-march=alderlake"
param_path="x86_64/skylake"
;;
raptorlake)
gcc_cflags_arch="-march=alderlake"
param_path="x86_64/skylake"
;;
knightslanding)
gcc_cflags_arch="-march=knl"
param_path="x86_64/skylake"
;;
sapphirerapids)
gcc_cflags_arch="-march=sapphirerapids"
param_path="x86_64/skylake"
have_avx512="yes"
;;
cometlake)
gcc_cflags_arch="-march=skylake"
param_path="x86_64/skylake"
;;
*)
AC_MSG_ERROR([Error in deciding flags for $host.
Please report at <https://github.com/flintlib/flint/issues/>])
;;
esac
case $host in
*-*-mingw* | *-*-msys | *-*-cygwin)
flint_nonstd_abi="yes"
asm_path=""
param_path="x86_64"
;;
esac
if test "$have_avx512" = "yes";
then
have_avx2="yes"
fi
if test "$have_avx2" = "yes";
then
flint_cv_have_fft_small_x86_i="yes"
fi
;;
X86_64_PATTERN)
# NOTE: We do not care if the user specifies noavx!
gcc_cflags="$gcc_cflags"
gcc_cflags_optlist="arch"
asm_path=""
param_path="x86_64"
case $host_cpu in
coreiibr | ivybridge)
gcc_cflags_arch="-march=ivybridge"
;;
coreihwl | haswell)
gcc_cflags_arch="-march=haswell"
;;
piledriver | bd2)
gcc_cflags_arch="-march=bdver2"
;;
steamroller | bd3)
gcc_cflags_arch="-march=bdver3"
;;
excavator | bd4)
gcc_cflags_arch="-march=bdver4"
have_avx2="yes"
;;
x86_64v3)
gcc_cflags_arch="-march=x86-64-v3"
have_avx2="yes"
;;
x86_64v4)
gcc_cflags_arch="-march=x86-64-v4"
have_avx512="yes"
;;
esac
if test "$have_avx512" = "yes";
then
have_avx2="yes"
fi
if test "$have_avx2" = "yes";
then
flint_cv_have_fft_small_x86_i="yes"
fi
;;
*)
asm_path=""
param_path="generic"
gcc_cflags="$gcc_cflags"
;;
esac
################################################################################
# programs
################################################################################
dnl NOTE: The following line is invoked from LT_INIT
dnl AC_PROG_CC
AC_PROG_MKDIR_P
FLINT_CC_IS_GCC
FLINT_CC_IS_CLANG
################################################################################
# environment variables
################################################################################
AC_ARG_VAR([TESTCFLAGS], [Choose different C compiler flags for tests [default=CFLAGS]. Can be useful to compile library at a specific optimization level while compiling tests fast.])
################################################################################
# check programs and system
################################################################################
AC_C_INLINE
if test "$compiler_c_o" = "no";
then
AC_MSG_ERROR([Compiler must support both -c and -o simultaneously!])
fi
AC_C_BIGENDIAN(flint_big_endian=yes)
case "$host_os" in
darwin*)
flint_lib="libflint.dylib"
flint_lib_major="libflint.$FLINT_MAJOR_SO.dylib"
flint_lib_full="libflint.$FLINT_MAJOR_SO.$FLINT_MINOR_SO.dylib"
extra_shared_flags="-install_name '`pwd`/$flint_lib_full' -compatibility_version $FLINT_MAJOR_SO.$FLINT_MINOR_SO -current_version $FLINT_MAJOR_SO.$FLINT_MINOR_SO.$FLINT_PATCH_SO"
flint_dylib="yes"
;;
cygwin|mingw*|msys)
flint_lib="libflint.dll"
flint_lib_major="libflint.$FLINT_MAJOR_SO.dll"
flint_lib_full="libflint.$FLINT_MAJOR_SO.$FLINT_MINOR_SO.$FLINT_PATCH_SO.dll"
flint_implib="$flint_lib.$libext"
extra_shared_flags="-static-libgcc $wl--export-all-symbols,--out-implib,$flint_implib"
flint_dlllib="yes"
;;
*)
flint_lib="libflint.so"
flint_lib_major="libflint.so.$FLINT_MAJOR_SO"
flint_lib_full="libflint.so.$FLINT_MAJOR_SO.$FLINT_MINOR_SO.$FLINT_PATCH_SO"
extra_shared_flags="$wl-soname,$flint_lib_major"
flint_solib="yes"
;;
esac
flint_lib_static="libflint.$libext"
if test "`uname -s`" = "android";
then
extra_shared_flags="$wl-soname,$flint_lib"
fi
AC_SUBST(WL,$wl)
AC_SUBST(FLINT_LIB,$flint_lib)
AC_SUBST(FLINT_LIB_MAJOR,$flint_lib_major)
AC_SUBST(FLINT_LIB_FULL,$flint_lib_full)
AC_SUBST(FLINT_IMPLIB,$flint_implib)
AC_SUBST(FLINT_LIB_STATIC,$flint_lib_static)
AC_SUBST(EXTRA_SHARED_FLAGS,$extra_shared_flags)
if test "$flint_dlllib" = "yes";
then
AC_SUBST(FLINT_DLLLIB,1)
else
AC_SUBST(FLINT_DLLLIB,0)
fi
if test "$flint_dylib" = "yes";
then
AC_SUBST(FLINT_DYLIB,1)
else
AC_SUBST(FLINT_DYLIB,0)
fi
if test "$flint_solib" = "yes";
then
AC_SUBST(FLINT_SOLIB,1)
else
AC_SUBST(FLINT_SOLIB,0)
fi
case "$host_os" in
cygwin|mingw*|msys)
if test "$DLLTOOL" = "false";
then
AC_MSG_ERROR(["Couldn't find any dlltool that is required to create import libraries for Windows-type systems."])
fi
;;
esac
dnl FIXME: Improve this check to include more processors.
AC_MSG_CHECKING([if memory is strongly-ordered])
case "$host" in
X86_PATTERN | X86_64_PATTERN)
flint_know_strong_order="yes"
AC_MSG_RESULT([yes])
;;
*)
flint_know_strong_order="no"
AC_MSG_RESULT([unsure])
;;
esac
if test "$flint_know_strong_order" = "yes";
then
AC_DEFINE(FLINT_KNOW_STRONG_ORDER,1,[Define if system is strongly ordered])
fi
################################################################################
# check GMP
################################################################################
FLINT_CHECK_GMP_H(6,2,1)
FLINT_GMP_LONG_LONG_LIMB([SLONG="long long int"
ULONG="unsigned long long int"
gmpcompat_h_in="gmpcompat-longlong.h.in"],
[SLONG="long int"
ULONG="unsigned long int"
gmpcompat_h_in="gmpcompat.h.in"])
AC_SUBST(SLONG)
AC_SUBST(ULONG)
if test "$flint_cv_gmp_long_long_limb" = "yes";
then
AC_DEFINE(FLINT_LONG_LONG,1,[Define to use long long limbs])
fi
AC_CONFIG_LINKS([src/gmpcompat.h:src/$gmpcompat_h_in],[],[gmpcompat_h_in="$gmpcompat_h_in"])
AC_SUBST(GMPCOMPAT_H_IN, $gmpcompat_h_in)
################################################################################
# check MPFR
################################################################################
FLINT_CHECK_MPFR_H(4,1,0)
################################################################################
# check ABI
################################################################################
FLINT_ABI
AC_DEFINE_UNQUOTED(FLINT_BITS,$flint_cv_abi,[Define according to the ABI FLINT was compiled with])
################################################################################
# check headers
################################################################################
# Mandatory headers
# The following headers are checked previously:
# stdio.h stdlib.h stdint.h string.h
AC_CHECK_HEADERS([stdarg.h math.h float.h errno.h],,
AC_MSG_ERROR([Could not find a mandatory header!]))
# Optional headers
# The following headers are checked previously:
# unistd.h
AC_CHECK_HEADERS([fenv.h alloca.h malloc.h sys/param.h windows.h pthread_np.h])
if test "$enable_pthread" = "yes";
then
AC_CHECK_HEADER([pthread.h],,
AC_MSG_ERROR([Could not find pthread.h!]))