-
Notifications
You must be signed in to change notification settings - Fork 85
/
configure.ac
3342 lines (3054 loc) · 103 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
### configure.ac -*- Autoconf -*-
###
### Process this file with autoconf to produce a configure script.
###
### Copyright (C) 1998-2024 R Core Team
###
### This file is part of R.
###
### R is free software; you can redistribute it and/or modify it under
### the terms of 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.
###
### R 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 a copy of the GNU General Public License
### along with R; if not, a copy is available at
### https://www.r-project.org/Licenses/
AC_PREREQ([2.72])
## We want to get the version number from file 'VERSION' (rather than
## specifying the version info in 'configure.ac'. Hence, we need a bit
## of M4 magic. Note that M4 esyscmd has a trailing newline because the
## shell command output has one, hence the patsubst() trick.
m4_define([R_VERSION],
m4_bpatsubst(m4_esyscmd([cat VERSION]),
[\([0-9.]*\)\(\w\|\W\)*],
[\1]))
AC_INIT([R],[R_VERSION],[https://bugs.r-project.org],[R],[https://www.r-project.org])
AC_CONFIG_SRCDIR([src/include/Defn.h])
AC_CONFIG_AUX_DIR([tools])
### * Information on the package.
dnl ## Automake initialization.
dnl Not needed, and possibly resulting in non-portable configure scripts
dnl with hard-wired Automake API numbers (aclocal-1.x) ...
dnl AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
dnl Nevertheless, we need to provide PACKAGE and VERSION ...
PACKAGE=[${PACKAGE_NAME}]
AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE}", [Name of package])
AC_SUBST(PACKAGE)
VERSION=[${PACKAGE_VERSION}]
AC_DEFINE_UNQUOTED(VERSION, "${VERSION}", [Version number of package])
AC_SUBST(VERSION)
MAJ_MIN_VERSION=`echo ${VERSION} | sed 's/\.[[0-9]]$//'`
AC_SUBST(MAJ_MIN_VERSION)
## Autoheader initialization.
AH_TOP([#ifndef R_CONFIG_H
#define R_CONFIG_H])
AH_BOTTOM([
#endif /* not R_CONFIG_H */])
## We call AC_GNU_SOURCE early (it is a prerequisite for the gettext
## macros), so all the C compiling makes use of that. Nowadays it calls
## AC_USE_SYSTEM_EXTENSIONS ....
## This sets _GNU_SOURCE, so glibc defines all its extensions
## (_POSIX_C_SOURCE, _XOPEN_SOURCE, _BSD_SOURCE, __USE_MISC) and these
## unlock declarations of non-C99 functions and constants.
## Ditto for __EXTENSIONS__ on Solaris and _ALL_SOURCE on AIX.
### ** Platform.
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED(R_PLATFORM, "${host}",
[Define this to be the canonical name (cpu-vendor-os) of your system.])
AC_DEFINE_UNQUOTED(R_CPU, "${host_cpu}",
[Define this to be the name of the CPU of your system.])
AC_DEFINE_UNQUOTED(R_VENDOR, "${host_vendor}",
[Define this to be the name of the vendor of your system.])
AC_DEFINE_UNQUOTED(R_OS, "${host_os}",
[Define this to be the name of the OS of your system.])
## exclude some unsupported OSes
case "${host_os}" in
## Darwin 1.3.1 was macOS 10.0, 1.4.1 was 10.1, 5 is 10.2 etc
## with 19 being 10.15 (Catalina) and 20 being 11 (Big Sur)
## We no longer support < 10.6 (Snow Leopard, Darwin 10)
## https://en.wikipedia.org/wiki/Darwin_OS
darwin1.*)
AC_MSG_ERROR([The earliest supported macOS is 10.6.]
;;
darwin[[56789]]*)
AC_MSG_ERROR([The earliest supported macOS is 10.6.]
;;
aix[[123]]*|aix4.[[01]]*)
## These need a form of linking we no longer support
AC_MSG_ERROR([AIX prior to 4.2 is not supported])
;;
esac
R_PLATFORM="${host}"
AC_SUBST(R_PLATFORM)
dnl config.guess deliberately overrides the cpu/arch as repoorted by
dnl uname -m (or -p) to use one almost unknown to Mac users. So
dnl we need a macro for a more familiar name.
MAC_CPU=
case "${host_os}" in
darwin*)
case "${host_cpu}" in
aarch64)
MAC_CPU="arm64"
;;
*)
MAC_CPU="${host_cpu}"
;;
esac
AC_SUBST(MAC_CPU)
;;
esac
R_OS="${host_os}"
AC_SUBST(R_OS)
case "${host_os}" in
mingw*|windows*|winnt|msys)
AC_DEFINE(Win32, 1,
[Define according to your operating system type.])
R_OSTYPE="windows"
;;
*)
AC_DEFINE(Unix, 1,
[Define according to your operating system type.])
R_OSTYPE="unix"
;;
esac
AC_SUBST(R_OSTYPE)
R_CONFIG_ARGS="${ac_configure_args}"
AC_SUBST(R_CONFIG_ARGS)
## Shortcut for musl which refuses to identify itself at C level
if test "${host_os}" == "linux-musl"; then
AC_DEFINE(OS_MUSL, 1, [Define if running on Linux-musl])
fi
### ** Defaults.
## NB: autoconf loads such files too
cfile="${srcdir}/config.site"
if test -r "${cfile}"; then
echo "loading site script '${cfile}'"
. "${cfile}"
fi
cfile="${HOME}/.R/config"
if test -r "${cfile}"; then
echo "loading user script '${cfile}'"
. "${cfile}"
fi
cfile="./config.site"
if test -r "${cfile}"; then
echo "loading build-specific script '${cfile}'"
. "${cfile}"
fi
## We need to establish suitable defaults for a 64-bit OS
libnn=lib
case "${host_os}" in
linux*)
## Not all distros use this: some choose to march out of step
## Allow for ppc64le (Debian calls ppc64el), powerpc64le ...
case "${host_cpu}" in
x86_64|mips64|ppc64*|powerpc64*|sparc64|s390x)
## Debian/Ubuntu has "lib64", but the primary location is "lib"
if test -d /usr/lib64 && test ! -f /etc/debian_version; then
libnn=lib64
fi
;;
esac
;;
solaris*)
## libnn=lib/sparcv9 ## on 64-bit only, but that's compiler-specific
;;
esac
: ${LIBnn=$libnn}
## We provide these defaults so that headers and libraries in
## '/usr/local' are found (by the native tools, mostly).
if test -f "/sw/etc/fink.conf"; then
: ${CPPFLAGS="-I/sw/include -I/usr/local/include"}
: ${LDFLAGS="-L/sw/lib -L/usr/local/lib"}
else
: ${CPPFLAGS="-I/usr/local/include"}
: ${LDFLAGS="-L/usr/local/${LIBnn}"}
fi
AC_SUBST(LIBnn)
## take care not to override the command-line setting
if test "${libdir}" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/${LIBnn}'
fi
## R installation directories
m4_divert_once([HELP_BEGIN], [
R installation directories:
--libdir=DIR R files to R_HOME=DIR/R @<:@EPREFIX/$LIBnn@:>@
rdocdir=DIR R doc files to DIR @<:@R_HOME/doc@:>@
rincludedir=DIR R include files to DIR @<:@R_HOME/include@:>@
rsharedir=DIR R share files to DIR @<:@R_HOME/share@:>@])dnl
if test -z "${rdocdir}"; then
rdocdir='${rhome}/doc'
fi
AC_SUBST([rdocdir])
if test -z "${rincludedir}"; then
rincludedir='${rhome}/include'
fi
AC_SUBST([rincludedir])
if test -z "${rsharedir}"; then
rsharedir='${rhome}/share'
fi
AC_SUBST([rsharedir])
### ** Handle arguments to configure.
config_opts="${ac_configure_args}"
AC_SUBST(config_opts)
### ** Optional features.
## Allow the user to specify support for R profiling.
AC_ARG_ENABLE([R-profiling],
[AS_HELP_STRING([--enable-R-profiling],[attempt to compile support for Rprof() @<:@yes@:>@])],
[if test "${enableval}" = no; then
want_R_profiling=no
elif test "${enableval}" = yes; then
want_R_profiling=yes
else
want_R_profiling=yes
fi],
[want_R_profiling=yes])
## Allow the user to specify support for memory profiling.
AC_ARG_ENABLE([memory-profiling],
[AS_HELP_STRING([--enable-memory-profiling],[attempt to compile support for Rprofmem(), tracemem() @<:@no@:>@])],
[if test "${enableval}" = no; then
want_memory_profiling=no
elif test "${enableval}" = yes; then
want_memory_profiling=yes
else
want_memory_profiling=no
fi],
[want_memory_profiling=no])
## Allow the user to specify building an R framework (Darwin).
AC_ARG_ENABLE([R-framework],
[AS_HELP_STRING([--enable-R-framework@<:@=DIR@:>@],[macOS only: build R framework (if possible), and specify
its installation prefix @<:@no, /Library/Frameworks@:>@])],
[want_R_framework="${enableval}"],
[want_R_framework=no])
## Can only build frameworks on Darwin.
if test "${want_R_framework}" != no; then
case "${host_os}" in
darwin*)
if test "${want_R_framework}" = yes; then
## If we build a framework and 'prefix' was not given, we need
## to set it to '/Library/Frameworks' rather than '/usr/local'.
## Note that Autoconf sets things up so that by default, prefix
## and exec_prefix are set to 'NONE'. Let's hope for no change.
if test "x${prefix}" = xNONE; then
prefix="/Library/Frameworks"
fi
else
prefix="${want_R_framework}"
want_R_framework=yes
fi
## FW_VERSION is the sub-directory name used in R.framework/Version
## By default it's the a.b form of the full a.b.c version to simplify
## binary updates.
: ${FW_VERSION=`echo "${PACKAGE_VERSION}" | sed -e "s/[[\.]][[0-9]]$//"`}
;;
*)
want_R_framework=no
;;
esac
fi
AM_CONDITIONAL(WANT_R_FRAMEWORK, [test "x${want_R_framework}" = xyes])
## Allow the user to specify building R as a shared library.
## (but a 'dynamic library' in the terminology of macOS).
## <NOTE>
## Building a framework implies building R shared libraries, hence the
## strange default.
## We might want to warn about the case where '--disable-R-shlib' was
## given explicitly ...
## </NOTE>
AC_ARG_ENABLE([R-shlib],
[AS_HELP_STRING([--enable-R-shlib],[build the shared/dynamic library 'libR' @<:@no@:>@])],
[want_R_shlib="${enableval}"],
[want_R_shlib="${want_R_framework}"])
AM_CONDITIONAL(WANT_R_SHLIB, [test "x${want_R_shlib}" = xyes])
AC_ARG_ENABLE([R-static-lib],
[AS_HELP_STRING([--enable-R-static-lib],[build the static library 'libR.a' @<:@no@:>@])],
[want_R_static="${enableval}"],
[want_R_static="no"])
if test "x${want_R_static}" = xyes; then
if test "x${want_R_shlib}" = xyes; then
AC_MSG_WARN([--enable-R-static-lib conflicts with --enable-R-shlib and will be ignored])
want_R_static=no
fi
fi
AM_CONDITIONAL(WANT_R_STATIC, [test "x${want_R_static}" = xyes])
## Build separate shared/dynamic library containing R's BLAS if desired
AC_ARG_ENABLE([BLAS-shlib],
[AS_HELP_STRING([--enable-BLAS-shlib],[build BLAS into a shared/dynamic library @<:@perhaps@:>@])],
[use_blas_shlib="${enableval}"],
[use_blas_shlib="unset"])
## As from R 3.2.0 split up -L... and -lR
if test "${want_R_shlib}" = yes; then
LIBR0="-L\"\$(R_HOME)/lib\$(R_ARCH)\""
LIBR1=-lR
else
LIBR0=
LIBR1=
fi
## Enable maintainer-specific portions of Makefiles.
AC_ARG_ENABLE([maintainer-mode],
[AS_HELP_STRING([--enable-maintainer-mode],[enable make rules and dependencies not useful (and
maybe confusing) to the casual installer @<:@no@:>@])],
[use_maintainer_mode="${enableval}"],
[use_maintainer_mode=no])
AM_CONDITIONAL(MAINTAINER_MODE, [test "x${use_maintainer_mode}" = xyes])
## Enable testing the write barrier.
AC_ARG_ENABLE([strict-barrier],
[AS_HELP_STRING([--enable-strict-barrier],[provoke compile error on write barrier violation
@<:@no@:>@])],
[use_strict_barrier="${enableval}"],
[use_strict_barrier=no])
if test x"${use_strict_barrier}" = xyes; then
AC_DEFINE(TESTING_WRITE_BARRIER, 1,
[Define to enable provoking compile errors on write barrier
violation.])
fi
AC_ARG_ENABLE([prebuilt-html],
[AS_HELP_STRING([--enable-prebuilt-html],[build static HTML help pages @<:@no@:>@])],
[want_prebuilt_html="${enableval}"],
[want_prebuilt_html=no])
AM_CONDITIONAL(BUILD_HTML, [test "x${want_prebuilt_html}" = xyes])
AC_ARG_ENABLE([lto],
[AS_HELP_STRING([--enable-lto],[enable link-time optimization @<:@no@:>@])],
[want_lto="${enableval}"], [want_lto=no])
ltoall=no
dnl Allow to be set to empty, although what would be the point?
if test "${LTO+set}" = set; then
uLTO="${LTO}"
else
uLTO=-flto
fi
dnl Might well want to set to empty
if test "${LTO_FC+set}" = set; then
uLTO_FC="${LTO_FC}"
else
uLTO_FC="${uLTO}"
fi
if test "x${want_lto}" = xyes; then
ltoall=yes
LTO="${uLTO}"
LTOALL="${uLTO}"
LTO_FC="${uLTO_FC}"
LTOALL_FC="${uLTO_FC}"
elif test "x${want_lto}" = xR; then
LTO="${uLTO}"
LTO_FC="${uLTO_FC}"
elif test "x${want_lto}" = xcheck; then
AC_MSG_WARN([--enable-lto=check has been withdrawn and will be ignored])
want_lto=no
elif test "x${want_lto}" != xno; then
AC_MSG_WARN([Unknown value --enable-lto=${enableval}])
want_lto=no
fi
if test "x${want_lto}" = xno; then
dnl unset as inadvertent settings will at best slow down R build.
LTO=
LTOALL=
LTO_FC=
LTOALL_FC=
LTO_LD=
fi
AC_SUBST(LTO)
AC_SUBST(LTOALL)
AC_SUBST(LTO_FC)
AC_SUBST(LTOALL_FC)
AC_SUBST(LTO_LD)
## used in src/main/Makefile
AM_CONDITIONAL(BUILD_LTO, [test "x${want_lto}" != xno])
AM_CONDITIONAL(BUILD_LTO_ALL, [test "x${ltoall}" = xyes])
## needed for some versions of icx, but we do not know which
AC_SUBST(INTEL_ICX_FIX)
AC_ARG_ENABLE([java],
[AS_HELP_STRING([--enable-java],[enable Java @<:@yes@:>@])],
[want_java="${enableval}"],
[want_java=yes])
AM_CONDITIONAL(WANT_JAVA, [test "x${want_java}" = xyes])
### ** Optional packages.
## BLAS.
AC_ARG_WITH([blas],
[AS_HELP_STRING([--with-blas],[use system BLAS library (if available), or specify it @<:@unset@:>@])],
[R_ARG_USE(blas)],
[use_blas=unset])
## LAPACK.
AC_ARG_WITH([lapack],
[AS_HELP_STRING([--with-lapack],[use system LAPACK library (if available), or specify it @<:@unset@:>@])],
[R_ARG_USE(lapack)],
[use_lapack=unset])
## Readline.
AC_ARG_WITH([readline],
[AS_HELP_STRING([--with-readline],[use readline library @<:@yes@:>@])],
[R_ARG_USE(readline)],
[use_readline=yes])
## PCRE2.
AC_ARG_WITH([pcre2],
[AS_HELP_STRING([--with-pcre2],[use PCRE2 library (if available) @<:@yes@:>@])],
[R_ARG_USE(pcre2)],
[use_pcre2=yes])
## PCRE1.
AC_ARG_WITH([pcre1],
[AS_HELP_STRING([--with-pcre1],[use PCRE1 library (if available and PCRE2 is not) @<:@yes@:>@])],
[R_ARG_USE(pcre1)],
[use_pcre1=no])
## Aqua.
AC_ARG_WITH([aqua],
[AS_HELP_STRING([--with-aqua],[macOS only: use Aqua (if available) @<:@yes@:>@])],
[if test "${withval}" = no; then
want_aqua=no
else
want_aqua=yes
fi],
[want_aqua=yes])
## Tcl/Tk.
AC_ARG_WITH([tcltk],
[AS_HELP_STRING([--with-tcltk],[use Tcl/Tk (if available), or specify its library dir @<:@yes@:>@])],
[if test "${withval}" = no; then
want_tcltk=no
elif test "${withval}" = yes; then
want_tcltk=yes
else
want_tcltk=yes
LDFLAGS="${LDFLAGS} -L${withval}"
tcltk_prefix="${withval}"
fi],
[want_tcltk=yes])
AC_ARG_WITH([tcl-config],
[AS_HELP_STRING([--with-tcl-config=TCL_CONFIG],[specify location of tclConfig.sh @<:@@:>@])],
[TCL_CONFIG="${withval}"],
[TCL_CONFIG=""])
AC_ARG_WITH([tk-config],
[AS_HELP_STRING([--with-tk-config=TK_CONFIG],[specify location of tkConfig.sh @<:@@:>@])],
[TK_CONFIG="${withval}"],
[TK_CONFIG=""])
## cairographics etc
AC_ARG_WITH([cairo],
[AS_HELP_STRING([--with-cairo],[use cairo (and pango) if available @<:@yes@:>@])],
[if test "${withval}" = no; then
want_cairo=no
else
want_cairo=yes
fi], [want_cairo=yes])
## other libraries
AC_ARG_WITH([libpng],
[AS_HELP_STRING([--with-libpng],[use libpng library (if available) @<:@yes@:>@])],
[R_ARG_USE(libpng)],
[use_libpng=yes])
AC_ARG_WITH([jpeglib],
[AS_HELP_STRING([--with-jpeglib],[use jpeglib library (if available) @<:@yes@:>@])],
[R_ARG_USE(jpeglib)],
[use_jpeglib=yes])
AC_ARG_WITH([libtiff],
[AS_HELP_STRING([--with-libtiff],[use libtiff library (if available) @<:@yes@:>@])],
[R_ARG_USE(libtiff)],
[use_libtiff=yes])
AC_ARG_WITH([system-tre],
[AS_HELP_STRING([--with-system-tre],[use system tre library (if available) @<:@no@:>@])],
[R_ARG_USE_SYSTEM(tre)],
[use_system_tre=no])
## Valgrind instrumentation
AC_ARG_WITH([valgrind-instrumentation],
[AS_HELP_STRING([--with-valgrind-instrumentation],[Level of additional instrumentation for Valgrind (0/1/2) @<:@0@:>@])],
[valgrind_level=${withval}],
[valgrind_level=0])
AC_ARG_WITH([system-valgrind-headers],
[AS_HELP_STRING([--with-system-valgrind-headers],[defunct])],
[AC_MSG_WARN([--with-system-valgrind-headers is defunct])])
AC_ARG_WITH([internal-tzcode],
[AS_HELP_STRING([--with-internal-tzcode],[use internal time-zone code @<:@no, yes on macOS@:>@])],
[use_internal_tzcode=${withval}],
[use_internal_tzcode=default])
AC_ARG_WITH([internal-towlower],
[AS_HELP_STRING([--with-internal-towlower],[use internal code for towlower/upper @<:@no, yes on macOS@:>@])],
[use_internal_towlower=${withval}],
[use_internal_towlower=default])
AC_ARG_WITH([internal-iswxxxxx],
[AS_HELP_STRING([--with-internal-iswxxxxx],[use internal iswprint etc. @<:@no, yes on macOS@:>@])],
[use_internal_iswxxxxx=${withval}],
[use_internal_iswxxxxx=default])
AC_ARG_WITH([internal-wcwidth],
[AS_HELP_STRING([--with-internal-wcwidth],[use internal wcwidth @<:@yes@:>@])],
[use_internal_wcwidth=${withval}],
[use_internal_wcwidth=yes])
AC_ARG_WITH([internal-tzcode],
[AS_HELP_STRING([--with-internal-tzcode],[use internal time-zone code @<:@no, yes on macOS@:>@])],
[use_internal_tzcode=${withval}],
[use_internal_tzcode=default])
## <FIXME>
## Completely disable using libtool for building shlibs until libtool
## fully supports Fortran and C++.
## AC_ARG_WITH([libtool],
## [AS_HELP_STRING([--with-libtool],[use libtool for building shared libraries @<:@yes@:>@])],
## [use_libtool="${withval}"],
## [use_libtool=yes])
## AM_CONDITIONAL(USE_LIBTOOL, [test "x${use_libtool}" = xyes])
## </FIXME>
## Recommended R packages.
AC_ARG_WITH([recommended-packages],
[AS_HELP_STRING([--with-recommended-packages],[use/install recommended R packages @<:@yes@:>@])],
[R_ARG_USE(recommended_packages)],
[use_recommended_packages=yes])
## ICU
AC_ARG_WITH([ICU],
[AS_HELP_STRING([--with-ICU],[use ICU library (if available) @<:@yes@:>@])],
[R_ARG_USE(ICU)],
[use_ICU=yes])
## Byte-compilation of packages.
AC_ARG_ENABLE([byte-compiled-packages],
[AS_HELP_STRING([--enable-byte-compiled-packages],
[byte-compile base and recommended packages @<:@yes@:>@])],
[want_byte_compiled_packages="${enableval}"],
[want_byte_compiled_packages=yes])
AM_CONDITIONAL(BYTE_COMPILE_PACKAGES,
[test "x${want_byte_compiled_packages}" = xyes])
AC_ARG_WITH([static-cairo],
[AS_HELP_STRING([--with-static-cairo],[allow for the use of static cairo libraries @<:@no, yes on macOS@:>@])],
[use_static_cairo=${withval}],
[use_static_cairo=default])
if test "x$use_static_cairo" = xdefault; then
case "${host_os}" in
darwin*)
use_static_cairo=yes
;;
*)
use_static_cairo=no
;;
esac
fi
### ** Precious variables.
AC_ARG_VAR([R_PRINTCMD],
[command used to spool PostScript files to the printer])
AC_ARG_VAR([R_PAPERSIZE],
[paper size for the local (PostScript) printer])
AC_ARG_VAR([R_BATCHSAVE],
[set default behavior of R when ending a session])
AC_ARG_VAR([MAIN_CFLAGS],
[additional CFLAGS used when compiling the main binary])
AC_ARG_VAR([SHLIB_CFLAGS],
[additional CFLAGS used when building shared objects])
AC_ARG_VAR([MAIN_FFLAGS],
[additional FFLAGS used when compiling the main binary])
AC_ARG_VAR([SHLIB_FFLAGS],
[additional FFLAGS used when building shared objects])
AC_ARG_VAR([MAIN_LD],
[command used to link the main binary])
AC_ARG_VAR([MAIN_LDFLAGS],
[flags which are necessary for loading a main program which
will load shared objects (DLLs) at runtime])
AC_ARG_VAR([CPICFLAGS],
[special flags for compiling C code to be turned into a
shared object.])
AC_ARG_VAR([FPICFLAGS],
[special flags for compiling Fortran code to be
turned into a shared object.])
AC_ARG_VAR([SHLIB_LD],
[command for linking shared objects which contain object
files from a C or Fortran compiler only])
AC_ARG_VAR([SHLIB_LDFLAGS],
[special flags used by SHLIB_LD])
AC_ARG_VAR([DYLIB_LD],
[command for linking dynamic libraries which contain object
files from a C or Fortran compiler only])
AC_ARG_VAR([DYLIB_LDFLAGS],
[special flags used for make a dynamic library])
AC_ARG_VAR([CXXPICFLAGS],
[special flags for compiling C++ code to be turned into a
shared object])
AC_ARG_VAR([SHLIB_CXXLD],
[command for linking shared objects which contain object
files from the C++ compiler])
AC_ARG_VAR([SHLIB_CXXLDFLAGS],
[special flags used by SHLIB_CXXLD])
AC_ARG_VAR([TCLTK_LIBS],
[flags needed for linking against the Tcl and Tk libraries])
AC_ARG_VAR([TCLTK_CPPFLAGS],
[flags needed for finding the tcl.h and tk.h headers])
AC_ARG_VAR([MAKE], [make command])
AC_ARG_VAR([TAR], [tar command])
AC_ARG_VAR([R_BROWSER], [default browser])
AC_ARG_VAR([R_PDFVIEWER], [default PDF viewer])
AC_ARG_VAR([BLAS_LIBS],
[flags needed for linking against external BLAS libraries])
AC_ARG_VAR([LAPACK_LIBS],
[flags needed for linking against external LAPACK libraries])
AC_ARG_VAR([LIBnn], ['lib' or 'lib64' for dynamic libraries])
AC_ARG_VAR([SAFE_FFLAGS],
[Safe Fortran fixed-form compiler flags for e.g. dlamc.f])
AC_ARG_VAR([r_arch],
[Use architecture-dependent subdirs with this name])
AC_ARG_VAR([DEFS], [C defines for use when compiling R])
AC_ARG_VAR([JAVA_HOME],
[Path to the root of the Java environment])
AC_ARG_VAR([R_SHELL],
[shell to be used for shell scripts, including 'R'])
if test -z "${r_arch}"; then
R_ARCH=
R_INCLUDES="-I\"\$(R_INCLUDE_DIR)\""
else
R_ARCH="/${r_arch}"
R_INCLUDES="-I\"\$(R_INCLUDE_DIR)\" -I\"\$(R_INCLUDE_DIR)/${r_arch}\""
fi
AC_DEFINE_UNQUOTED(R_ARCH, "${r_arch}",
[Define this to use architecture-dependent subdirectories of this name.])
AC_SUBST([R_ARCH])
AC_SUBST([R_INCLUDES])
### ** Check whether we build in srcdir.
AC_PATH_PROG(GETWD, pwd, pwd)
AC_MSG_CHECKING([whether builddir is srcdir])
if test "`cd \"${srcdir}\" && ${GETWD}`" = "`${GETWD}`"; then
BUILDDIR_IS_SRCDIR=yes
else
BUILDDIR_IS_SRCDIR=no
fi
AC_SUBST(BUILDDIR_IS_SRCDIR)
AC_MSG_RESULT([${BUILDDIR_IS_SRCDIR}])
### * Checks for programs.
AC_PROG_LN_S
R_PROG_AR
R_PROG_INSTALL
## we would like a POSIX sed, and need one on Solaris
AC_PATH_PROGS(SED, sed, /bin/sed, [/usr/xpg4/bin:$PATH])
## 'which' is not POSIX, and might be a shell builtin or alias
## (but should not be in 'sh')
AC_PATH_PROGS(WHICH, which, which)
if test "${WHICH}" = which ; then
## needed to build and run R
## ends up hard-coded in the utils package
AC_MSG_ERROR([[which is required but missing]])
fi
## Make
: ${MAKE=make}
AC_SUBST(MAKE)
## Pager
R_PROG_PAGER
## Tar -- we prefer a GNU version
AC_PATH_PROGS(TAR, [${TAR} gtar gnutar tar], "")
## TeXMF stuff
R_PROG_TEXMF
## Unzip & zip & gzip & bip2
AC_PATH_PROGS(R_UNZIPCMD, [${UNZIP} unzip], "")
AC_PATH_PROGS(R_ZIPCMD, [${ZIP} zip], "")
AC_PATH_PROGS(R_GZIPCMD, [${GZIP} gzip], true)
AC_PATH_PROGS(R_BZIPCMD, [${BZIP} bzip2], "")
## Browser
R_PROG_BROWSER
## PDF viewer
R_PROG_PDFVIEWER
## Noweb (notangle), aclocal, autoconf, autoheader - maintainer mode only
R_MISSING_PROG(ACLOCAL, aclocal,
R_MNT_WARN([[aclocal is missing - aclocal.m4 cannot be updated!]])
)
R_MISSING_PROG(AUTOCONF, autoconf,
R_MNT_WARN([[autoconf is missing - configure cannot be updated!]])
)
R_MISSING_PROG(AUTOHEADER, autoheader,
R_MNT_WARN([[autoheader is missing - header file templates like config.h.in cannot be updated!]])
)
AC_PROG_YACC
if test "${YACC}" = yacc ; then
## yacc is the default value even when yacc is not found
AC_CHECK_PROG(JUSTYACC, yacc, yes)
if test "x${JUSTYACC}" != xyes ; then
R_MNT_WARN([[yacc is missing - parsers cannot be updated!]])
fi
fi
AC_PATH_PROG(NOTANGLE, notangle, false)
if test "${NOTANGLE}" = false ; then
R_MNT_WARN([[notangle is missing - byte-code compiler source cannot be updated!]])
NOTANGLE=notangle
fi
## javareconf needs this
AC_PATH_PROG(REALPATH, realpath, false)
## Search for cairographics needs pkg-config,
## helps find jpeg, libpng and libtiff.
AC_PATH_PROGS(PKG_CONFIG, [ pkg-config pkgconf ], [])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config (or pkgconf) utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's default search path])
AC_PROG_CC
dnl AC_PROG_GCC_TRADITIONAL
AC_USE_SYSTEM_EXTENSIONS ## see note above
AC_PROG_CPP
R_PROG_CPP_CPPFLAGS
## As from R 3.6.0, use the modern Fortran compiler for .f files
echo "looking for a modern Fortran compiler"
## if user set FFLAGS but not FCFLAGS, default to former
if test "${FFLAGS+set}" = set -a "${FCFLAGS+set}" != set; then
FCFLAGS=${FFLAGS}
fi
AC_PROG_FC
if test -z "${FC}"; then
AC_MSG_ERROR([No Fortran compiler found])
fi
F77=${FC}
## see if the user set FFLAGS, otherwise use what AC_PROG_FC chose
if test "${FFLAGS+set}" != set; then
FFLAGS=${FCFLAGS}
fi
## This looks for a C++11 compiler: Apple clang++ is not by default
AC_PROG_CXX
## check this actually compiles
R_PROG_CXX
## AC_PROG_CXXCPP looks for limits.h and does not include CPPFLAGS
## CXXCPP is used in other places (not in R), so leave alone CXXCPP itself
AC_PROG_CXXCPP
if test "${CXXCPP}" = "${CXX} -E"; then
CXXCPP0="\$(CXX) -E"
else
CXXCPP0=${CXXCPP}
fi
AC_SUBST(CXXCPP0)
R_GCC4_VISIBILITY
AC_PROG_OBJC
## unfortunately autoconf sets OBJC to gcc even if there is no working compiler
if test "${OBJC}" = gcc; then
AC_LANG_PUSH([Objective C])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[id foo;])],,[OBJC=''])
AC_LANG_POP([Objective C])
fi
## deferred until C++ standard is chosen.
dnl R_PROG_OBJCXX
## This has to be R_DEFS as autoconf overrrides DEFS
R_DEFS=${DEFS}
AC_SUBST(R_DEFS)
CC_SUB=`echo "${CC}" | sed 's/-std=[[^ ]]*//'`
CFLAGS_SUB=`echo "${CFLAGS}" | sed -e 's/-std=[[^ ]]*//'`
dnl echo "CC_SUB = ${CC_SUB}"
dnl echo "CFLAGS_SUB = ${CFLAGS_SUB}"
## Other C standards
CC_save=${CC}
CFLAGS_save=${CFLAGS}
: ${CC17="${CC_SUB} -std=gnu17"}
: ${C17FLAGS="${CFLAGS_SUB}"}
CC=${CC17}
CFLAGS=${C17FLAGS}
R_C17
if test x${r_cv_C17} = xno; then
unset r_cv_C17
CC17="${CC_SUB} -std=gnu11"
CC=${CC17}
R_C17
fi
if test x${r_cv_C17} = xno; then
CC17=
C17FLAGS=
fi
AC_SUBST(CC17)
AC_SUBST(C17FLAGS)
dnl this is a hack until -std=gnu23 is widely accepted.
: ${CC23="${CC_SUB} -std=gnu23"}
: ${C23FLAGS="${CFLAGS_SUB}"}
CC=${CC23}
CFLAGS=${C23FLAGS}
unset r_cv_C23
R_C23
if test x${r_cv_C23} = xno; then
unset r_cv_C23
CC23="${CC_SUB} -std=gnu2x"
CC=${CC23}
R_C23
fi
if test x${r_cv_C23} = xno; then
CC23=
C23FLAGS=
fi
AC_SUBST(CC23)
AC_SUBST(C23FLAGS)
: ${CC90="${CC_SUB} -std=gnu90"}
: ${C90FLAGS="${CFLAGS_SUB}"}
CC=${CC90}
CFLAGS=${C90FLAGS}
R_C90
if test x${r_cv_C90} = xno; then
CC90=
C90FLAGS=
fi
AC_SUBST(CC90)
AC_SUBST(C90FLAGS)
: ${CC99="${CC_SUB} -std=gnu99"}
: ${C99FLAGS="${CFLAGS_SUB}"}
CC=${CC99}
CFLAGS=${C99FLAGS}
R_C99
if test x${r_cv_C99} = xno; then
CC99=
C99FLAGS=
fi
AC_SUBST(CC99)
AC_SUBST(C99FLAGS)
CC=${CC_save}
CFLAGS=${CFLAGS_save}
## Libtool.
## (Run this after selecting the Fortan compiler as AC_PROG_LIBTOOL
## checks for a Fortran 77 compiler and sets F77 accordingly.)
AC_DISABLE_STATIC
LT_INIT
AC_SUBST(LIBTOOL_DEPS)
### * Checks for libraries.
## Set up LD_LIBRARY_PATH or equivalent.
## <FIXME>
## What is this doing *HERE*?
## Should be needed for tests using AC_RUN_IFELSE()?
## Make sure that non-standard directories specified via '-L' are really
## searched in the tests.
## OTOH, R_LD_LIBRARY_PATH in the environment is meant to be the final version.
R_LD_LIBRARY_PATH_save=${R_LD_LIBRARY_PATH}
R_LD_LIBRARY_PATH=
case "${host_os}" in
darwin*)
## Darwin provides a full path in the ID of each library such
## that the linker can add library's path to the binary at link time.
## This allows the dyld to find libraries even without xx_LIBRARY_PATH.
## No paths should be added to R_LD_LIBRARY_PATH (which in turn
## changes DYLD_LIBRARY_PATH), because they override the system
## look-up sequence. Such automatic override has proven to break things
## like system frameworks (e.g. ImageIO or OpenGL framework).
## Not so bad in later versions of Darwin,
## where DYLD_FALLBACK_LIBRARY_PATH is used (see below).
;;
*)
for arg in ${LDFLAGS}; do
case "${arg}" in
-L*)
lib=`echo ${arg} | sed "s/^-L//"`
R_SH_VAR_ADD(R_LD_LIBRARY_PATH, [${lib}], [${PATH_SEPARATOR}])
;;
esac
done
;;
esac
## Record name of environment variable which tells the dynamic linker
## where to find shlibs (typically, 'LD_LIBRARY_PATH').
## Used in etc/ldpaths: As from R 3.0.0 override what libtool thinks on macOS
## http://hublog.hubmed.org/archives/001192.html suggests this was in 10.4
## However, as from 10.11 this variable is not passed down to shells.
case "${host_os}" in
darwin*)
Rshlibpath_var=DYLD_FALLBACK_LIBRARY_PATH
;;
cygwin*|mingw*|windows*|winnt|msys)
Rshlibpath_var=PATH
;;
*)
Rshlibpath_var=${shlibpath_var}
esac
AC_SUBST(shlibpath_var)
## Export LD_LIBRARY_PATH or equivalent.
if eval "test -z \"\${${Rshlibpath_var}}\""; then
eval "${Rshlibpath_var}=\"${R_LD_LIBRARY_PATH}\""
else
eval "${Rshlibpath_var}=\"${R_LD_LIBRARY_PATH}${PATH_SEPARATOR}\${${Rshlibpath_var}}\""
fi
eval "export ${Rshlibpath_var}"
AC_SUBST(Rshlibpath_var)
## record how to strip shared/dynamic libraries.
: ${STRIP_SHARED_LIB="${striplib}"}
## record how to strip static libraries.
: ${STRIP_STATIC_LIB="${old_striplib}"}
AC_SUBST(STRIP_SHARED_LIB)
AC_SUBST(STRIP_STATIC_LIB)
## <NOTE>
## This actually comes from libtool.m4.
LT_LIB_M
AC_SUBST(LIBM)
## </NOTE>
## LT_LIB_M computes LIBM but does not add to LIBS, hence we do
## the following as well.
## This gives: 'sin' is a builtin with type 'double (double)'
AC_CHECK_LIB(m, sin)
AC_CHECK_LIB(dl, dlopen)
## Readline.
if test "${use_readline}" = yes; then
dnl in libedit both headers exist as links to editline/readline.h
AC_CHECK_HEADERS(readline/history.h readline/readline.h)
r_save_LIBS="${LIBS}"
LIBS=
## don't use the cached value as we need to rebuild LIBS
unset ac_cv_lib_readline_rl_callback_read_char
AC_CHECK_LIB(readline, rl_callback_read_char)
use_readline="${ac_cv_lib_readline_rl_callback_read_char}"
if test "${use_readline}" = no; then
## only need ncurses if libreadline is not statically linked against it
unset ac_cv_lib_readline_rl_callback_read_char
## FIXME replace main, maybe by tputs
AC_CHECK_LIB(ncurses, main, [],
AC_CHECK_LIB(tinfo, main, [],
AC_CHECK_LIB(termcap, main, [],
AC_CHECK_LIB(termlib, main))))
AC_CHECK_LIB(readline, rl_callback_read_char)
use_readline="${ac_cv_lib_readline_rl_callback_read_char}"
if test "${use_readline}" = yes; then
use_readline="${ac_cv_header_readline_readline_h}"
fi
fi
if test "${use_readline}" = no; then
AC_MSG_ERROR([--with-readline=yes (default) and headers/libs are not available])
else
## the NetBSD emulation (libedit) supplied by macOS did not have these,
## but it does now (10.13) have history_truncate_file
## it has tilde_expand, which is documented to be like tilde_expand_word
## 'does tilde expansion of strings of type ``~user/foo''
AC_CHECK_FUNCS(history_truncate_file tilde_expand_word)
## rl_completion_matches is >= 4.2 (emulation has it)
## rl_resize_terminal is >= 4.0 but we use it only for >= 6.3.
## rl_sort_completion_matches is >= 6.0 (not in emulation)
R_CHECK_FUNCS([rl_completion_matches rl_resize_terminal rl_sort_completion_matches],
[#include <stdio.h>
#include <readline/readline.h>]
)
fi
READLINE_LIBS="${LIBS}"
LIBS="${r_save_LIBS}"
fi
AC_SUBST(READLINE_LIBS)