forked from gnu-octave/octave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
3373 lines (2864 loc) · 111 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
dnl Process this file with autoconf to produce a configure script.
dnl
########################################################################
##
## Copyright (C) 1993-2023 The Octave Project Developers
##
## See the file COPYRIGHT.md in the top-level directory of this
## distribution or <https://octave.org/copyright/>.
##
## This file is part of Octave.
##
## Octave 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 3 of the License, or
## (at your option) any later version.
##
## Octave 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 Octave; see the file COPYING. If not, see
## <https://www.gnu.org/licenses/>.
##
########################################################################
### Initialize Autoconf
AC_PREREQ([2.65])
AC_INIT([GNU Octave], [9.0.0], [https://octave.org/bugs.html], [octave],
[https://www.gnu.org/software/octave/])
### Declare version numbers
dnl Note that the version number is duplicated here and in AC_INIT because
dnl AC_INIT requires it to be static, not computed from shell variables.
## The description of the Octave version number in the etc/HACKING.md
## explains how to update these numbers for release and development
## versions.
OCTAVE_MAJOR_VERSION=9
OCTAVE_MINOR_VERSION=0
OCTAVE_PATCH_VERSION=0
dnl PACKAGE_VERSION is set by the AC_INIT VERSION argument.
OCTAVE_VERSION="$PACKAGE_VERSION"
OCTAVE_COPYRIGHT="Copyright (C) 1993-2023 The Octave Project Developers."
OCTAVE_RELEASE_DATE="2023-04-13"
## The "API version" is used as a way of checking that interfaces in the
## liboctave and libinterp libraries haven't changed in a backwardly
## incompatible way when loading .oct files. A better way to do this is with
## library versioning, but not all systems support it.
##
## NOTE: This macro will be removed in a future version of Octave!
## If you insist on checking for features using a version number, use the
## OCTAVE_MAJOR_VERSION, OCTAVE_MINOR_VERSION, and OCTAVE_PATCH_VERSION
## macros instead.
dnl
dnl FIXME: Since we also set libtool versions for liboctave and libinterp,
dnl perhaps we should be computing the "api version" from those versions numbers
dnl in some way instead of setting it independently here.
OCTAVE_API_VERSION="api-v58"
AC_SUBST(OCTAVE_MAJOR_VERSION)
AC_SUBST(OCTAVE_MINOR_VERSION)
AC_SUBST(OCTAVE_PATCH_VERSION)
AC_SUBST(OCTAVE_VERSION)
AC_SUBST(OCTAVE_COPYRIGHT)
AC_SUBST(OCTAVE_RELEASE_DATE)
AC_SUBST(OCTAVE_API_VERSION)
dnl FIXME: We should auto-insert the Mercurial changeset ID into the
dnl AC_REVISION field whenever configure.ac is modified.
dnl AC_REVISION($Revision: 1.603 $)
AC_CONFIG_SRCDIR([libinterp/octave.cc])
AC_CONFIG_HEADERS([config.h:config.in.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
### Initialize Automake
AM_INIT_AUTOMAKE([1.14 -Wno-portability -Wno-override tar-ustar subdir-objects dist-lzip dist-xz])
## Add option to enable silent rules and make silent the default behavior.
AM_SILENT_RULES([yes])
OCTAVE_CANONICAL_HOST
AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.])
AC_USE_SYSTEM_EXTENSIONS
### Make configure args available in variable form for other uses.
config_opts=$ac_configure_args
AC_SUBST(config_opts)
### Set default file locations.
## Where to install libraries like liboctave.a, liboctinterp.a, and other
## architecture-dependent binaries.
OCTAVE_SET_DEFAULT([octlibdir], '${libdir}/octave/${version}')
## Where to put executables to be run by Octave, rather than the user.
## This path usually includes the Octave version and configuration name, so
## that configurations for multiple versions of Octave may be installed at once.
## Windows search paths and relocation oddities require all binaries must be
## installed in the same directory.
case $host_os in
mingw* | msdosmsvc)
OCTAVE_SET_DEFAULT([archlibdir], '${bindir}') ;;
*)
OCTAVE_SET_DEFAULT([archlibdir],
'${libexecdir}/octave/${version}/exec/${canonical_host_type}') ;;
esac
## Where to put executables to be run by Octave, rather than the user, that
## are specific to this site.
OCTAVE_SET_DEFAULT([localarchlibdir],
'${libexecdir}/octave/site/exec/${canonical_host_type}')
OCTAVE_SET_DEFAULT([localapiarchlibdir],
'${libexecdir}/octave/${api_version}/site/exec/${canonical_host_type}')
OCTAVE_SET_DEFAULT([localverarchlibdir],
'${libexecdir}/octave/${version}/site/exec/${canonical_host_type}')
## Where to put object files that will by dynamically loaded.
## This path includes the Octave version and configuration name, so that
## configurations for multiple versions of Octave may be installed at once.
OCTAVE_SET_DEFAULT([octfiledir],
'${libdir}/octave/${version}/oct/${canonical_host_type}')
## Directories that Octave should search for object files that will be
## dynamically loaded and that are specific to this site (i.e., customizations),
## before consulting ${octfiledir}. This should be a colon-separated list of
## directories.
OCTAVE_SET_DEFAULT([localoctfiledir],
'${libdir}/octave/site/oct/${canonical_host_type}')
OCTAVE_SET_DEFAULT([localapioctfiledir],
'${libdir}/octave/site/oct/${api_version}/${canonical_host_type}')
OCTAVE_SET_DEFAULT([localveroctfiledir],
'${libdir}/octave/${version}/site/oct/${canonical_host_type}')
## Where to install Octave's include files.
OCTAVE_SET_DEFAULT([octincludedir], '${includedir}/octave-${version}/octave')
## Where to install the function files distributed with Octave.
## This includes the Octave version, so that the function files for different
## versions of Octave will be installed in separate directories.
OCTAVE_SET_DEFAULT([fcnfiledir], '${datadir}/octave/${version}/m')
## Directories that Octave should search for function files specific to this
## site (i.e., customizations), before consulting ${fcnfiledir}.
## This should be a colon-separated list of directories.
OCTAVE_SET_DEFAULT([localfcnfiledir], '${datadir}/octave/site/m')
OCTAVE_SET_DEFAULT([localapifcnfiledir],
'${datadir}/octave/site/${api_version}/m')
OCTAVE_SET_DEFAULT([localverfcnfiledir], '${datadir}/octave/${version}/site/m')
## Where to install extra files like NEWS and doc-cache.
OCTAVE_SET_DEFAULT([octetcdir], '${datadir}/octave/${version}/etc')
## Where to install the language files for the GUI.
OCTAVE_SET_DEFAULT([octlocaledir], '${datadir}/octave/${version}/locale')
## The full path to the default doc-cache file.
OCTAVE_SET_DEFAULT([doc_cache_file], '${octetcdir}/doc-cache')
## Where to install test files.
OCTAVE_SET_DEFAULT([octtestsdir], '${octetcdir}/tests')
## The full path to the default texi macros file.
OCTAVE_SET_DEFAULT([texi_macros_file], '${octetcdir}/macros.texi')
## Where Octave will search to find image files.
OCTAVE_SET_DEFAULT([imagedir], '${datadir}/octave/${version}/imagelib')
## Where Octave will search for example data files shipped with distribution.
OCTAVE_SET_DEFAULT([octdatadir], '${datadir}/octave/${version}/data')
## Where Octave will search for Qt help files shipped with distribution.
OCTAVE_SET_DEFAULT([octdocdir], '${datadir}/octave/${version}/doc')
## Where Octave will search for fallback font files shipped with distribution.
OCTAVE_SET_DEFAULT([octfontsdir], '${datadir}/octave/${version}/fonts')
## Where Octave will look for startup files.
OCTAVE_SET_DEFAULT([startupfiledir], '${fcnfiledir}/startup')
OCTAVE_SET_DEFAULT([localstartupfiledir], '${localfcnfiledir}/startup')
## Where Octave will look for man and info files.
OCTAVE_SET_DEFAULT([man1dir], '${mandir}/man1')
OCTAVE_SET_DEFAULT([man1ext], '.1')
OCTAVE_SET_DEFAULT([infofile], '${infodir}/octave.info')
### Check for programs used in building, installing, and running Octave.
## Programs used in configuring Octave.
dnl Find pkg-config executable (sets $PKG_CONFIG)
PKG_PROG_PKG_CONFIG
## And where we will install our own .pc files.
PKG_INSTALLDIR
AC_SUBST([liboctave_pkgconfigdir], [$pkgconfigdir])
AC_SUBST([libinterp_pkgconfigdir], [$pkgconfigdir])
## Programs used in Makefiles.
AC_PROG_AWK
AC_PROG_GREP
AC_PROG_EGREP
OCTAVE_PROG_FIND
OCTAVE_PROG_SED
OCTAVE_PROG_PERL
## Programs used to build parts of Octave.
OCTAVE_PROG_GPERF
OCTAVE_PROG_FLEX
AC_SUBST([LEX_OUTPUT_ROOT], [lex.octave_])
OCTAVE_PROG_BISON
OCTAVE_PROG_MAKEINFO
OCTAVE_PROG_TEXI2DVI
OCTAVE_PROG_TEXI2PDF
OCTAVE_PROG_TAR_REPRODUCIBLE
## Programs used when installing Octave.
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_INSTALL
INSTALL_SCRIPT="${INSTALL}"
AC_SUBST(INSTALL_SCRIPT)
## Programs used when running Octave.
OCTAVE_PROG_GHOSTSCRIPT
OCTAVE_PROG_GNUPLOT
OCTAVE_PROG_PAGER
OCTAVE_PROG_PYTHON
## Programs used to generate icons file formats.
OCTAVE_PROG_ICOTOOL
OCTAVE_PROG_RSVG_CONVERT
AM_CONDITIONAL([AMCOND_HAVE_ICON_TOOLS],
[test -n "$ICOTOOL" && test -n "$RSVG_CONVERT"])
### Determine path separator.
sepchar=':'
AC_ARG_WITH([sepchar],
[AS_HELP_STRING([--with-sepchar=<char>],
[use <char> as the path separation character])])
case $with_sepchar in
yes | "")
case $host_os in
mingw* | msdosmsvc)
sepchar=';' ;;
esac
;;
no)
AC_MSG_ERROR([You are required to define a path separation character])
;;
*)
sepchar=$with_sepchar
;;
esac
AC_SUBST(sepchar)
AC_DEFINE_UNQUOTED(SEPCHAR, ['$sepchar'],
[Define this to be the path separator for your system, as a character constant.])
AC_DEFINE_UNQUOTED(SEPCHAR_STR, ["$sepchar"],
[Define this to be the path separator for your system, as a string.])
### Define the path to the shell on the host system.
dnl Most systems will ensure /bin/sh is the default shell so this can be safely
dnl ignored by almost everyone. However, there are exceptions, such as
dnl Android, where this will need to be set.
SHELL_PATH=/bin/sh
AC_ARG_WITH([shell],
[AS_HELP_STRING([--with-shell=SHELL],
[use SHELL as the shell interpreter (default: /bin/sh)])])
case $with_shell in
no)
AC_MSG_ERROR([A shell interpreter is required])
;;
yes | "")
;;
*)
SHELL_PATH=$with_shell
;;
esac
AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"],
[Define this to be the path to the shell command interpreter.])
### Determine which C++ compiler to use (we expect to find g++).
AC_PROG_CXX
AC_PROG_CXXCPP
ENABLE_STD_PMR_POLYMORPHIC_ALLOCATOR=no
AC_ARG_ENABLE(std-pmr-polymorphic-allocator,
[AS_HELP_STRING([--enable-std-pmr-polymorphic-allocator],
[build libraries requiring std::pmr::polymorphic_allocator if possible. This allows more efficient transfer of arrays at the .mex file interface. That also means that all libraries including Octave headers (e.g., .oct files) must be able to compile with that C++17 feature.])],
[case $enableval in
yes) ENABLE_STD_PMR_POLYMORPHIC_ALLOCATOR=yes ;;
no) ENABLE_STD_PMR_POLYMORPHIC_ALLOCATOR=no ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-std-pmr-polymorphic-allocator]) ;;
esac])
### Determine compiler capabilities.
if test $ENABLE_STD_PMR_POLYMORPHIC_ALLOCATOR = yes; then
## Test for flags to fully support C++17.
## Preferably with GNU extensions if flags are required.
AX_CXX_COMPILE_STDCXX(17, [], [])
else
HAVE_CXX17=0
fi
if test "$HAVE_CXX17" = 0; then
## Ensure that the C++ compiler fully supports C++11.
## Preferably with GNU extensions if flags are required.
AX_CXX_COMPILE_STDCXX(11, [], mandatory)
fi
if test $ENABLE_STD_PMR_POLYMORPHIC_ALLOCATOR = yes; then
OCTAVE_CHECK_STD_PMR_POLYMORPHIC_ALLOCATOR
fi
### Determine which C compiler to use (we expect to find gcc).
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
## Save and restore CFLAGS and CXXFLAGS globally.
dnl These variables are for users, so we shouldn't be touching them.
dnl Instead, we should set the corresponding AM_ flags (currently by way of the
dnl XTRA_ variables). However, for the duration of the configure script, we
dnl may set CFLAGS and CXXFLAGS so that subsequent tests succeed. Temporary
dnl settings like this are currently done for pthreads and openmp, for example.
original_octave_configure_CFLAGS="$CFLAGS"
original_octave_configure_CXXFLAGS="$CXXFLAGS"
## Check for MSVC
have_msvc=no
case $host_os in
msdosmsvc)
have_msvc=yes
;;
mingw*)
AC_MSG_CHECKING([for MSVC compiler])
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#if ! defined (_MSC_VER)
#error "Not MSVC compiler"
#endif
]])],
have_msvc=yes, have_msvc=no)
AC_MSG_RESULT([$have_msvc])
;;
esac
### gnulib initialization: part 1
dnl Must take place immediately after a compiler is determined
gl_EARLY
### Check version number when using g++.
GXX_VERSION=
if test "$GXX" = yes; then
AC_CACHE_CHECK([g++ compiler version number],
[octave_cv_gxx_version],
[octave_cv_gxx_version=[`$CXX -v 2>&1 | $GREP "^.*g.. version" | $SED -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`]
])
AX_COMPARE_VERSION([$octave_cv_gxx_version], [lt], [4.1],
[warn_gxx_version="g++ version $octave_cv_gxx_version is likely to cause problems"
OCTAVE_CONFIGURE_WARNING([warn_gxx_version])])
GXX_VERSION=$octave_cv_gxx_version
fi
AC_SUBST(GXX_VERSION)
### Check version number when using gcc.
dnl It might be different from the g++ version number.
GCC_VERSION=
if test "$GCC" = yes; then
AC_CACHE_CHECK([gcc compiler version number],
[octave_cv_gcc_version],
[octave_cv_gcc_version=[`$CC -v 2>&1 | $GREP "^.*gcc version" | $SED -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`]
])
AX_COMPARE_VERSION([$octave_cv_gcc_version], [lt], [3],
[warn_gcc_version="gcc version $octave_cv_gcc_version is likely to cause problems"
OCTAVE_CONFIGURE_WARNING([warn_gcc_version])])
GCC_VERSION=$octave_cv_gcc_version
fi
AC_SUBST(GCC_VERSION)
## It seems that there are some broken inline assembly functions in GNU libc.
## Since it is uncertain how to test whether Octave is linked against GNU libc,
## just disable them for all platforms.
AC_MSG_NOTICE([defining __NO_MATH_INLINES avoids buggy GNU libc exp function])
AC_DEFINE(__NO_MATH_INLINES, 1,
[Define to 1 if your version of GNU libc has buggy inline assembly code for math functions like exp.])
### Determine the compiler flag necessary to create dependencies.
## Assume GCC.
INCLUDE_DEPS=yes
DEPEND_FLAGS="-M"
DEPEND_EXTRA_SED_PATTERN=""
if test "$GCC" != yes; then
case $canonical_host_type in
sparc-sun-solaris2* | i386-pc-solaris2*)
DEPEND_FLAGS="-xM1"
DEPEND_EXTRA_SED_PATTERN="-e '/\/opt\/SUNWspro/d'"
;;
*-*-msdosmsvc)
;;
*-*-mingw*)
if test $have_msvc = no; then
INCLUDE_DEPS=no
fi
;;
*)
INCLUDE_DEPS=no
;;
esac
fi
AC_SUBST(INCLUDE_DEPS)
AC_SUBST(DEPEND_FLAGS)
AC_SUBST(DEPEND_EXTRA_SED_PATTERN)
### Check for math library.
dnl If found, this will add -lm to LIBS.
dnl Keep this check before the check for the Fortran compiler,
dnl in case -lm is needed to compile Fortran programs.
AC_CHECK_LIB(m, sin)
### Determine the Fortran compiler and how to invoke it.
## Prefer gfortran, but the user's F77 environment variable will override.
AC_PROG_F77([gfortran])
if test -z "$F77"; then
## No gfortran found, search for any other installed compiler.
AC_PROG_F77
fi
if test "$F77" = g77; then
AC_MSG_ERROR([g77 is not a supported Fortran compiler. Select another compiler by setting the environment variable F77 and re-running configure.])
fi
AC_MSG_CHECKING([whether a usable Fortran compiler was found])
if test -n "$F77"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([a Fortran compiler is required to build Octave])
fi
AC_F77_LIBRARY_LDFLAGS
AC_F77_DUMMY_MAIN
AC_F77_WRAPPERS
## Must appear after checks for Fortran compiler.
OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS
## Must appear after checks for all compilers.
OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS
### Use a 64-bit integer type for array dimensions and indexing, if possible.
AC_CHECK_SIZEOF([int])
AC_DEFINE_UNQUOTED(OCTAVE_SIZEOF_INT, [$ac_cv_sizeof_int],
[Define to the size of int.])
AC_CHECK_SIZEOF([void *])
if test $ac_cv_sizeof_void_p -ge 8; then
ENABLE_64=yes
else
ENABLE_64=no
fi
AC_ARG_ENABLE(64,
[AS_HELP_STRING([--disable-64],
[don't use 64-bit integers for array dimensions and indexing])],
[case $enableval in
yes) ENABLE_64=yes ;;
no) ENABLE_64=no ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-64]) ;;
esac])
if test $ENABLE_64 = yes; then
if test $ac_cv_sizeof_void_p -ge 8; then
OCTAVE_IDX_TYPE=int64_t
else
warn_64_bit="--enable-64 option given but pointers are less than 64-bits wide; disabling 64-bit indexing"
OCTAVE_CONFIGURE_WARNING([warn_64_bit])
OCTAVE_IDX_TYPE=int32_t
ENABLE_64=no
fi
else
OCTAVE_IDX_TYPE=int32_t
fi
AC_SUBST(ENABLE_64)
if test $ENABLE_64 = yes; then
octave_sizeof_octave_idx_type=8
AC_DEFINE(OCTAVE_ENABLE_64, 1,
[Define to 1 to use 64-bit integers for array dimensions and indexing.])
else
octave_sizeof_octave_idx_type=4
fi
AC_DEFINE_UNQUOTED(OCTAVE_SIZEOF_IDX_TYPE, [$octave_sizeof_octave_idx_type],
[Define to the size of the octave_idx_type (8 or 4).])
AC_SUBST(OCTAVE_IDX_TYPE)
AC_DEFINE_UNQUOTED(OCTAVE_IDX_TYPE, [$OCTAVE_IDX_TYPE],
[Define to the type of octave_idx_type (64 or 32 bit signed integer).])
### Check for LLVM or Apple libc++ library.
OCTAVE_LLVM_LIBCXX
### Check for pthread library.
AX_PTHREAD
dnl Include pthread libs and flags early in case other config tests need them.
dnl They seem to be required for the OpenGL tests on Debian systems.
LIBS="$PTHREAD_LIBS $LIBS"
XTRA_CFLAGS="$XTRA_CFLAGS $PTHREAD_CFLAGS"
XTRA_CXXFLAGS="$XTRA_CXXFLAGS $PTHREAD_CFLAGS"
dnl Set these for any other tests that may require them.
dnl They will be reset before output files are generated.
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
dnl Check if glibc uses wrong stack size
OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE
AM_CONDITIONAL([OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE],
[test $octave_cv_broken_pthread_stacksize = yes])
### Test whether the compiler supports OpenMP.
dnl This is enabled by default to allow the option of using OpenMP in
dnl loadable modules.
ENABLE_OPENMP=no
check_for_openmp=yes
AC_ARG_ENABLE([openmp],
[AS_HELP_STRING([--disable-openmp],
[disable OpenMP SMP multi-threading])],
[if test "$enableval" = no; then check_for_openmp=no; fi], [])
if test $check_for_openmp = yes; then
AC_LANG_PUSH(C)
AX_OPENMP([XTRA_CFLAGS="$XTRA_CFLAGS $OPENMP_CFLAGS"; ENABLE_OPENMP=yes], [])
AC_LANG_POP(C)
AC_LANG_PUSH(C++)
AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; ENABLE_OPENMP=yes], [])
AC_LANG_POP(C++)
fi
dnl Set these for any other tests that may require them.
dnl They will be reset before output files are generated.
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
dnl Define here since it is skipped if the first argument to AX_OPENMP
dnl is not empty.
if test $ENABLE_OPENMP = yes; then
AC_CHECK_HEADERS([omp.h])
AC_CHECK_FUNCS([omp_get_num_threads])
AC_DEFINE(OCTAVE_ENABLE_OPENMP, 1, [Define to 1 if OpenMP is enabled])
fi
### Start determination of shared vs. static libraries.
## Use -static if compiling on Alpha OSF/1 1.3 systems.
case $canonical_host_type in
alpha*-dec-osf1.3)
LD_STATIC_FLAG=-static
;;
esac
if test -n "$LD_STATIC_FLAG"; then
AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
fi
AC_SUBST(LD_STATIC_FLAG)
## Check for programs necessary for shared libraries (ar, libtool)
OCTAVE_PROG_AR
ifdef([LT_INIT], [], [
errprint([error: you must have libtool 2.2.2 or a more recent version
])
m4exit([1])])
LT_PREREQ([2.2.2])
LT_INIT([disable-static dlopen win32-dll])
if test $enable_shared = yes; then
SHARED_LIBS=yes
else
SHARED_LIBS=no
fi
AC_SUBST(SHARED_LIBS)
if test $enable_static = yes; then
STATIC_LIBS=yes
else
STATIC_LIBS=no
fi
AC_SUBST(STATIC_LIBS)
XTRA_EXTERNAL_SH_LDFLAGS=
case $host_os in
msdosmsvc | mingw* | cygwin*)
FLIBS="$FLIBS -lkernel32"
XTRA_EXTERNAL_SH_LDFLAGS="-Wl,liboctave/external/external.def"
;;
esac
AC_SUBST(XTRA_EXTERNAL_SH_LDFLAGS)
if test $STATIC_LIBS = no && test $SHARED_LIBS = no; then
AC_MSG_ERROR([You can't disable building both static AND shared libraries!])
fi
### More configure argument checking related to linking
case $host_os in
msdosmsvc | mingw* | cygwin* | AIX | BeOS | OS/2 )
DEFAULT_NO_UNDEFINED_LDFLAG="-no-undefined"
;;
*)
DEFAULT_NO_UNDEFINED_LDFLAG=""
;;
esac
AC_ARG_ENABLE([no-undefined],
[AS_HELP_STRING([--enable-no-undefined],
[pass -no-undefined to libtool when linking Octave and its shared libraries. This is done by default for msdosmsvc, mingw*, cygwin*, AIX, BeOS, or OS/2 hosts.])],
[case $enableval in
yes) NO_UNDEFINED_LDFLAG="-no-undefined" ;;
no) NO_UNDEFINED_LDFLAG="" ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-no-undefined]) ;;
esac],
[NO_UNDEFINED_LDFLAG="$DEFAULT_NO_UNDEFINED_LDFLAG"])
AC_SUBST(NO_UNDEFINED_LDFLAG)
case $host_os in
cygwin* )
DEFAULT_LINK_ALL_DEPS="yes"
;;
*)
DEFAULT_LINK_ALL_DEPS="no"
;;
esac
AC_ARG_ENABLE([link-all-dependencies],
[AS_HELP_STRING([--enable-link-all-dependencies],
[link Octave and its shared libraries with all dependencies, not just those immediately referenced (should not be needed on most systems). This is done by default for cygwin* or darwin* hosts.])],
[case $enableval in
yes) link_all_deps=yes ;;
no) link_all_deps=no ;;
*) AC_MSG_ERROR([bad value $enableval for --enable-link-all-dependencies])
;;
esac],
[link_all_deps="$DEFAULT_LINK_ALL_DEPS"])
AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test $link_all_deps = yes])
### Check for BLAS and LAPACK libraries.
## Need to adjust FFLAGS to include correct integer size.
save_FFLAGS="$FFLAGS"
FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
OCTAVE_BLAS
AX_LAPACK
## Restore FFLAGS.
FFLAGS="$save_FFLAGS"
## If necessary, try again with -ff2c in FFLAGS
if test $ax_blas_ok = no; then
save_FFLAGS="$FFLAGS"
FFLAGS="-ff2c $FFLAGS $F77_INTEGER_8_FLAG"
OCTAVE_BLAS
AX_LAPACK
## Restore FFLAGS, with -ff2c if that was helpful
if test $ax_blas_ok = yes; then
FFLAGS="-ff2c $save_FFLAGS"
else
FFLAGS="$save_FFLAGS"
fi
fi
## On OSX, try again with a wrapper library (without -ff2c!)
if test $ax_blas_ok = no; then
case $host_os in
darwin*)
## test if wrapper functions help
octave_blaswrap_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -DUSE_BLASWRAP"
AC_LANG_PUSH(C)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include "liboctave/util/blaswrap.c"
]])],
[mv conftest.$ac_objext blaswrap.$ac_objext
octave_blaswrap_save_BLAS_LIBS="$BLAS_LIBS"
BLAS_LIBS="blaswrap.$ac_objext -framework vecLib"
save_FFLAGS="$FFLAGS"
FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
OCTAVE_BLAS
AX_LAPACK
## Restore FFLAGS.
FFLAGS="$save_FFLAGS"
dnl remove temp file
rm -f blaswrap.$ac_objext],
[AC_MSG_FAILURE([cannot compile liboctave/util/blaswrap.c])])
AC_LANG_POP(C)
CFLAGS="$octave_blaswrap_save_CFLAGS"
if test $ax_blas_ok = no; then
BLAS_LIBS="$octave_blaswrap_save_BLAS_LIBS"
else
## wrapper in liboctave/util, remove from BLAS_LIBS
BLAS_LIBS=`echo $BLAS_LIBS | $SED -e 's/blaswrap.[[^ ]]* //g'`
AC_DEFINE(USE_BLASWRAP, 1,
[Define to 1 if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).])
fi
;;
esac
fi
if test $ax_blas_ok = no || test $ax_lapack_ok = no; then
AC_MSG_ERROR([BLAS and LAPACK libraries are required])
fi
case $ax_cv_blas_integer_size in
4)
HAVE_64_BIT_BLAS=no
;;
8)
HAVE_64_BIT_BLAS=yes
;;
*)
AC_MSG_ERROR([unrecognized BLAS library integer size])
;;
esac
OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
if test $octave_cv_sizeof_fortran_integer -ne $ax_cv_blas_integer_size; then
if test $ax_cv_blas_integer_size -eq 8; then
case $F77 in
*gfortran*)
case $F77_INTEGER_8_FLAG in
*-fdefault-integer-8*)
;;
*)
case $FFLAGS in
*-fdefault-integer-8*)
AC_MSG_NOTICE([setting -fdefault-integer-8 in F77_INTEGER_8_FLAG instead of FFLAGS])
FFLAGS=`echo $FFLAGS | $SED 's/-fdefault-integer-8//g'`
F77_INTEGER_8_FLAG="-fdefault-integer-8"
;;
*)
AC_MSG_NOTICE([adding -fdefault-integer-8 to F77_INTEGER_8_FLAG])
F77_INTEGER_8_FLAG="-fdefault-integer-8"
## Invalidate the cache and try again.
$as_unset octave_cv_sizeof_fortran_integer
;;
esac
;;
esac
;;
esac
if test -z "$octave_cv_sizeof_fortran_integer"; then
OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
fi
fi
## We intentionally don't attempt to fix things up if the default
## Fortran integer size is 8 but BLAS appears to use 4-byte integers.
if test $octave_cv_sizeof_fortran_integer -ne $ax_cv_blas_integer_size; then
AC_MSG_ERROR([your Fortran compiler must have an option for setting the default integer size to be the same size as your BLAS library uses ($ax_cv_blas_integer_size bytes). See the file INSTALL for more information.])
fi
fi
AC_SUBST(F77_INTEGER_8_FLAG)
case $octave_cv_sizeof_fortran_integer in
8)
OCTAVE_F77_INT_TYPE=int64_t
;;
4)
OCTAVE_F77_INT_TYPE=int32_t
;;
esac
AC_SUBST(OCTAVE_F77_INT_TYPE)
AC_DEFINE_UNQUOTED(OCTAVE_F77_INT_TYPE, [$OCTAVE_F77_INT_TYPE],
[Define to the type of octave_f77_int_type (64 or 32 bit signed integer).])
AC_DEFINE_UNQUOTED(OCTAVE_SIZEOF_F77_INT_TYPE,
[$octave_cv_sizeof_fortran_integer],
[Define to the size of the octave_f77_int_type (8 or 4).])
OCTAVE_F77_FLAG([-ffloat-store], [
AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store])
F77_FLOAT_STORE_FLAG=-ffloat-store
AC_SUBST(F77_FLOAT_STORE_FLAG)
])
if test $ac_cv_f77_compiler_gnu = yes; then
OCTAVE_F77_FLAG([-std=legacy])
fi
BUILD_EXTERNAL_LIBXERBLA=
case $host_os in
msdosmsvc | mingw*)
BUILD_EXTERNAL_LIBXERBLA=ues
;;
esac
AM_CONDITIONAL([AMCOND_BUILD_EXTERNAL_LIBXERBLA],
[test -n "$BUILD_EXTERNAL_LIBXERBLA"])
### Set options for dynamic linking if enabled.
dnl Options set only only if we are building shared libs and some API for
dnl dynamic linking has been detected.
dnl FIXME: A lot of the following duplicates the functionality of
dnl code generated by the dlopen option for LT_INIT.
RDYNAMIC_FLAG=
DL_API_MSG=""
dlopen_api=no
loadlibrary_api=no
case $lt_cv_dlopen in
dlopen)
dlopen_api=yes
DL_API_MSG="dlopen"
AC_DEFINE(HAVE_DLOPEN_API, 1,
[Define to 1 if system has dlopen, dlsym, dlerror, and dlclose for dynamic linking.])
OCTAVE_CXX_FLAG([-rdynamic], [RDYNAMIC_FLAG=-rdynamic])
;;
LoadLibrary)
loadlibrary_api=yes
DL_API_MSG="LoadLibrary"
AC_DEFINE(HAVE_LOADLIBRARY_API, 1,
[Define to 1 if system has LoadLibrary for dynamic linking.])
;;
*)
AC_MSG_ERROR([Octave requires some way to perform dynamic linking.])
;;
esac
DL_LIBS="$lt_cv_dlopen_libs"
if test $SHARED_LIBS = yes; then
LIBOCTINTERP="-loctinterp"
LIBOCTAVE="-loctave"
else
LIBOCTINTERP="${top_builddir}/libinterp/liboctinterp.a"
LIBOCTAVE="${top_builddir}/liboctave/liboctave.a"
fi
AC_SUBST(RDYNAMIC_FLAG)
AC_SUBST(LIBOCTINTERP)
AC_SUBST(LIBOCTAVE)
if test "$cross_compiling" = yes && test -n "$ac_tool_prefix"; then
CROSS_TOOL_PREFIX="$ac_tool_prefix"
MKOCTFILE_AR=`echo "$AR" | $SED "s,$CROSS_TOOL_PREFIX,,"`
MKOCTFILE_CC=`echo "$CC" | $SED "s,$CROSS_TOOL_PREFIX,,"`
MKOCTFILE_CXX=`echo "$CXX" | $SED "s,$CROSS_TOOL_PREFIX,,"`
MKOCTFILE_F77=`echo "$F77" | $SED "s,$CROSS_TOOL_PREFIX,,"`
MKOCTFILE_RANLIB=`echo "$RANLIB" | $SED "s,$CROSS_TOOL_PREFIX,,"`
else
MKOCTFILE_AR="$AR"
MKOCTFILE_CC="$CC"
MKOCTFILE_CXX="$CXX"
MKOCTFILE_F77="$F77"
MKOCTFILE_RANLIB="$RANLIB"
fi
AC_MSG_NOTICE([defining CROSS_TOOL_PREFIX to be $CROSS_TOOL_PREFIX])
AC_MSG_NOTICE([defining MKOCTFILE_AR to be $MKOCTFILE_AR])
AC_MSG_NOTICE([defining MKOCTFILE_CC to be $MKOCTFILE_CC])
AC_MSG_NOTICE([defining MKOCTFILE_CXX to be $MKOCTFILE_CXX])
AC_MSG_NOTICE([defining MKOCTFILE_F77 to be $MKOCTFILE_F77])
AC_MSG_NOTICE([defining MKOCTFILE_RANLIB to be $MKOCTFILE_RANLIB])
AC_SUBST(CROSS_TOOL_PREFIX)
AC_SUBST(MKOCTFILE_AR)
AC_SUBST(MKOCTFILE_CC)
AC_SUBST(MKOCTFILE_CXX)
AC_SUBST(MKOCTFILE_F77)
AC_SUBST(MKOCTFILE_RANLIB)
### Enable float truncation to work around issues with x87 co-processors
dnl When compiling math for x87, problems may arise in some code comparing
dnl floating-point intermediate results. The root cause is the extra precision
dnl (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits.
dnl Generally, storing the result in a local volatile variable forces a
dnl truncation back to 64 bits, but it also degrades performance.
dnl However, this performance degradation is very minimal, if indeed measurable.
dnl Therefore, it has been enabled for all platforms and compilers.
dnl Reported bugs indicate that --enable-float-truncate is required for MinGW
dnl and Cygwin platforms and for GCC compilers >= 5.0. It should not be
dnl necessary for non-x87 targets or when using modern SSE math.
ENABLE_FLOAT_TRUNCATE=yes
AC_ARG_ENABLE([float-truncate],
[AS_HELP_STRING([--disable-float-truncate],
[truncate intermediate FP results])],
[if test "$enableval" = no; then ENABLE_FLOAT_TRUNCATE=no; fi], [])
if test $ENABLE_FLOAT_TRUNCATE = yes; then
AC_DEFINE(OCTAVE_ENABLE_FLOAT_TRUNCATE, 1,
[Define to 1 to truncate intermediate FP results.])
fi
### Enable internal checks
## The checks slow down the execution and are redundant,
## but useful for debugging or verifying GNU Octave.
ENABLE_INTERNAL_CHECKS=no
AC_ARG_ENABLE([internal-checks],
[AS_HELP_STRING([--enable-internal-checks],
[Enable internal checks that are redundant but useful to debug or verify GNU Octave])],
[if test "$enableval" = yes; then ENABLE_INTERNAL_CHECKS=yes; fi], [])
if test $ENABLE_INTERNAL_CHECKS = yes; then
AC_DEFINE(OCTAVE_ENABLE_INTERNAL_CHECKS, 1,
[Define to 1 to enable internal checks.])
fi
### Determine extra CFLAGS, CXXFLAGS that may be necessary for Octave.
## On Intel systems with gcc, we need to compile with -mieee-fp to get full
## support for IEEE floating point.
##
## On Alpha/OSF systems, we require -mieee or -ieee for full support.
ieee_fp_flag=
case $canonical_host_type in
i[[3456789]]86-*-*)
if test "$GCC" = yes; then
OCTAVE_CC_FLAG([-mieee-fp], [
ieee_fp_flag=-mieee-fp
XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp"
AC_MSG_NOTICE([adding -mieee-fp to XTRA_CFLAGS])])
fi
if test "$GXX" = yes; then
OCTAVE_CXX_FLAG([-mieee-fp], [
ieee_fp_flag=-mieee-fp
XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp"
AC_MSG_NOTICE([adding -mieee-fp to XTRA_CXXFLAGS])])
fi
;;
alpha*-*-*)
if test "$GCC" = yes; then
OCTAVE_CC_FLAG([-mieee], [
ieee_fp_flag=-mieee
XTRA_CFLAGS="$XTRA_CFLAGS -mieee"
AC_MSG_NOTICE([adding -mieee to XTRA_CFLAGS])])
else
OCTAVE_CC_FLAG([-ieee], [
ieee_fp_flag=-ieee
XTRA_CFLAGS="$XTRA_CFLAGS -ieee"
AC_MSG_NOTICE([adding -ieee to XTRA_CFLAGS])])
fi
if test "$GXX" = yes; then
OCTAVE_CXX_FLAG([-mieee], [
ieee_fp_flag=-mieee
XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee"
AC_MSG_NOTICE([adding -mieee to XTRA_CXXFLAGS])])
else
OCTAVE_CXX_FLAG([-ieee], [
ieee_fp_flag=-ieee
XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ieee"
AC_MSG_NOTICE([adding -ieee to XTRA_CXXFLAGS])])
fi
;;
*ibm-aix4*)
OCTAVE_CC_FLAG([-mminimal-toc], [
XTRA_CFLAGS="$XTRA_CFLAGS -mminimal-toc"])
OCTAVE_CXX_FLAG([-mminimal-toc], [
XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mminimal-toc"])
;;