-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure.ac
3105 lines (2703 loc) · 97.3 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
dnl Copyright (C) 1993-2014 John W. Eaton
###
### 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
### <http://www.gnu.org/licenses/>.
AC_PREREQ([2.62])
AC_INIT([GNU Octave], [3.8.2], [http://octave.org/bugs.html], [octave])
dnl Note that the version number is duplicated here and in AC_INIT
dnl because AC_INIT requires it to be static, not computed from
dnl shell variables.
OCTAVE_MAJOR_VERSION=3
OCTAVE_MINOR_VERSION=8
OCTAVE_PATCH_VERSION=2
dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg
OCTAVE_VERSION="$PACKAGE_VERSION"
OCTAVE_COPYRIGHT="Copyright (C) 2014 John W. Eaton and others."
OCTAVE_RELEASE_DATE="2014-08-06"
## 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 that is
## with library versioning, but not all systems support that.
## 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.
## FIXME: Since we also set libtool versions for liboctave and
## libinterp, perhaps we should be computing the "api version" from
## those versions numbers in some way instead of setting it
## independently here.
OCTAVE_API_VERSION="api-v49+"
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])
AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability -Wno-override tar-ustar subdir-objects])
## Add the option to enable silent rules, available since Automake 1.11
## and included by default starting with Automake 1.13.
AM_SILENT_RULES
OCTAVE_CANONICAL_HOST
AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.])
AC_USE_SYSTEM_EXTENSIONS
### Make configure args available for other uses.
config_opts=$ac_configure_args
AC_SUBST(config_opts)
### Set default file locations
OCTAVE_SET_DEFAULT([octlibdir], '$(libdir)/octave/$(version)')
OCTAVE_SET_DEFAULT([archlibdir],
'$(libexecdir)/octave/$(version)/exec/$(canonical_host_type)')
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)')
OCTAVE_SET_DEFAULT([octfiledir],
'$(libdir)/octave/$(version)/oct/$(canonical_host_type)')
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)')
OCTAVE_SET_DEFAULT([octincludedir], '$(includedir)/octave-$(version)/octave')
OCTAVE_SET_DEFAULT([fcnfiledir], '$(datadir)/octave/$(version)/m')
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')
OCTAVE_SET_DEFAULT([octetcdir], '$(datadir)/octave/$(version)/etc')
OCTAVE_SET_DEFAULT([octlocaledir], '$(datadir)/octave/$(version)/locale')
OCTAVE_SET_DEFAULT([doc_cache_file], '$(octetcdir)/doc-cache')
OCTAVE_SET_DEFAULT([octtestsdir], '$(octetcdir)/tests')
OCTAVE_SET_DEFAULT([texi_macros_file], '$(octetcdir)/macros.texi')
OCTAVE_SET_DEFAULT([imagedir], '$(datadir)/octave/$(version)/imagelib')
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.
## Find pkg-config executable (sets $PKG_CONFIG)
PKG_PROG_PKG_CONFIG
## Programs used in Makefiles.
AC_PROG_AWK
AC_PROG_GREP
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
## Programs used when installing Octave.
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_INSTALL
INSTALL_SCRIPT='${INSTALL}'
AC_SUBST(INSTALL_SCRIPT)
OCTAVE_PROG_DESKTOP_FILE_INSTALL
## Programs used when running Octave
OCTAVE_PROG_GHOSTSCRIPT
OCTAVE_PROG_GNUPLOT
OCTAVE_PROG_PAGER
OCTAVE_PROG_PYTHON
### Default terminal font for the GUI
case $host_os in
mingw* | msdosmsvc)
DEFAULT_TERMINAL_FONT="Lucida Console"
;;
*)
DEFAULT_TERMINAL_FONT="Courier"
;;
esac
DEFAULT_TERMINAL_FONT_SIZE=10
AC_SUBST(DEFAULT_TERMINAL_FONT)
AC_SUBST(DEFAULT_TERMINAL_FONT_SIZE)
### 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. Most systems will
### ensure /bin/sh is the default shell so this can be safely ignored by
### almost everyone. However, when building for Android, for example,
### 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.])
### Enable bounds checking on element references within Octave's array and
### matrix classes. This slows down some operations a bit, so it is turned off
### by default.
BOUNDS_CHECKING=no
AC_ARG_ENABLE([bounds-check],
[AS_HELP_STRING([--enable-bounds-check],
[enable bounds checking for indexing in internal array classes])],
[if test "$enableval" = yes; then BOUNDS_CHECKING=yes; fi], [])
if test $BOUNDS_CHECKING = yes; then
AC_DEFINE(BOUNDS_CHECKING, 1, [Define to 1 to use internal bounds checking.])
fi
### Use Octave's built-in memory allocator rather than straightforward malloc.
### Disabled by default.
USE_OCTAVE_ALLOCATOR=no
AC_ARG_ENABLE([octave-allocator],
[AS_HELP_STRING([--enable-octave-allocator],
[use the obsolete octave_allocator class for many of Octave's objects (mostly octave_value types). You probably do NOT want to enable this feature.])],
[if test "$enableval" = yes; then USE_OCTAVE_ALLOCATOR=yes; fi], [])
if test $USE_OCTAVE_ALLOCATOR = yes; then
AC_DEFINE(USE_OCTAVE_ALLOCATOR, 1,
[Define to 1 to use octave_allocator class.])
fi
### Use atomic operations for internal reference counting. This is required
### for thread-safe behavior but incurs a significant slowdown, and is thus
### disabled by default.
USE_ATOMIC_REFCOUNT=no
AC_ARG_ENABLE([atomic-refcount],
[AS_HELP_STRING([--enable-atomic-refcount],
[use atomic operations for internal reference counting. This is required for thread-safe behavior but does not by itself make Octave internals thread safe.])],
[if test "$enableval" = yes; then USE_ATOMIC_REFCOUNT=yes; fi], [])
if test $USE_ATOMIC_REFCOUNT = yes; then
AC_DEFINE(USE_ATOMIC_REFCOUNT, 1,
[Define to 1 to use atomic operations for reference counting.])
fi
### Disable running Make in the doc directory.
### This is useful, for example, when building Octave on systems without TeX.
DOCDIR=doc
AC_ARG_ENABLE([docs],
[AS_HELP_STRING([--disable-docs], [don't build documentation files])],
[if test "$enableval" = no; then
DOCDIR=
warn_docs="building documentation disabled; make dist will fail"
OCTAVE_CONFIGURE_WARNING([warn_docs])
fi],
[])
AC_SUBST(DOCDIR)
### If possible, use a 64-bit integer type for array dimensions and indexing.
USE_64_BIT_IDX_T=no
OCTAVE_IDX_TYPE=int
AC_ARG_ENABLE(64,
[AS_HELP_STRING([--enable-64],
[(EXPERIMENTAL) use 64-bit integers for array dimensions and indexing])],
[if test "$enableval" = yes; then USE_64_BIT_IDX_T=yes; fi], [])
if test $USE_64_BIT_IDX_T = yes; then
AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([int64_t])
if test $ac_cv_sizeof_void_p -eq 8; then
OCTAVE_IDX_TYPE=int64_t
else
warn_64_bit="pointers are not 64-bits wide; disabling 64-bit features"
OCTAVE_CONFIGURE_WARNING([warn_64_bit])
USE_64_BIT_IDX_T=no
fi
fi
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).])
if test $USE_64_BIT_IDX_T = yes; then
AC_DEFINE(USE_64_BIT_IDX_T, 1,
[Define to 1 if using 64-bit integers for array dimensions and indexing.])
fi
AC_SUBST(USE_64_BIT_IDX_T)
### It seems that there are some broken inline assembly functions in
### the GNU libc. Since I'm not sure how to test whether we are using
### 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 which C++ compiler to use (we expect to find g++).
AC_PROG_CXX
AC_PROG_CXXCPP
### Check version number when using g++.
GXX_VERSION=
if test "$GXX" = yes; then
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([$gxx_version], [lt], [3.5],
[AC_MSG_ERROR([g++ version $gxx_version will probably fail to compile Octave])])
GXX_VERSION=$gxx_version
fi
AC_SUBST(GXX_VERSION)
## FIXME: CXX_VERSION is deprecated and should be removed in Octave version 3.12
CXX_VERSION=$gxx_version
AC_SUBST(CXX_VERSION)
### Determine which C compiler to use (we expect to find gcc).
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
## 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([[
#ifndef _MSC_VER
#error "Not MSVC compiler"
#endif
]])],
have_msvc=yes, have_msvc=no)
AC_MSG_RESULT([$have_msvc])
;;
esac
### gnulib initialization: part 1
### Must take place immediately after a compiler is determined
gl_EARLY
### Check version number when using gcc.
GCC_VERSION=
if test "$GCC" = yes; then
AC_MSG_CHECKING([C compiler version number])
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([$gcc_version], [lt], [3],
[warn_gcc_version="gcc version $gcc_version is likely to cause problems"
OCTAVE_CONFIGURE_WARNING([warn_gcc_version])])
GCC_VERSION=$gcc_version
AC_MSG_RESULT([$GCC_VERSION])
fi
AC_SUBST(GCC_VERSION)
## FIXME: CC_VERSION is deprecated and should be removed in Octave version 3.12
CC_VERSION=$GCC_VERSION
AC_SUBST(CC_VERSION)
### Also check g++ version number, it might be different from the
## gcc version number.
GXX_VERSION=
if test "$GXX" = yes; then
AC_MSG_CHECKING([C++ compiler version number])
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([$gxx_version], [lt], [3],
[warn_gxx_version="g++ version $gxx_version is likely to cause problems"
OCTAVE_CONFIGURE_WARNING([warn_gxx_version])])
GXX_VERSION=$gxx_version
AC_MSG_RESULT([$GXX_VERSION])
fi
AC_SUBST(GXX_VERSION)
OCTAVE_CHECK_BROKEN_STL_ALGO_H
AM_CONDITIONAL([AMCOND_HAVE_BROKEN_STL_ALGO_H],
[test $octave_cv_broken_stl_algo_h = yes])
if test $octave_cv_broken_stl_algo_h = yes; then
warn_stl_algo_h="Found nth_element broken in g++ $GXX_VERSION. Attempting to repair by using local patched version of bits/stl_algo.h."
OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
fi
### 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 pthread library
AX_PTHREAD
## Include pthread libs and flags early in case other tests need them.
## They seem to be required for the OpenGL tests on Debian systems.
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
### When compiling math for x87, problems may arise in some code comparing
### floating-point intermediate results. The root cause is the extra precision
### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits.
### Generally, storing the result in a local volatile variable forces a
### truncation back to 64 bits, but it also degrades performance.
### Thus, we provide a FLOAT_TRUNCATE macro that may be defined to "volatile"
### when compiling for x87 target, or left empty for modern SSE math, that
### doesn't suffer from this problem at all.
### FIXME: If no option value is given, configure uses a default heuristic
### which assumes that truncation should occur for MinGW and Cygwin
### systems and not for any others. It would be marginally nicer
### to replace this with a test that checks whether the problem arises
### and only sets the flag if necessary. However, the principal
### scenario for those two systems is a cross-build where we can't
### run an executable so the test wouldn't be too useful most of the
### time (only native builds on MinGW and Cygwin *might* benefit).
### Maybe, one could generate assembly code with -S option and inspect
### it without having to run an executable, but this sounds pretty dicey.
AC_ARG_ENABLE([float-truncate],
[AS_HELP_STRING([--enable-float-truncate],
[truncate intermediate FP results])],
[if test "$enableval" = yes; then
ac_float_truncate=volatile
else
ac_float_truncate=
fi],
[case $host_os in
mingw* | cygwin*)
ac_float_truncate=volatile
;;
*)
ac_float_truncate=
;;
esac])
AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, [$ac_float_truncate],
[Define to volatile if you need to truncate intermediate FP results.])
### Determine extra CFLAGS that may be necessary for Octave.
## On Intel systems with gcc, we may need to compile with -mieee-fp
## to get full support for IEEE floating point.
##
## On Alpha/OSF systems, we need -mieee.
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"])
;;
esac
AC_SUBST(XTRA_CFLAGS)
AC_SUBST(XTRA_CXXFLAGS)
### Test whether the compiler supports OpenMP. This is experimental so disable
### it by default. Enable it with the flag --enable-openmp.
USE_OPENMP=no
AC_ARG_ENABLE([openmp],
[AS_HELP_STRING([--enable-openmp],
[(EXPERIMENTAL) use OpenMP SMP multi-threading])],
[if test "$enableval" = yes; then USE_OPENMP=yes; fi], [])
if test $USE_OPENMP = yes; then
case $host_os in
mingw* | cygwin* | *-gnu*)
OCTAVE_CHECK_OPENMP(-fopenmp)
;;
msdosmsvc)
## FIXME: is this the right flag for MSVC?
OCTAVE_CHECK_OPENMP(-openmp)
;;
## Add other compilers supporting OpenMP here
esac
fi
### Defaults for cross compiling. BUILD_CC and BUILD_CXX are
### the compilers that we use for building tools on the build system.
### For now, we assume that the only cross compiling we can do is
### with gcc on a Unixy system, but the dedicated hacker can override these.
if test "$cross_compiling" = yes; then
BUILD_CC="gcc"
BUILD_CFLAGS="-O2 -g"
BUILD_CXX="g++"
BUILD_CXXFLAGS="-O2 -g"
BUILD_LDFLAGS=""
BUILD_EXEEXT=""
else
BUILD_CC='$(CC)'
BUILD_CFLAGS='$(CFLAGS)'
BUILD_CXX='$(CXX)'
BUILD_CXXFLAGS='$(CXXFLAGS)'
BUILD_LDFLAGS='$(LDFLAGS)'
BUILD_EXEEXT='$(EXEEXT)'
fi
AC_ARG_VAR([BUILD_CC],
[build system C compiler (used if cross compiling)])
AC_ARG_VAR([BUILD_CFLAGS],
[build system C compiler flags (used if cross compiling)])
AC_ARG_VAR([BUILD_CXX],
[build system C++ compiler (used if cross compiling)])
AC_ARG_VAR([BUILD_CXXFLAGS],
[build system C++ compiler flags (used if cross compiling)])
AC_ARG_VAR([BUILD_LDFLAGS],
[build system C++ compiler link flags (used if cross compiling)])
AC_ARG_VAR([BUILD_EXEEXT],
[build system executable extension (used if cross compiling)])
### Look for math library. 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
## Default FFLAGS is -O.
if test x"$FFLAGS" = x""; then
FFLAGS="-O"
fi
## the F77 variable, if set, overrides AC_PROG_F77 automatically
AC_PROG_F77
AC_F77_LIBRARY_LDFLAGS
AC_F77_DUMMY_MAIN
AC_F77_WRAPPERS
F77_TOLOWER=yes
F77_APPEND_UNDERSCORE=yes
F77_APPEND_EXTRA_UNDERSCORE=yes
case $ac_cv_f77_mangling in
"upper case") F77_TOLOWER=no ;;
esac
case $ac_cv_f77_mangling in
"no underscore") F77_APPEND_UNDERSCORE=no ;;
esac
case $ac_cv_f77_mangling in
"no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;;
esac
case $canonical_host_type in
i[[3456789]]86-*-*)
if test $ac_cv_f77_compiler_gnu = yes; then
OCTAVE_F77_FLAG([-mieee-fp])
fi
;;
alpha*-*-*)
if test $ac_cv_f77_compiler_gnu = yes; then
OCTAVE_F77_FLAG([-mieee])
else
OCTAVE_F77_FLAG([-ieee])
OCTAVE_F77_FLAG([-fpe1])
fi
;;
powerpc-apple-machten*)
FFLAGS=
;;
esac
if test -n "$FFLAGS"; then
AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
fi
AC_SUBST(F77_TOLOWER)
AC_SUBST(F77_APPEND_UNDERSCORE)
AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE)
if test -z "$F77"; then
AC_MSG_ERROR([in order to build Octave, you must have a compatible Fortran compiler or wrapper script for f2c that functions as a Fortran compiler installed and in your path. See the file INSTALL for more information.])
fi
OCTAVE_CHECK_FUNC_FORTRAN_ISNAN
F77_ISNAN_MACRO=
if test $octave_cv_func_fortran_isnan = no; then
AC_MSG_NOTICE([substituting ISNAN(X) with X.NE.X in Fortran sources])
F77_ISNAN_MACRO="s|ISNAN(\(@<:@^)@:>@*\))|(\1.NE.\1)|"
fi
AC_SUBST(F77_ISNAN_MACRO)
OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
if test $octave_cv_sizeof_fortran_integer = no; then
if test $USE_64_BIT_IDX_T = yes; 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
if test $octave_cv_sizeof_fortran_integer = no; then
AC_MSG_ERROR([in order to build Octave with 64-bit indexing support your Fortran compiler must have an option for setting the default integer size to 8 bytes. See the file INSTALL for more information.])
fi
else
AC_MSG_ERROR([your Fortran compiler must have an option to make integers the same size as octave_idx_type ($OCTAVE_IDX_TYPE). See the file INSTALL for more information.])
fi
fi
AC_SUBST(F77_INTEGER_8_FLAG)
## FIXME: Is this really used? Makefile seems to use $F77 for compiler
FC=$F77
AC_SUBST(FC)
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)
])
### Check for the Qhull library
OCTAVE_CHECK_LIB(qhull, QHull,
[Qhull library not found -- this will result in loss of functionality of some geometry functions.],
[libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h],
[qh_qhull], [], [],
[warn_qhull=
OCTAVE_CHECK_QHULL_VERSION
OCTAVE_CHECK_LIB_QHULL_OK(
[TEXINFO_QHULL="@set HAVE_QHULL"
AC_DEFINE(HAVE_QHULL, 1, [Define to 1 if Qhull is available.])],
[warn_qhull="Qhull library found, but does not seem to work properly -- this will result in loss of functionality of some geometry functions. Please try recompiling the library with -fno-strict-aliasing."])])
### Check for PCRE regex library.
PCRE_LIBS=
pcre_fail_msg="to build Octave, you must have the PCRE library and header files installed"
AC_CHECK_HEADERS([pcre.h pcre/pcre.h])
AC_CACHE_CHECK([whether pcre.h defines the macros we need],
[ac_cv_pcre_h_macros_present],
[AC_EGREP_CPP([PCRE_HAS_MACROS_WE_NEED], [
#if defined (HAVE_PCRE_H)
# include <pcre.h>
#elif defined (HAVE_PCRE_PCRE_H)
# include <pcre/pcre.h>
#error "NO PCRE HEADER"
#endif
#if defined (PCRE_INFO_NAMECOUNT) \
&& defined (PCRE_INFO_NAMEENTRYSIZE) \
&& defined (PCRE_INFO_NAMETABLE)
PCRE_HAS_MACROS_WE_NEED
#endif],
ac_cv_pcre_h_macros_present=yes, ac_cv_pcre_h_macros_present=no)])
if test $ac_cv_pcre_h_macros_present = yes; then
## check for pcre-config, and if so, get build variables
AC_CHECK_PROG(HAVE_PCRE_CONFIG, pcre-config, [yes], [no])
if test $HAVE_PCRE_CONFIG = yes; then
PCRE_CPPFLAGS=`pcre-config --cflags`
PCRE_LIBS=`pcre-config --libs`
else
PCRE_LIBS="-lpcre"
fi
save_LIBS="$LIBS"
LIBS="$PCRE_LIBS $LIBS"
AC_CHECK_FUNCS([pcre_compile],
[AC_SUBST(PCRE_CPPFLAGS)
AC_SUBST(PCRE_LIBS)],
[AC_MSG_ERROR([$pcre_fail_msg])])
LIBS="$save_LIBS"
else
AC_MSG_ERROR([$pcre_fail_msg])
fi
### Check for ZLIB library.
OCTAVE_CHECK_LIB(z, ZLIB,
[ZLIB library not found. Octave will not be able to save or load compressed data files or HDF5 files.],
[zlib.h], [gzclearerr])
### Also define HAVE_ZLIB if libz is found.
if test $octave_cv_lib_z = yes; then
AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if ZLIB is available.])
fi
### Check for the LLVM library
build_jit=no
AC_ARG_ENABLE([jit],
[AS_HELP_STRING([--enable-jit],
[(EXPERIMENTAL) enable JIT compiler])],
[if test "$enableval" = yes; then
build_jit=yes
fi],
[])
LLVM_CXXFLAGS=
LLVM_CPPFLAGS=
LLVM_LDFLAGS=
LLVM_LIBS=
if test $build_jit = yes; then
## Find llvm-config program from environment variable or by searching
AC_ARG_VAR([LLVM_CONFIG], [path to llvm-config utility])
AC_CHECK_PROG([LLVM_CONFIG], llvm-config, llvm-config, [])
if test -z "$LLVM_CONFIG"; then
warn_llvm="llvm-config utility not found. JIT compiler is disabled."
else
dnl Preset warning message in case compile fails
warn_llvm="LLVM was not found or is to old. JIT compiler is disabled."
save_CPPFLAGS="$CPPFLAGS"
save_CXXFLAGS="$CXXFLAGS"
save_LDFLAGS="$LDFLAGS"
## Use -isystem if available because we don't want to see warnings in LLVM
LLVM_INCLUDE_FLAG=-I
OCTAVE_CC_FLAG([-isystem .], [
LLVM_INCLUDE_FLAG=-isystem
AC_MSG_NOTICE([using -isystem for LLVM headers])])
dnl Use -isystem so we don't get warnings from llvm headers
LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
LLVM_CXXFLAGS=
LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
LDFLAGS="$LDFLAGS $LLVM_LDFLAGS"
LLVM_SO=LLVM-`$LLVM_CONFIG --version`
AC_CHECK_LIB([$LLVM_SO], [LLVMBuildAdd], [LLVM_LIBS="-l$LLVM_SO"], [LLVM_LIBS=`$LLVM_CONFIG --libs`])
dnl
dnl Define some extra flags that LLVM requires in order to include headers.
dnl Ideally we should get these from llvm-config, but llvm-config isn't
dnl very helpful.
dnl
CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS"
CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS"
AC_LANG_PUSH(C++)
AC_CHECK_HEADER([llvm/Support/TargetSelect.h], [warn_llvm=""])
have_function_h=no
AC_CHECK_HEADERS([llvm/IR/Function.h llvm/Function.h],
[have_function_h=yes; break])
if test $have_function_h = no; then
warn_llvm="Missing LLVM file Function.h. JIT compiler is disabled."
fi
have_irbuilder_h=no
AC_CHECK_HEADERS([llvm/Support/IRBuilder.h llvm/IR/IRBuilder.h \
llvm/IRBuilder.h], [have_irbuilder_h=yes; break])
if test $have_irbuilder_h = no; then
warn_llvm="Missing LLVM file IRBuilder.h. JIT compiler is disabled."
fi
have_llvm_data_h=no
AC_CHECK_HEADERS([llvm/Target/TargetData.h llvm/IR/DataLayout.h \
llvm/DataLayout.h], [have_llvm_data_h=yes; break])
if test $have_llvm_data_h = no; then
warn_llvm="Missing LLVM file TargetData.h. JIT compiler is disabled."
fi
OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API
OCTAVE_LLVM_FUNCTION_ADDFNATTR_API
OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API
AC_LANG_POP(C++)
CPPFLAGS="$save_CPPFLAGS"
CXXFLAGS="$save_CXXFLAGS"
LDFLAGS="$save_LDFLAGS"
fi
if test -z "$warn_llvm"; then
AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.])
else
build_jit=no
LLVM_CPPFLAGS=
LLVM_CXXFLAGS=
LLVM_LDFLAGS=
LLVM_LIBS=
OCTAVE_CONFIGURE_WARNING([warn_llvm])
fi
dnl FIXME: Re-instate when JIT is enabled by default
dnl else
dnl ## JIT build disabled
dnl warn_llvm="JIT compiler disabled, some performance loss for loops"
dnl OCTAVE_CONFIGURE_WARNING([warn_llvm])
fi
AC_SUBST(LLVM_CPPFLAGS)
AC_SUBST(LLVM_CXXFLAGS)
AC_SUBST(LLVM_LDFLAGS)
AC_SUBST(LLVM_LIBS)
### Check for HDF5 library.
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
OCTAVE_CHECK_LIB(hdf5, HDF5,
[HDF5 library not found. Octave will not be able to save or load HDF5 data files.],
[hdf5.h], [H5Gget_num_objs], [], [],
[warn_hdf5=
OCTAVE_CHECK_HDF5_HAS_VER_16_API
TEXINFO_HDF5="@set HAVE_HDF5"
AC_DEFINE(HAVE_HDF5, 1,
[Define to 1 if HDF5 is available and newer than version 1.6.])
if test $have_msvc = yes; then
OCTAVE_CHECK_LIB_HDF5_DLL
fi
])
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
### Check for FFTW library. Default to Fortran FFTPACK if it is not available.
## Check for FFTW header and library.
OCTAVE_CHECK_LIB(fftw3, FFTW3,
[FFTW3 library not found. The slower FFTPACK library will be used instead.],
[fftw3.h], [fftw_plan_dft_1d])
OCTAVE_CHECK_LIB(fftw3f, FFTW3F,
[FFTW3F library not found. The slower FFTPACK library will be used instead.],
[fftw3.h], [fftwf_plan_dft_1d])
## Check for the multithreaded FFTW library.
## Fallback to singlethreaded if not found or disabled
build_fftw_threads=yes
AC_ARG_ENABLE([fftw-threads],
[AS_HELP_STRING([--disable-fftw-threads],
[disable Multi-threaded FFTW])],
[if test "$enableval" = no; then
build_fftw_threads=no
fi],
[])
if test $build_fftw_threads = yes; then
OCTAVE_CHECK_FFTW_THREADS(fftw3, fftw_plan_with_nthreads)
OCTAVE_CHECK_FFTW_THREADS(fftw3f, fftwf_plan_with_nthreads)
fi
## Octave is currently unable to use FFTW unless both float
## and double versions are available.
AM_CONDITIONAL([AMCOND_HAVE_FFTW],
[test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"])
if test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"; then
AC_DEFINE(HAVE_FFTW, 1, [Define if you have both FFTW3 and FFTW3F libraries.])
fi
## Subdirectory of liboctave/cruft to build if FFTW is not found.
FFT_DIR="fftpack"
AC_SUBST(FFT_DIR)
### Check for GLPK library and header.
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
OCTAVE_CHECK_LIB(glpk, GLPK,
[GLPK library not found. The glpk function for solving linear programs will be disabled.],
[glpk/glpk.h glpk.h], [glp_simplex], [], [],
[warn_glpk=
OCTAVE_CHECK_LIB_GLPK_OK(
[TEXINFO_GLPK="@set HAVE_GLPK"
AC_DEFINE(HAVE_GLPK, 1, [Define to 1 if GLPK is available.])],
[warn_glpk="GLPK library found, but does not seem to work properly -- disabling glpk function"])])
LIBS="$save_LIBS"
CPPFLAGS="$save_CPPFLAGS"
### Checks for cURL header and library.
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
OCTAVE_CHECK_LIB(curl, cURL,
[cURL library not found. The ftp objects, urlread and urlwrite functions will be disabled.],
[curl/curl.h], [curl_easy_escape])
if test -z "$warn_curl"; then
## Additional check on cURL library that was found
AC_CACHE_CHECK([for CURLOPT_DIRLISTONLY in curl/curl.h],
[octave_cv_curl_has_curlopt_dirlistonly],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <curl/curl.h>
]], [[
curl_easy_setopt ((CURL*)NULL, CURLOPT_DIRLISTONLY, 0);
]])],
[octave_cv_curl_has_curlopt_dirlistonly=yes],
[octave_cv_curl_has_curlopt_dirlistonly=no])
])
if test $octave_cv_curl_has_curlopt_dirlistonly = no; then
AC_DEFINE(CURLOPT_DIRLISTONLY, CURLOPT_FTPLISTONLY,