forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.in
3793 lines (3350 loc) · 98.2 KB
/
configure.in
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. -*-m4-*-
dnl %CopyrightBegin%
dnl
dnl Copyright Ericsson AB 1997-2010. All Rights Reserved.
dnl
dnl The contents of this file are subject to the Erlang Public License,
dnl Version 1.1, (the "License"); you may not use this file except in
dnl compliance with the License. You should have received a copy of the
dnl Erlang Public License along with this software. If not, it can be
dnl retrieved online at http://www.erlang.org/.
dnl
dnl Software distributed under the License is distributed on an "AS IS"
dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
dnl the License for the specific language governing rights and limitations
dnl under the License.
dnl
dnl %CopyrightEnd%
dnl The string "FIXME convbreak" means that there is a break of
dnl autoconf convention that should be cleaned up.
AC_INIT(vsn.mk)
AC_PREREQ(2.59)
if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then
# We do not want to use a common cache!
cache_file=/dev/null
fi
dnl How to set srcdir absolute is taken from the GNU Emacs distribution
#### Make srcdir absolute, if it isn't already. It's important to
#### avoid running the path through pwd unnecessary, since pwd can
#### give you automounter prefixes, which can go away.
case "${srcdir}" in
/* ) ;;
. )
## We may be able to use the $PWD environment variable to make this
## absolute. But sometimes PWD is inaccurate.
## Make sure CDPATH doesn't affect cd (in case PWD is relative).
CDPATH=
if test "${PWD}" != "" && test "`(cd ${PWD} ; sh -c pwd)`" = "`pwd`" ;
then
srcdir="$PWD"
else
srcdir="`(cd ${srcdir}; pwd)`"
fi
;;
* ) srcdir="`(cd ${srcdir}; pwd)`" ;;
esac
## Now, make sure that ERL_TOP is set and is the same as srcdir
##
if test -z "$ERL_TOP" || test ! -d $ERL_TOP ; then
AC_MSG_ERROR(You need to set the environment variable ERL_TOP!)
fi
if test x"${ERL_TOP}/erts" != x"$srcdir"; then
AC_MSG_ERROR([You need to run configure with argument --srcdir=${ERL_TOP}/erts])
fi
erl_top=${ERL_TOP}
# echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# echo X
# echo "X srcdir = $srcdir"
# echo "X ERL_TOP = $ERL_TOP"
# echo X
# echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AC_CONFIG_AUX_DIRS($srcdir/autoconf)
dnl ----------------------------------------------------------------------
dnl Figure out what system we are running on.
dnl ----------------------------------------------------------------------
#
# To configure for free source run ./configure --host=free_source
#
dnl
dnl AC_CANONICAL_HOST does not like free_source as a host specification,
dnl so we make a little special case.
dnl
if test "X$host" != "Xfree_source" -a "X$host" != "Xwin32"; then
AC_CANONICAL_HOST
else
host_os=$host
fi
AC_ISC_POSIX
AC_CONFIG_HEADER($host/config.h:config.h.in include/internal/$host/ethread_header_config.h:include/internal/ethread_header_config.h.in include/$host/erl_int_sizes_config.h:include/erl_int_sizes_config.h.in)
dnl ----------------------------------------------------------------------
dnl Optional features.
dnl ----------------------------------------------------------------------
enable_child_waiter_thread=no
ENABLE_ALLOC_TYPE_VARS=
AC_SUBST(ENABLE_ALLOC_TYPE_VARS)
AC_ARG_ENABLE(threads,
[ --enable-threads enable async thread support
--disable-threads disable async thread support],
[ case "$enableval" in
no) enable_threads=no ;;
*) enable_threads=yes ;;
esac ], enable_threads=unknown)
AC_ARG_ENABLE(smp-support,
[ --enable-smp-support enable smp support
--disable-smp-support disable smp support],
[ case "$enableval" in
no) enable_smp_support=no ;;
*) enable_smp_support=yes ;;
esac ], enable_smp_support=unknown)
AC_ARG_WITH(termcap,
[ --with-termcap use termcap (default)
--without-termcap do not use any termcap libraries (ncurses,curses,termcap,termlib)],
[],
[with_termcap=yes])
AC_ARG_ENABLE(hybrid-heap,
[ --enable-hybrid-heap enable hybrid heap
--disable-hybrid-heap disable hybrid heap],
[ case "$enableval" in
no) enable_hybrid_heap=no ;;
*) enable_hybrid_heap=yes ;;
esac ], enable_hybrid_heap=unknown)
AC_ARG_ENABLE(lock-checking,
[ --enable-lock-checking enable lock checking],
[ case "$enableval" in
no) enable_lock_check=no ;;
*) enable_lock_check=yes ;;
esac
],
enable_lock_check=no)
AC_ARG_ENABLE(lock-counter,
[ --enable-lock-counter enable lock counters
--disable-lock-counter disable lock counters],
[ case "$enableval" in
no) enable_lock_count=no ;;
*) enable_lock_count=yes ;;
esac ], enable_lock_count=no)
AC_ARG_ENABLE(kernel-poll,
[ --enable-kernel-poll enable kernel poll support
--disable-kernel-poll disable kernel poll support],
[ case "$enableval" in
no) enable_kernel_poll=no ;;
*) enable_kernel_poll=yes ;;
esac ], enable_kernel_poll=unknown)
AC_ARG_ENABLE(sctp,
[ --enable-sctp enable sctp support
--disable-sctp disable sctp support],
[ case "$enableval" in
no) enable_sctp=no ;;
*) enable_sctp=yes ;;
esac ], enable_sctp=unknown)
AC_ARG_ENABLE(hipe,
[ --enable-hipe enable hipe support
--disable-hipe disable hipe support])
AC_ARG_ENABLE(native-libs,
[ --enable-native-libs compile Erlang libraries to native code])
AC_ARG_ENABLE(tsp,
[ --enable-tsp compile tsp app])
AC_ARG_ENABLE(elib-malloc,
[ --enable-elib-malloc use elib_malloc instead of normal malloc])
AC_ARG_ENABLE(fp-exceptions,
[ --enable-fp-exceptions Use hardware floating point exceptions (default if hipe enabled)],
[ case "$enableval" in
no) enable_fp_exceptions=no ;;
*) enable_fp_exceptions=yes ;;
esac
],enable_fp_exceptions=auto)
AC_ARG_ENABLE(darwin-universal,
[ --enable-darwin-universal build universal binaries on darwin i386],
[ case "$enableval" in
no) enable_darwin_universal=no ;;
*) enable_darwin_univeral=yes ;;
esac
],enable_darwin_universal=no)
AC_ARG_ENABLE(darwin-64bit,
[ --enable-darwin-64bit build 64bit binaries on darwin],
[ case "$enableval" in
no) enable_darwin_64bit=no ;;
*) enable_darwin_64bit=yes ;;
esac
],enable_darwin_64bit=no)
AC_ARG_ENABLE(m64-build,
[ --enable-m64-build build 64bit binaries using the -m64 flag to (g)cc],
[ case "$enableval" in
no) enable_m64_build=no ;;
*) enable_m64_build=yes ;;
esac
],enable_m64_build=no)
AC_ARG_ENABLE(fixalloc,
[ --disable-fixalloc disable the use of fix_alloc])
if test x${enable_fixalloc} = xno ; then
AC_DEFINE(NO_FIX_ALLOC,[],
[Define if you don't want the fix allocator in Erlang])
fi
AC_SUBST(PERFCTR_PATH)
AC_ARG_WITH(perfctr,
[ --with-perfctr=PATH specify location of perfctr include and lib
--without-perfctr don't use perfctr (default)])
if test "x$with_perfctr" = "xno" -o "x$with_perfctr" = "x" ; then
PERFCTR_PATH=
else
if test ! -f "$with_perfctr/usr.lib/libperfctr.a" ; then
AC_MSG_ERROR(Invalid path to option --with-perfctr=PATH)
fi
PERFCTR_PATH="$with_perfctr"
AC_DEFINE(USE_PERFCTR,[1],
[Define to enable hrvtime() on Linux systems with perfctr extension])
fi
AC_ARG_ENABLE(clock-gettime,
[ --enable-clock-gettime Use clock-gettime for time correction],
[ case "$enableval" in
no) clock_gettime_correction=no ;;
*) clock_gettime_correction=yes ;;
esac ], clock_gettime_correction=unknown)
AC_ARG_ENABLE(native-ethr-impls,
[ --enable-native-ethr-impls enable native ethread implementations
--disable-native-ethr-impls disable native ethread implementations],
[ case "$enableval" in
no) disable_native_ethr_impls=yes ;;
*) disable_native_ethr_impls=no ;;
esac ], disable_native_ethr_impls=no)
dnl Defined in libraries/megaco/configure.in but we need it here
dnl also in order to show it to the "top user"
AC_ARG_ENABLE(megaco_flex_scanner_lineno,
[ --disable-megaco-flex-scanner-lineno disable megaco flex scanner lineno])
dnl Magic test for clearcase.
OTP_RELEASE=
if test "${ERLANG_COMMERCIAL_BUILD}" != ""; then
OTP_EXTRA_FLAGS=-DOTP_RELEASE
OTP_RELEASE=yes
else
OTP_EXTRA_FLAGS=
fi
AC_SUBST(OTP_RELEASE)
dnl OK, we might have darwin switches off different kinds, lets
dnl check it all before continuing.
TMPSYS=`uname -s`-`uname -m`
if test X${enable_darwin_universal} = Xyes; then
if test X${enable_darwin_64bit} = Xyes; then
AC_MSG_ERROR([--enable-darwin-universal and --enable-darwin-64bit mutually exclusive])
fi
enable_hipe=no
case $CFLAGS in
*-arch\ ppc*)
;;
*)
CFLAGS="-arch ppc $CFLAGS"
;;
esac
case $CFLAGS in
*-arch\ i386*)
;;
*)
CFLAGS="-arch i386 $CFLAGS"
;;
esac
fi
if test X${enable_darwin_64bit} = Xyes; then
case "$TMPSYS" in
Darwin-i386|Darwin-x86_64)
;;
Darwin*)
AC_MSG_ERROR([--enable-darwin-64bit only supported on x86 hosts])
;;
*)
AC_MSG_ERROR([--enable-darwin-64bit only supported on Darwin])
;;
esac
fi
if test X${enable_darwin_64bit} = Xyes -o X${enable_m64_build} = Xyes; then
enable_hipe=no
case $CFLAGS in
*-m64*)
;;
*)
CFLAGS="-m64 $CFLAGS"
;;
esac
else
case $host_os in
darwin*)
case $CFLAGS in
*-m32*)
;;
*)
CFLAGS="-m32 $CFLAGS"
;;
esac
;;
*)
;;
esac
fi
dnl ----------------------------------------------------------------------
dnl Checks for programs.
dnl ----------------------------------------------------------------------
AC_PROG_CC
AC_SUBST(GCC)
dnl ---------------------------------------------------------------------
dnl Special stuff regarding CFLAGS and details in the environment...
dnl ---------------------------------------------------------------------
dnl NOTE: CPPFLAGS will be included in CFLAGS at the end
case $host_os in
linux*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE";;
win32)
# The ethread library requires _WIN32_WINNT of at least 0x0403.
# -D_WIN32_WINNT=* from CPPFLAGS is saved in ETHR_DEFS.
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0500 -DWINVER=0x0500"
# _USE_32BIT_TIME_T is needed when using VC++ 2005 (ctime() will fail
# otherwise since we pass it a 32-bit value).
#
# FIXME: Use time_t all the way and remove _USE_32BIT_TIME_T.
AC_MSG_WARN([Reverting to 32-bit time_t])
CPPFLAGS="$CPPFLAGS -D_USE_32BIT_TIME_T"
;;
darwin*)
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE"
;;
*)
;;
esac
MIXED_CYGWIN=no
AC_MSG_CHECKING(for mixed cygwin and native VC++ environment)
if test "X$host" = "Xwin32" -a "x$GCC" != x"yes"; then
if test -x /usr/bin/cygpath; then
CFLAGS="-O2"
MIXED_CYGWIN=yes
AC_MSG_RESULT([yes])
MIXED_CYGWIN_VC=yes
CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_VC"
else
AC_MSG_RESULT([undeterminable])
AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!)
fi
else
AC_MSG_RESULT([no])
MIXED_CYGWIN_VC=no
fi
AC_SUBST(MIXED_CYGWIN_VC)
AC_MSG_CHECKING(for mixed cygwin and native MinGW environment)
if test "X$host" = "Xwin32" -a "x$GCC" = x"yes"; then
if test -x /usr/bin/cygpath; then
CFLAGS="-O2"
MIXED_CYGWIN=yes
AC_MSG_RESULT([yes])
MIXED_CYGWIN_MINGW=yes
CPPFLAGS="$CPPFLAGS -DERTS_MIXED_CYGWIN_MINGW"
else
AC_MSG_RESULT([undeterminable])
AC_MSG_ERROR(Seems to be mixed windows but not with cygwin, cannot handle this!)
fi
else
AC_MSG_RESULT([no])
MIXED_CYGWIN_MINGW=no
fi
AC_SUBST(MIXED_CYGWIN_MINGW)
AC_MSG_CHECKING(if we mix cygwin with any native compiler)
if test "X$MIXED_CYGWIN" = "Xyes" ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(MIXED_CYGWIN)
dnl
dnl Flags to the C compiler
dnl
dnl Make sure we find config.h
dnl
extra_flags="-I${ERL_TOP}/erts/$host $OTP_EXTRA_FLAGS"
CFLAGS="$CFLAGS $extra_flags"
DEBUG_CFLAGS="-g $CPPFLAGS $extra_flags"
DEBUG_FLAGS=-g
CFLAG_RUNTIME_LIBRARY_PATH="-Wl,-R"
case $host_os in
darwin*)
CFLAG_RUNTIME_LIBRARY_PATH=
CFLAGS="$CFLAGS -no-cpp-precomp"
;;
win32)
CFLAG_RUNTIME_LIBRARY_PATH=
;;
osf*)
CFLAG_RUNTIME_LIBRARY_PATH="-Wl,-rpath,"
;;
*)
;;
esac
dnl
dnl Use the getconf utility if it exists
dnl to find large file support flags.
dnl
if type getconf >/dev/null 2>&1; then
CFLAGS="$CFLAGS `getconf LFS_CFLAGS 2>/dev/null`"
DEBUG_CFLAGS="$DEBUG_CFLAGS `getconf LFS_CFLAGS 2>/dev/null`"
LDFLAGS="$LDFLAGS `getconf LFS_LDFLAGS 2>/dev/null`"
LIBS="$LIBS `getconf LFS_LIBS 2>/dev/null`"
fi
if test "x$GCC" = xyes; then
# until the emulator can handle this, I suggest we turn it off!
#WFLAGS="-Wall -Wshadow -Wcast-qual -Wmissing-declarations"
WFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
saved_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wdeclaration-after-statement"
AC_TRY_COMPILE([],[;], warn_decl_after_st=true, warn_decl_after_st=false)
if test "X$warn_decl_after_st" = "Xtrue"; then
WFLAGS="$WFLAGS -Wdeclaration-after-statement"
fi
CFLAGS=$saved_CFLAGS
else
WFLAGS=""
fi
dnl DEBUG_FLAGS is obsolete (I hope)
AC_SUBST(DEBUG_FLAGS)
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(WFLAGS)
AC_SUBST(CFLAG_RUNTIME_LIBRARY_PATH)
AC_CHECK_SIZEOF(void *) # Needed for ARCH and smp checks below
dnl
dnl Figure out operating system and cpu architecture
dnl
if test "x$host_alias" != "x"; then
chk_opsys_=$host_os
else
chk_opsys_=`uname -s`
if test "x$chk_opsys_" = "xSunOS"; then
chk_opsys_=$chk_opsys_`uname -r`
fi
fi
case $chk_opsys_ in
win32) OPSYS=win32;;
solaris2.*|SunOS5.*) OPSYS=sol2;;
linux|Linux) OPSYS=linux;;
darwin|Darwin) OPSYS=darwin;;
freebsd|FreeBSD) OPSYS=freebsd;;
*) OPSYS=noopsys
esac
if test "x$host_alias" != "x" -a "x$host_cpu" != "x"; then
chk_arch_=$host_cpu
else
chk_arch_=`uname -m`
fi
case $chk_arch_ in
sun4u) ARCH=ultrasparc;;
sparc64) ARCH=sparc64;;
sun4v) ARCH=ultrasparc;;
i86pc) ARCH=x86;;
i386) ARCH=x86;;
i486) ARCH=x86;;
i586) ARCH=x86;;
i686) ARCH=x86;;
x86_64) ARCH=amd64;;
amd64) ARCH=amd64;;
macppc) ARCH=ppc;;
ppc) ARCH=ppc;;
ppc64) ARCH=ppc64;;
"Power Macintosh") ARCH=ppc;;
armv5b) ARCH=arm;;
armv5teb) ARCH=arm;;
armv5tel) ARCH=arm;;
tile) ARCH=tile;;
*) ARCH=noarch;;
esac
dnl
dnl Convert between x86 and amd64 based on the compiler's mode.
dnl Ditto between ultrasparc and sparc64.
dnl
AC_MSG_CHECKING(whether compilation mode forces ARCH adjustment)
case "$ARCH-$ac_cv_sizeof_void_p" in
i386-8)
AC_MSG_RESULT(yes: adjusting ARCH=x86 to ARCH=amd64)
ARCH=amd64
;;
x86-8)
AC_MSG_RESULT(yes: adjusting ARCH=x86 to ARCH=amd64)
ARCH=amd64
;;
amd64-4)
AC_MSG_RESULT(yes: adjusting ARCH=amd64 to ARCH=x86)
ARCH=x86
;;
ultrasparc-8)
AC_MSG_RESULT(yes: adjusting ARCH=ultrasparc to ARCH=sparc64)
ARCH=sparc64
;;
sparc64-4)
AC_MSG_RESULT(yes: adjusting ARCH=sparc64 to ARCH=ultrasparc)
ARCH=ultrasparc
;;
ppc64-4)
AC_MSG_RESULT(yes: adjusting ARCH=ppc64 to ARCH=ppc)
ARCH=ppc
;;
*)
AC_MSG_RESULT(no)
;;
esac
AC_SUBST(OPSYS)
AC_SUBST(ARCH)
dnl Check consistency of os and darwin-switches
dnl Take care of LDFLAGS on darwin, and disable common_test as it
dnl has a build/configure system re rx-lib that is not compatible
dnl First remove common_tests skip file.
dnl Adjust LDFLAGS to allow 64bit linkage on DARWIN
case $ARCH-$OPSYS in
amd64-darwin*)
AC_MSG_NOTICE([Adjusting LDFLAGS to cope with 64bit Darwin])
case $LDFLAGS in
*-m64*)
;;
*)
LDFLAGS="-m64 $LDFLAGS"
;;
esac
;;
*-darwin*)
if test X${enable_darwin_universal} = Xyes; then
AC_MSG_NOTICE([Adjusting LDFLAGS for universal binaries])
case $LDFLAGS in
*-arch\ ppc*)
;;
*)
LDFLAGS="-arch ppc $LDFLAGS"
;;
esac
case $LDFLAGS in
*-arch\ i386*)
;;
*)
LDFLAGS="-arch i386 $LDFLAGS"
;;
esac
else
case $LDFLAGS in
*-m32*)
;;
*)
LDFLAGS="-m32 $LDFLAGS"
;;
esac
fi
;;
*)
if test X${enable_m64_build} = Xyes; then
AC_MSG_NOTICE([Adjusting LDFLAGS to use -m64])
case $LDFLAGS in
*-m64*)
;;
*)
LDFLAGS="-m64 $LDFLAGS"
;;
esac
fi
;;
esac
AC_MSG_CHECKING(if VM has to be linked with Carbon framework)
case $ARCH-$OPSYS in
amd64-darwin*)
LIBCARBON=
AC_MSG_RESULT([no])
;;
*-darwin*)
LIBCARBON="-framework Carbon "
AC_MSG_RESULT([yes])
;;
*)
LIBCARBON=
AC_MSG_RESULT([no])
;;
esac
AC_SUBST(LIBCARBON)
dnl some tests below will call this if we haven't already - and autoconf
dnl can't handle those tests being done conditionally at runtime
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_YACC
LM_PROG_PERL5
if test "$ac_cv_path_PERL" = false; then
AC_MSG_ERROR([Perl version 5 is required to build the emulator!])
fi
AC_PROG_LN_S
AC_CHECK_PROG(AR, ar, ar, false)
if test "$ac_cv_prog_AR" = false; then
AC_MSG_ERROR([No 'ar' command found in PATH])
fi
_search_path=/bin:/usr/bin:/usr/local/bin:$PATH
AC_PATH_PROG(RM, rm, false, $_search_path)
if test "$ac_cv_path_RM" = false; then
AC_MSG_ERROR([No 'rm' command found])
fi
AC_PATH_PROG(MKDIR, mkdir, false, $_search_path)
if test "$ac_cv_path_MKDIR" = false; then
AC_MSG_ERROR([No 'mkdir' command found])
fi
_search_path=
#
# Get programs needed for building the documentation
#
## Delete previous failed configure results
if test -f doc/CONF_INFO; then
rm doc/CONF_INFO
fi
AC_CHECK_PROGS(XSLTPROC, xsltproc)
if test -z "$XSLTPROC"; then
echo "xsltproc" >> doc/CONF_INFO
AC_MSG_WARN([No 'xsltproc' command found: the documentation can not be built])
fi
AC_CHECK_PROGS(FOP, fop)
if test -z "$FOP"; then
echo "fop" >> doc/CONF_INFO
AC_MSG_WARN([No 'fop' command found: the documentation can not be built])
fi
dnl
dnl We can live with Solaris /usr/ucb/install
dnl
case $host in
*-*-solaris*|free_source)
if test -x /usr/ucb/install; then
INSTALL="/usr/ucb/install -c"
fi
;;
*)
;;
esac
AC_PROG_INSTALL
LM_PROG_INSTALL_DIR
case $host_os in
darwin*)
dnl Need to preserve modification time on archives;
dnl otherwise, ranlib has to be run on archives
dnl again after installation.
INSTALL_DATA="$INSTALL_DATA -p";;
*)
;;
esac
dnl
dnl Fix for Tilera install permissions
dnl
case $build in
*tile*)
INSTALL_PROGRAM="$INSTALL_PROGRAM -m755"
INSTALL_SCRIPT="$INSTALL_SCRIPT -m755"
;;
*)
;;
esac
dnl ----------------------------------------------------------------------
dnl Misc. things (some of them should go away)
dnl ----------------------------------------------------------------------
dnl
dnl An attempt to allow cross compiling. This is not the right way,
dnl nor does it work currently. Some makefiles still needs these
dnl variables, so we leave them in for now.
dnl
HCC='$(CC)' AC_SUBST(HCC)
HCFLAGS="" AC_SUBST(HCFLAGS)
HCFLAGS="$HCFLAGS -I${ERL_TOP}/erts/$host"
vxworks_reclaim="" AC_SUBST(vxworks_reclaim)
LD='$(CC)' AC_SUBST(LD)
dnl Check for cygwin and object/exe files extension
dnl AC_CYGWIN is deprecated
AC_EXEEXT
AC_OBJEXT
dnl This is the os flavour, should be unix, vxworks or win32
if test "X$host" = "Xwin32"; then
ERLANG_OSTYPE=win32
else
ERLANG_OSTYPE=unix
fi
AC_SUBST(ERLANG_OSTYPE)
dnl Which sysv4 would this be, and what is it for???
dnl XXX: replace with feature tests.
case $host_os in
sysv4*)
AC_DEFINE(SOCKOPT_CONNECT_STAT,[],[Obscure SYSV feature])
AC_DEFINE(NO_PRAGMA_WEAK,[],[Obscure SYSV feature])
LIBS="$LIBS -lgen -lc -L /usr/ucblib -lucb"
;;
esac
# Check how to export functions from the emulator executable, needed
# when dynamically loaded drivers are loaded (so that they can find
# emulator functions).
# OS'es with ELF executables using the GNU linker (Linux and recent *BSD,
# in rare cases Solaris) typically need '-Wl,-export-dynamic' (i.e. pass
# -export-dynamic to the linker - also known as -rdynamic and some other
# variants); some sysVr4 system(s) instead need(s) '-Wl,-Bexport'.
# AIX 4.x (perhaps only for x>=2) wants -Wl,-bexpall,-brtl and doesn't
# reliably return an error for others, thus we separate it out.
# Otherwise we assume that if the linker accepts the flag, it is needed.
AC_MSG_CHECKING(for extra flags needed to export symbols)
DEXPORT=""
case $host_os in
aix4*)
DEXPORT=-Wl,-bexpall,-brtl
;;
bsdi*)
DEXPORT="-rdynamic "
;;
win32)
DEXPORT=""
;;
*)
save_ldflags="$LDFLAGS"
LDFLAGS=-Wl,-export-dynamic
AC_TRY_LINK(,,[DEXPORT=-Wl,-export-dynamic], [
LDFLAGS=-Wl,-Bexport
AC_TRY_LINK(,,[DEXPORT=-Wl,-Bexport],
AC_MSG_RESULT(none))])
LDFLAGS="$save_ldflags"
;;
esac
AC_SUBST(DEXPORT)
case "x$DEXPORT" in
"x")
AC_MSG_RESULT([none]);;
*)
AC_MSG_RESULT([$DEXPORT]);;
esac
# Check for Solaris/ultrasparc /dev/perfmon interface
# (also needs gcc specific asm instructions)
case "${host}:${GCC}" in
sparc-*-solaris*:yes)
AC_DEFINE(HAVE_SOLARIS_SPARC_PERFMON,[1],
[define if you have the Solaris/ultrasparc /dev/perfmon interface])
;;
*)
;;
esac
dnl ----------------------------------------------------------------------
dnl Checks for libraries.
dnl ----------------------------------------------------------------------
AC_CHECK_LIB(m, sin)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(inet, main)
AC_CHECK_LIB(util, openpty)
dnl Try to find a thread library.
dnl
dnl ETHR_LIB_NAME, ETHR_LIBS, ETHR_X_LIBS, ETHR_THR_LIB_BASE and ETHR_DEFS
dnl are set by ERL_FIND_ETHR_LIB
ERL_FIND_ETHR_LIB
if test "X$ETHR_LIB_NAME" = "X"; then
found_threads=no
else
found_threads=yes
fi
ERTS_BUILD_SMP_EMU=$enable_smp_support
AC_MSG_CHECKING(whether an emulator with smp support should be built)
case $ERTS_BUILD_SMP_EMU in
yes)
AC_MSG_RESULT(yes; enabled by user)
;;
no)
AC_MSG_RESULT(no; disabled by user)
;;
unknown)
AC_TRY_COMPILE([],[
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
;
#else
#error old or no gcc
#endif
],
gcc_smp=okgcc,
gcc_smp=oldornogcc)
ERTS_BUILD_SMP_EMU=yes
case "$enable_threads-$gcc_smp-$found_threads-$host_os" in
no-*)
AC_MSG_RESULT(no; threads disabled by user)
ERTS_BUILD_SMP_EMU=no
;;
*-okgcc-yes-*)
AC_MSG_RESULT(yes)
ERTS_BUILD_SMP_EMU=yes
;;
*-win32)
AC_MSG_RESULT(yes)
ERTS_BUILD_SMP_EMU=yes
;;
*-oldornogcc-*)
AC_MSG_RESULT(no; old gcc or no gcc found)
ERTS_BUILD_SMP_EMU=no
;;
*)
AC_MSG_RESULT(no)
ERTS_BUILD_SMP_EMU=no
;;
esac
;;
esac
if test $ERTS_BUILD_SMP_EMU = yes; then
if test $found_threads = no; then
AC_MSG_ERROR([cannot build smp enabled emulator since no thread library was found])
fi
AC_DEFINE(ERTS_HAVE_SMP_EMU, 1, [Define if the smp emulator is built])
enable_threads=force
fi
AC_SUBST(ERTS_BUILD_SMP_EMU)
#
# Figure out if the emulator should use threads. The default is set above
# in the enable_threads variable. It can have the following values:
#
# no single-threaded emulator requested
# yes multi-threaded emulator requested
# force multi-threaded emulator required
#
# EMU_THR_LIB_NAME, EMU_THR_LIBS, EMU_THR_X_LIBS, and EMU_THR_DEFS is
# used by the emulator, and can (but should not) be used by applications
# that only require thread support when the emulator has thread support.
# Other applications should use ETHR_LIB_NAME, ETHR_LIBS, ETHR_X_LIBS,
# and ETHR_DEFS.
#
AC_MSG_CHECKING(whether the emulator should use threads)
EMU_THR_LIB_NAME=
EMU_THR_X_LIBS=
EMU_THR_LIBS=
EMU_THR_DEFS=
emu_threads=no
case "$enable_threads"-"$host_os" in
*-win32)
# The windows erlang emulator can never run without threads.
# It has to be enabled or the emulator will crash. Until that
# is fixed we force threads on win32.
enable_threads=force ;;
yes-osf*)
# The emulator hang when threads are enabled on osf
AC_MSG_ERROR(unresolved problems exist with threads on this platform) ;;
*) ;;
esac
case "$enable_threads"-"$found_threads" in
force-yes)
emu_threads=yes
AC_MSG_RESULT(yes; thread support required and therefore forced) ;;
yes-yes)
emu_threads=yes
AC_MSG_RESULT(yes; enabled by user) ;;
unknown-yes)
case $host_os in
solaris*|linux*|darwin*|win32)
emu_threads=yes
AC_MSG_RESULT(yes; default on this platform)
;;
*)
AC_MSG_RESULT(no; default on this platform)
;;
esac
;;
no-yes)
AC_MSG_RESULT(no; thread support found but disabled by user) ;;
unknown-no|no-no)
AC_MSG_RESULT(no) ;;
force-no)
AC_MSG_ERROR(thread support required but not found) ;;
yes-no)
AC_MSG_ERROR(thread support enabled by user but not found) ;;
*)
AC_MSG_ERROR(internal error) ;;
esac
if test $emu_threads != yes; then
enable_lock_check=no
enable_lock_count=no
else
# Threads enabled for emulator
EMU_THR_LIB_NAME=$ETHR_LIB_NAME
EMU_THR_X_LIBS=$ETHR_X_LIBS
EMU_THR_LIBS=$ETHR_LIBS
EMU_THR_DEFS=$ETHR_DEFS
ENABLE_ALLOC_TYPE_VARS="$ENABLE_ALLOC_TYPE_VARS threads"
AC_MSG_CHECKING(whether lock checking should be enabled)
AC_MSG_RESULT($enable_lock_check)
if test "x$enable_lock_check" != "xno"; then
EMU_THR_DEFS="$EMU_THR_DEFS -DERTS_ENABLE_LOCK_CHECK"
fi
AC_MSG_CHECKING(whether lock counters should be enabled)
AC_MSG_RESULT($enable_lock_count)
if test "x$enable_lock_count" != "xno"; then
EMU_THR_DEFS="$EMU_THR_DEFS -DERTS_ENABLE_LOCK_COUNT"
fi
disable_child_waiter_thread=no
case $host_os in
solaris*)
enable_child_waiter_thread=yes
;;
linux*)
AC_DEFINE(USE_RECURSIVE_MALLOC_MUTEX,[1],
[Define if malloc should use a recursive mutex])
AC_MSG_CHECKING([whether dlopen() needs to be called before first call to dlerror()])
if test "x$ETHR_THR_LIB_BASE_NAME" != "xnptl"; then
AC_DEFINE(ERTS_NEED_DLOPEN_BEFORE_DLERROR,[1],
[Define if dlopen() needs to be called before first call to dlerror()])
AC_MSG_RESULT(yes)