forked from wch/r-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
3045 lines (2796 loc) · 92.5 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-2018 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.62)
## 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 13 being 10.9. 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)
R_OS="${host_os}"
AC_SUBST(R_OS)
case "${host_os}" in
mingw*|windows*|winnt)
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)
### ** 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)
if test -d /usr/lib64; 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])
## FIXME: add a test for gcc >= 4.5.0
if test "x${want_lto}" != xno; then
LTO=-flto
fi
if test "x${want_lto}" = xyes; then
LTOALL=-flto
fi
AC_SUBST(LTO)
AC_SUBST(LTOALL)
AM_CONDITIONAL(BUILD_LTO, [test "x${want_lto}" != xno])
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 @<:@no@:>@])],
[R_ARG_USE(blas)],
[use_blas=unset])
# default is "no" except on macOS
## LAPACK.
AC_ARG_WITH([lapack],
[AS_HELP_STRING([--with-lapack],[use system LAPACK library (if available), or specify it @<:@no@:>@])],
[R_ARG_USE(lapack)],
[use_lapack=unset])
# default is "no" except on macOS
## Readline.
AC_ARG_WITH([readline],
[AS_HELP_STRING([--with-readline],[use readline library @<:@yes@:>@])],
[R_ARG_USE(readline)],
[use_readline=yes])
## 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],[use system valgrind headers (if available) @<:@no@:>@])],
[R_ARG_USE_SYSTEM(valgrind)],
[use_system_valgrind=no])
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])
### ** 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([FCPICFLAGS],
[special flags for compiling Fortran 95 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([SHLIB_FCLD],
[command for linking shared objects which contain object
files from the Fortran 95 compiler])
AC_ARG_VAR([SHLIB_FCLDFLAGS],
[special flags used by SHLIB_FCLD])
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 77 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_XTRA_CPPFLAGS2="-I\"\$(R_INCLUDE_DIR)\""
else
R_ARCH="/${r_arch}"
R_XTRA_CPPFLAGS2="-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_XTRA_CPPFLAGS2])
### ** 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)
## 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_TOOL(PKG_CONFIG, pkg-config , [],
[$PATH:/usr/local/bin:/ext/bin:/ext:/sw/bin:/opt/bin])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config 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
AC_PROG_GCC_TRADITIONAL
AC_GNU_SOURCE ## see note above
AC_PROG_CPP
R_PROG_CPP_CPPFLAGS
## see if the user set FFLAGS: used for Intel compilers below
userFFLAGS=${FFLAGS}
R_PROG_F77
AC_PROG_CXX
## check this actually compiles
R_PROG_CXX
### R_PROG_CXX98FLAG
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
R_PROG_OBJCXX
## This has to be R_DEFS as autoconf overrrides DEFS
R_DEFS=${DEFS}
AC_SUBST(R_DEFS)
## Libtool.
## (Run this after R_PROG_F77, as AC_PROG_LIBTOOL checks for a
## Fortran 77 compiler and sets F77 accordingly.)
AC_DISABLE_STATIC
LT_INIT
AC_SUBST(LIBTOOL_DEPS)
## cross-compiling: added May 2007, not actually used
R_CROSS_COMPILING
AC_SUBST(BUILD_CC)
AC_SUBST(BUILD_R)
AM_CONDITIONAL(CROSS_COMPILING, [test "${cross_compiling}" = yes])
### * 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
;;
*)
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.
AC_SUBST(striplib)
## record how to strip static libraries.
stripstaticlib=${old_striplib}
AC_SUBST(stripstaticlib)
## <NOTE>
## This actually comes from libtool.m4.
AC_CHECK_LIBM
AC_SUBST(LIBM)
## </NOTE>
## AC_CHECK_LIBM computes LIBM but does not add to LIBS, hence we do
## the following as well.
AC_CHECK_LIB(m, sin)
case "${host_os}" in
darwin*)
## macOS >= 10.3 include dlcompat in libSystem
## This is ancient history
## SI says we want '-lcc_dynamic' on Darwin, although currently
## https://developer.apple.com/documentation/MacOSX/ has nothing
## official. Bill Northcott <w.northcott@unsw.edu.au> points out
## that it is only needed for GCC 3.x (and earlier) ...
if test "${GCC}" = yes; then
case "${CC_VERSION}" in
2.*|3.*)
AC_MSG_ERROR([Your gcc is too old.])
esac
fi
;;
*)
AC_CHECK_LIB(dl, dlopen)
;;
esac
## Readline.
if test "${use_readline}" = yes; then
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
AC_CHECK_LIB(ncurses, 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 supplied by macOS does not have this
AC_CHECK_FUNCS(history_truncate_file)
## rl_completion_matches is >= 4.2.
## rl_resize_terminal is >= 4.0 ane we use it only for >= 6.3.
## rl_callback_sigcleanup is in pre-releases for 7.0, not yet used.
R_CHECK_FUNCS([rl_callback_sigcleanup 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)
### * Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
## we also assume readdir and closedir
if test "${ac_cv_search_opendir}" = "no"; then
AC_MSG_ERROR([Building R requires the 'opendir' system call])
fi
AC_HEADER_SYS_WAIT
## <NOTE>
## Some of these are also checked for when Autoconf computes the default
## includes.
##
## The following headers are POSIX,
## We use sched.h for Linux-specific features (affinity)
AC_CHECK_HEADERS(dlfcn.h fcntl.h glob.h grp.h pwd.h sched.h strings.h \
sys/resource.h sys/select.h sys/socket.h sys/stat.h sys/time.h \
sys/times.h sys/utsname.h unistd.h utime.h)
## dl.h is used in src/unix/hpdlfcn.c included from src/unix/dynload.c on HP-UX
## features.h is used by date-time code on Linux.
## floatingpoint.h is used for fpsetmask on FreeBSD.
## sys/param.h is one way to get PATH_MAX.
AC_CHECK_HEADERS(arpa/inet.h dl.h elf.h features.h floatingpoint.h \
langinfo.h netdb.h netinet/in.h sys/param.h)
## stdalign.h is C11.
AC_CHECK_HEADERS(stdalign.h)
## These are C99 headers but some C code (written to work also
## without assuming C99) may need the corresponding conditionals.
AC_CHECK_HEADERS(errno.h inttypes.h limits.h locale.h stdarg.h stdbool.h \
stdint.h string.h)
## only vsnprintf.c requires stdarg.h
## We also use without checking sys/sysctl.h, but only on *BSD and macOS
## The default includes check for sys/types.h (POSIX), which we use unconditionally
## </NOTE>
R_HEADER_SETJMP
R_HEADER_GLIBC2
### * Checks for types.
AC_TYPE_SIGNAL
## liblzma uses uint64_t: used unconditionally in src/main/util.c
AC_TYPE_UINT64_T
AC_CHECK_TYPES([int64_t, int_fast64_t])
AC_TYPE_PID_T
AC_TYPE_SIZE_T
R_SIZE_MAX
AC_CHECK_TYPE(blkcnt_t, long)
AH_TEMPLATE([blkcnt_t],
[Define to 'long' if <sys/types.h> does not define.
Apparently necessary to fix a GCC bug on AIX?])
R_TYPE_SOCKLEN
AC_CHECK_TYPES([stack_t], , , [#include <signal.h>])
## These are optional C99 types, which we used to typedef in Defn.h if absent.
## There seems some confusion as to where they should be defined:
## the standard says stdint.h but drafts and Solaris 8 have inttypes.h.
## It seems all systems having stdint.h include it in inttypes.h, and
## POSIX requires that. But we will make sure.
AC_CHECK_TYPES([intptr_t, uintptr_t], , , [#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif])
### * Checks for compiler characteristics.
### ** Generic tests for the C, Fortran 77 and C++ compilers.
### *** C compiler.
R_BIGENDIAN
AC_C_CONST
R_C_INLINE
AC_CHECK_SIZEOF(int)
## on some platforms this gives a trailing lf, so
case "${ac_cv_sizeof_int}" in
4*)
AC_DEFINE(INT_32_BITS, 1, [Define if you have 32 bit ints.])
;;
esac
## This is tested in src/main/arithmetic.c and gives a compile error if false
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(size_t)
AC_ARG_ENABLE([long-double],
[AS_HELP_STRING([--enable-long-double],[use long double type @<:@yes@:>@])],
[if test "${enableval}" = no; then
use_long_double=no
else
use_long_double=yes
fi],
[use_long_double=yes])
dnl also used in intl.
if test "x${use_long_double}" = xyes; then
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you wish to use the 'long double' type.])
AC_CHECK_SIZEOF(long double)
else
AC_MSG_WARN([Not using the 'long double' type])
fi
R_PROG_CC_MAKEFRAG
R_PROG_CC_LO_MAKEFRAG
R_OPENMP
### *** Fortran 77 compiler.
R_PROG_F77_FLIBS
if test -z "$FLIBS_IN_SO"; then
FLIBS_IN_SO=${FLIBS}
fi
AC_SUBST(FLIBS_IN_SO)
R_PROG_F77_APPEND_UNDERSCORE
R_PROG_F77_CAN_RUN
R_PROG_F77_CC_COMPAT
R_PROG_F77_CC_COMPAT_COMPLEX
AM_CONDITIONAL(COMPILE_FORTRAN_DOUBLE_COMPLEX,
[test "x${HAVE_FORTRAN_DOUBLE_COMPLEX}" != x])
AC_LANG_PUSH(Fortran 77)
R_OPENMP
AC_LANG_POP(Fortran 77)
### *** C++ compiler.
R_PROG_CXX_MAKEFRAG
AC_LANG_PUSH(C++)
R_OPENMP
AC_LANG_POP(C++)
### *** ObjC compiler
R_PROG_OBJC_MAKEFRAG
R_PROG_OBJC_RUNTIME
## FSF builds of gcc (and maybe others?) need -fobjc-exceptions otherwise
## @try and friends don't work
R_PROG_OBJC_FLAG([-fobjc-exceptions],
R_SH_VAR_ADD(OBJCFLAGS, [-fobjc-exceptions]))
## FIXME: checks for Foundation are not darwin-specifc at all. In fact the whole
## point of R_OBJC_FOUNDATION is to detect foundation classes on other
## platforms (on Darwin we already *know* that is it -framework Foundation
## but not so on Linux!), so the following was not intended to be conditonal.
case "${host_os}" in
darwin*)
R_OBJC_FOUNDATION
;;
esac
### ** Platform-specific overrides for the C, Fortran 77 and C++ compilers.
case "${host_cpu}" in
i*86|x86_64)
R_PROG_CC_FLAG_D__NO_MATH_INLINES
## We used to add -mieee-fp here, but it seems it is really a
## linker flag for old Linuxen adding -lieee to a non-shared link.
;;
esac
AH_TEMPLATE([HAVE_NO_SYMBOL_UNDERSCORE],
[Define if module-loading does not need an underscore to
be prepended to external names.])
case "${host_os}" in
aix*)
AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
if test "${GCC}" = yes; then
if test "x${OBJECT_MODE}" = "x64"; then
R_PROG_CC_FLAG([-mminimal-toc],
R_SH_VAR_ADD(R_XTRA_CFLAGS, [-mminimal-toc]))
else
R_PROG_CC_FLAG([-mno-fp-in-toc],