-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
4533 lines (4242 loc) · 142 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.
AC_INIT()
{
AC_CONFIG_AUX_DIR(tool)
AC_PREREQ(2.67)
AC_DEFUN([RUBY_PREREQ_AC],
[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), [-1],
AC_MSG_ERROR([Autoconf version ]$1[ or higher is required]$2))])
AC_DISABLE_OPTION_CHECKING
AC_ARG_VAR([cflags], [additional CFLAGS])
AC_ARG_VAR([cppflags], [additional CPPFLAGS])
AC_ARG_VAR([cxxflags], [additional CXXFLAGS])
AC_DEFUN([RUBY_RM_RECURSIVE], [
m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [2.70]), [-1], [
# suppress error messages, rm: cannot remove 'conftest.dSYM', from
# AC_EGREP_CPP with CFLAGS=-g on Darwin.
#
# TODO: remove this hack when AC_PREREQ() becomes 2.70 or later.
AS_CASE([$build_os], [darwin*], [
rm() {
rm_recursive=''
for arg do
AS_CASE("$arg",
[--*], [],
[-*r*], [break],
[conftest.*], [if test -d "$arg"; then rm_recursive=-r; break; fi],
[])
done
command rm $rm_recursive "[$]@"
}
])])])
{ # environment section
AC_ARG_WITH(baseruby,
AS_HELP_STRING([--with-baseruby=RUBY], [use RUBY as baseruby; RUBY is the pathname of ruby]),
[
AS_CASE(["$withval"],[*ruby*],[BASERUBY=$withval],[AC_MSG_ERROR(need ruby)])
],
[
AC_PATH_PROG([BASERUBY], [ruby], [false])
])
if test "`RUBYOPT=- $BASERUBY -e 'print 42' 2>/dev/null`" = 42; then
if test "`RUBYOPT=- $BASERUBY --disable=gems -e 'print 42' 2>/dev/null`" = 42; then
BASERUBY="$BASERUBY --disable=gems"
fi
$BASERUBY -C "$srcdir/tool" downloader.rb -e gnu config.guess config.sub
HAVE_BASERUBY=yes
else
BASERUBY="echo executable host ruby is required. use --with-baseruby option.; false"
HAVE_BASERUBY=no
fi
AC_SUBST(BASERUBY)
AC_SUBST(HAVE_BASERUBY)
AC_DEFUN([RUBY_MINGW32],
[AS_CASE(["$host_os"],
[cygwin*], [
AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32,
[AC_TRY_CPP([
#ifndef __MINGW32__
# error
#endif
], rb_cv_mingw32=yes,rb_cv_mingw32=no)
rm -f conftest*])
if test "$rb_cv_mingw32" = yes; then
target_os="mingw32"
: ${ac_tool_prefix:="`expr "$CC" : ['\(.*-\)g\?cc[^/]*$']`"}
fi
])
AS_CASE(["$target_os"], [mingw*msvc], [
target_os="`echo ${target_os} | sed 's/msvc$//'`"
])
AS_CASE(["$target_cpu-$target_os"], [x86_64-mingw*], [
target_cpu=x64
])
])
AC_DEFUN([RUBY_NACL],
[
AS_CASE(["${host_os}"],
[nacl], [
ac_cv_exeext=.nexe
host_vendor=chromium
ac_cv_host=chromium
AC_MSG_CHECKING([wheather \$NACL_SDK_ROOT is set])
if test x"${NACL_SDK_ROOT}" = x; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([You need to set \$NACL_SDK_ROOT environment variable to build for NativeClient])
fi
AC_MSG_RESULT([yes])
nacl_cv_build_variant=glibc
AC_ARG_WITH(newlib,
AS_HELP_STRING([--with-newlib], [uses newlib version of NativeClient SDK]),
[AS_CASE([$withval],
[no], [nacl_cv_build_variant=glibc],
[yes], [nacl_cv_build_variant=newlib])])
AS_CASE(["$target_cpu"],
[x86_64], [nacl_cv_cpu_nick=x86
nacl_cv_cpu_nick2=x86_64],
[i?86], [nacl_cv_cpu_nick=x86
nacl_cv_cpu_nick2=x86_32],
[le32], [nacl_cv_cpu_nick=pnacl
nacl_cv_cpu_nick2=pnacl
ac_cv_exeext=.pexe],
[nacl_cv_cpu_nick=$target_cpu])
AS_CASE(["$build_os"],
[linux*], [nacl_cv_os_nick=linux],
[darwin*], [nacl_cv_os_nick=mac],
[cygwin*|mingw*], [nacl_cv_os_nick=win],
[nacl_cv_os_nick=$build_os])
host="$host_cpu-chromium-$host_os-"
ac_tool_prefix="$host_cpu-nacl-"
AC_MSG_CHECKING([NativeClient toolchain])
if test x"$nacl_cv_cpu_nick" = xpnacl; then
NACL_TOOLCHAIN="${nacl_cv_os_nick}_pnacl"
ac_tool_prefix=pnacl-
elif test -d \
"${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_${nacl_cv_build_variant}"; then
NACL_TOOLCHAIN="${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_${nacl_cv_build_variant}"
elif test -d \
"${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_x86_${nacl_cv_cpu_nick}/${nacl_cv_build_variant}"; then
NACL_TOOLCHAIN="${nacl_cv_os_nick}_x86_${nacl_cv_cpu_nick}/${nacl_cv_build_variant}"
else
AS_CASE(
["${nacl_cv_build_variant}"],
[glibc], [if test \
-d "${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_newlib" \
-a -d "${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_${nacl_cv_cpu_nick}"; then
NACL_TOOLCHAIN="${nacl_cv_os_nick}_${nacl_cv_cpu_nick}"
fi],
[newlib], [ NACL_TOOLCHAIN="${nacl_cv_os_nick}_${nacl_cv_cpu_nick}" ])
fi
if test ! -e "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/${ac_tool_prefix}gcc"; then
if test "${build_cpu}" = i686 -a -e "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/nacl-gcc"; then
ac_tool_prefix=nacl-
fi
if test "${build_cpu}" = x86_64 -a -e "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/nacl-gcc"; then
ac_tool_prefix=nacl64-
fi
fi
if test -z "${NACL_TOOLCHAIN}"; then
AC_MSG_ERROR([Unrecognized --host and --build combination or NaCl SDK is not installed])
fi
AC_MSG_RESULT(${NACL_TOOLCHAIN})
AC_MSG_CHECKING([path to SDK])
if ! echo -- "${PATH}" | grep -F "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/bin" > /dev/null; then
PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/bin"
fi
AC_MSG_RESULT(${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/bin)
RUBY_APPEND_OPTIONS(XCFLAGS, '-I$(NACL_SDK_ROOT)/include')
if test x"${nacl_cv_cpu_nick}" = xpnacl; then
RUBY_APPEND_OPTIONS(XCFLAGS, '-isystem $(NACL_SDK_ROOT)/include/pnacl')
elif test x"${nacl_cv_build_variant}" = xnewlib; then
RUBY_APPEND_OPTIONS(XCFLAGS, '-isystem $(NACL_SDK_ROOT)/include/newlib')
fi
AC_MSG_CHECKING([nacl library path])
if test -d "${NACL_SDK_ROOT}/lib/${nacl_cv_build_variant}_${nacl_cv_cpu_nick2}/Release"; then
nacl_cv_libpath="${nacl_cv_build_variant}_${nacl_cv_cpu_nick2}"
elif test -d "${NACL_SDK_ROOT}/lib/${nacl_cv_cpu_nick2}/Release"; then
nacl_cv_libpath="${nacl_cv_cpu_nick2}"
else
AC_MSG_ERROR([not found])
fi
AC_MSG_RESULT([${nacl_cv_libpath}])
RUBY_APPEND_OPTIONS(XLDFLAGS, '-L$(NACL_SDK_ROOT)/'"lib/${nacl_cv_libpath}/Release")
AC_SUBST(NACL_TOOLCHAIN)
AC_SUBST(NACL_SDK_ROOT)
AC_SUBST(NACL_SDK_VARIANT, "${nacl_cv_build_variant}")
AC_SUBST(NACL_LIB_PATH, "${nacl_cv_libpath}")
AC_CHECK_TOOLS(CC, [clang gcc])
AC_CHECK_TOOLS(CXX, [clang++ g++])
])])
AC_DEFUN([RUBY_NACL_CHECK_PEPPER_TYPES],
[AS_CASE(["${host_os}"],
[nacl], [
AC_CHECK_TYPES([struct PPB_Core, struct PPB_Messaging, struct PPB_Var,
struct PPB_URLLoader, struct PPB_URLRequestInfo,
struct PPB_URLResponseInfo, struct PPB_FileRef,
struct PPP_Instance])
])
])
AC_DEFUN([RUBY_CPPOUTFILE],
[AC_CACHE_CHECK(whether ${CPP} accepts -o, rb_cv_cppoutfile,
[save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS='-o conftest-1.i'
rb_cv_cppoutfile=no
AC_TRY_CPP([test-for-cppout],
[grep test-for-cppout conftest-1.i > /dev/null && rb_cv_cppoutfile=yes])
CPPFLAGS="$save_CPPFLAGS"
rm -f conftest*])
if test "$rb_cv_cppoutfile" = yes; then
CPPOUTFILE='-o conftest.i'
elif test "$rb_cv_cppoutfile" = no; then
CPPOUTFILE='> conftest.i'
elif test -n "$rb_cv_cppoutfile"; then
CPPOUTFILE="$rb_cv_cppoutfile"
fi
AC_SUBST(CPPOUTFILE)])
AC_DEFUN([RUBY_PROG_GNU_LD],
[AC_CACHE_CHECK(whether the linker is GNU ld, rb_cv_prog_gnu_ld,
[if `$CC $CFLAGS $CPPFLAGS $LDFLAGS --print-prog-name=ld 2>&1` -v 2>&1 | grep "GNU ld" > /dev/null; then
rb_cv_prog_gnu_ld=yes
else
rb_cv_prog_gnu_ld=no
fi
])
GNU_LD=$rb_cv_prog_gnu_ld
AC_SUBST(GNU_LD)])
eval `sed -n ['s/^@%:@define RUBY_API_VERSION_\([A-Z][A-Z_0-9]*\) \([0-9][0-9]*\)/API_\1=\2/p'] $srcdir/include/ruby/version.h`
RUBY_PROGRAM_VERSION=`sed -n 's/^@%:@define RUBY_VERSION "\(.*\)"/\1/p' $srcdir/version.h`
MAJOR=`echo $RUBY_PROGRAM_VERSION | cut -d. -f1`
MINOR=`echo $RUBY_PROGRAM_VERSION | cut -d. -f2`
TEENY=`echo $RUBY_PROGRAM_VERSION | cut -d. -f3`
for v in MAJOR MINOR TEENY; do
if eval "test \"\$$v\" = ''"; then
AC_MSG_ERROR(could not determine $v number from version.h)
fi
done
AS_IF([test "$MAJOR.$MINOR" != "$API_MAJOR.$API_MINOR"], [
AC_MSG_ERROR([API version $API_MAJOR.$API_MINOR differs from program version $MAJOR.$MINOR])
])
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(TEENY)
AC_SUBST(RUBY_PROGRAM_VERSION)
RUBY_PATCHLEVEL=`sed -n 's/^#define RUBY_PATCHLEVEL //p' $srcdir/version.h`
AC_DEFINE(CANONICALIZATION_FOR_MATHN)
dnl checks for alternative programs
AC_CANONICAL_BUILD
RUBY_RM_RECURSIVE
AC_ARG_WITH(gcc,
AS_HELP_STRING([--without-gcc], [never use gcc]),
[
AS_CASE([$withval],
[no], [: ${CC=cc}],
[yes], [: ${CC=gcc}],
[CC=$withval])])
dnl If the user switches compilers, we can't believe the cache
if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
then
AC_MSG_ERROR(cached CC is different -- throw away $cache_file
(it is also a good idea to do 'make clean' before compiling))
fi
AS_CASE(["$build_os"],
[darwin1*.*], [
AS_CASE(["x$CC"],
[xgcc-4.2|x/usr/bin/gcc-4.2], [: ${CXX=g++-4.2}],
[xgcc|x/usr/bin/gcc], [: ${CXX=g++}],
[xcc|x/usr/bin/cc], [: ${CXX=c++}],
[xicc], [: ${CXX=icpc}],
[xclang|x/usr/bin/clang], [: ${CXX=clang++}])
])
test -z "$CC" || ac_cv_prog_CC="$CC"
test -z "$CXX" || ac_cv_prog_CXX="$CXX"
if test "$program_prefix" = NONE; then
program_prefix=
fi
if test "$prefix" -ef .; then
AC_MSG_ERROR(--prefix cannot be the current working directory.)
fi
RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"`
RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
AC_SUBST(RUBY_BASE_NAME)
AC_SUBST(RUBYW_BASE_NAME)
AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version}')
AC_CANONICAL_TARGET
test x"$target_alias" = x &&
target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
ac_install_sh='' # unusable for extension libraries.
AC_ARG_WITH(os-version-style,
AS_HELP_STRING([--with-os-version-style=TYPE],
[OS version number for target and target_os [[full]]]
[(full|teeny|minor+0|minor|major+0|major|none)]),
[os_version_style=$withval],
[os_version_style=full
AS_CASE($target_os, [[*[0-9].*]],
[AS_CASE([`/usr/bin/ruby -e 'puts RUBY_PLATFORM' 2>/dev/null`],
[[*-*[0-9].*.0]], [os_version_style=minor+0],
[[*-*[0-9].*.*]], [os_version_style=full],
[[*-*[0-9].0] ], [os_version_style=major+0],
[[*-*[0-9].*] ], [os_version_style=minor],
[[*-*[0-9]] ], [os_version_style=major],
)])
])
os_version_style_transform=
AS_CASE("${os_version_style}",
[full|teeny], [],
[minor+0], [os_version_style_transform=['s/\([0-9]\.[0-9][0-9]*\)\.[0-9][.0-9]*$/\1.0/']],
[minor], [os_version_style_transform=['s/\([0-9]\.[0-9][0-9]*\)\.[0-9][.0-9]*$/\1/']],
[major+0], [os_version_style_transform=['s/\([0-9]\)\.[0-9][.0-9]*$/\1.0/']],
[major], [os_version_style_transform=['s/\([0-9]\)\.[0-9][.0-9]*$/\1/']],
[none], [os_version_style_transform=['s/[0-9]\.[0-9][.0-9]*$//']],
[AC_MSG_ERROR(unknown --with-os-version-style: $withval)])
AS_IF([test -z "$target_alias" -a -n "$os_version_style_transform"],
[
target=`echo ${target} | sed "$os_version_style_transform"`
target_os=`echo ${target_os} | sed "$os_version_style_transform"`
])
AC_DEFUN([RUBY_APPEND_OPTION],
[# RUBY_APPEND_OPTION($1)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="[$]$1 $2"])])
AC_DEFUN([RUBY_APPEND_OPTIONS],
[# RUBY_APPEND_OPTIONS($1)
for rb_opt in $2; do
AS_CASE([" [$]{$1-} "],
[*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ $1="[$]$1 [$]{rb_opt}"])
done])
AC_DEFUN([RUBY_PREPEND_OPTION],
[# RUBY_PREPEND_OPTION($1)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="$2 [$]$1"])])
AC_DEFUN([RUBY_PREPEND_OPTIONS],
[# RUBY_PREPEND_OPTIONS($1)
unset rb_opts; for rb_opt in $2; do
AS_CASE([" [$]{rb_opts} [$]{$1-} "],
[*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ rb_opts="[$]{rb_opts}[$]{rb_opt} "])
done
$1="[$]{rb_opts}[$]$1"])
AC_ARG_WITH(arch,
AS_HELP_STRING([--with-arch=ARCHS],
[build an Apple/NeXT Multi Architecture Binary (MAB);
ARCHS is a comma-delimited list of architectures for
which to build; if this option is disabled or omitted
entirely, then the package will be built only for the
target platform]),
[target_archs="$withval"], [unset target_archs])
AC_DEFUN([RUBY_DEFAULT_ARCH], [
AC_MSG_CHECKING([arch option])
AS_CASE([$1],
[*64], [ARCH_FLAG=-m64],
[[i[3-6]86]], [ARCH_FLAG=-m32],
[AC_MSG_ERROR(unknown target architecture: $target_archs)]
)
AC_MSG_RESULT([$ARCH_FLAG])
])
AC_DEFUN([RUBY_UNIVERSAL_ARCH], [
# RUBY_UNIVERSAL_ARCH begin
ARCH_FLAG=`expr " $CXXFLAGS " : ['.* \(-m[0-9][0-9]*\) ']`
test ${CXXFLAGS+set} && CXXFLAGS=`echo "$CXXFLAGS" | sed [-e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g']`
ARCH_FLAG=`expr " $CFLAGS " : ['.* \(-m[0-9][0-9]*\) ']`
test ${CFLAGS+set} && CFLAGS=`echo "$CFLAGS" | sed [-e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g']`
test ${LDFLAGS+set} && LDFLAGS=`echo "$LDFLAGS" | sed [-e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g']`
unset universal_binary universal_archnames
if test ${target_archs+set}; then
AC_MSG_CHECKING([target architectures])
target_archs=`echo $target_archs | tr , ' '`
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
for archs in $target_archs
do
AS_CASE([",$universal_binary,"],[*",$archs,"*], [],[
cpu=`$SHELL "$ac_aux_dir/config.sub" "${archs}-${target_os}" 2>&1` || {
AC_MSG_RESULT([failed])
AC_MSG_ERROR([$cpu])
}
cpu=`echo $cpu | sed 's/-.*-.*//'`
universal_binary="${universal_binary+$universal_binary,}$cpu"
universal_archnames="${universal_archnames} ${archs}=${cpu}"
ARCH_FLAG="${ARCH_FLAG+$ARCH_FLAG }-arch $archs"
])
done
target_archs="$universal_binary"
unset universal_binary
AS_CASE(["$target_archs"],
[*,*], [universal_binary=yes],
[unset universal_archnames])
AC_MSG_RESULT([$target_archs])
target=`echo $target | sed "s/^$target_cpu-/-/"`
target_alias=`echo $target_alias | sed "s/^$target_cpu-/-/"`
if test "${universal_binary-no}" = yes; then
AC_SUBST(try_header,try_compile)
target_cpu=universal
real_cross_compiling=$cross_compiling
else
if test x"$target_cpu" != x"${target_archs}"; then
echo 'int main(){return 0;}' > conftest.c
if $CC $CFLAGS $ARCH_FLAG -o conftest conftest.c > /dev/null 2>&1; then
rm -fr conftest.*
else
RUBY_DEFAULT_ARCH("$target_archs")
fi
fi
target_cpu=${target_archs}
fi
AS_CASE(["$target"], [-*], [ target="$target_cpu${target}"])
AS_CASE(["$target_alias"], [-*], [ target_alias="$target_cpu${target_alias}"])
else
if test x"$target_alias" = x; then
AS_CASE(["$target_os"],
[darwin*], [
AC_MSG_CHECKING([for real target cpu])
target=`echo $target | sed "s/^$target_cpu-/-/"`
target_cpu=`$CC -E - 2>/dev/null <<EOF |
#ifdef __x86_64__
"processor-name=x86_64"
#endif
#ifdef __i386__
"processor-name=i386"
#endif
#ifdef __ppc__
"processor-name=powerpc"
#endif
#ifdef __ppc64__
"processor-name=powerpc64"
#endif
EOF
sed -n 's/^"processor-name=\(.*\)"/\1/p'`
target="$target_cpu${target}"
AC_MSG_RESULT([$target_cpu])
])
fi
target_archs="$target_cpu"
fi
if test "${target_archs}" != "${rb_cv_target_archs-${target_archs}}"; then
AC_MSG_ERROR([target arch(s) has changed from ${rb_cv_target_archs-nothing} to ${target_archs}])
else
rb_cv_target_archs=${target_archs}
fi
if test "x${ARCH_FLAG}" != x; then
CFLAGS="${CFLAGS:+$CFLAGS }${ARCH_FLAG}"
LDFLAGS="${LDFLAGS:+$LDFLAGS }${ARCH_FLAG}"
fi
# RUBY_UNIVERSAL_ARCH end
])
AC_ARG_ENABLE(load-relative,
AS_HELP_STRING([--enable-load-relative], [resolve load paths at run time]),
[load_relative=$enableval])
AC_ARG_PROGRAM
dnl Checks for programs.
cflagspat=
test -z "$optflags" ||
cflagspat="$cflagspat;s|"`eval echo '"'"${optflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/ *$/ /'`'| |g'
test -z "$debugflags" ||
cflagspat="$cflagspat;s|"`eval echo '"'"${debugflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/ *$/ /'`'| |g'
test -z "warnflags" ||
cflagspat="$cflagspat;s|"`eval echo '"'"${warnflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/ *$/ /'`'| |g'
if test -z "${CFLAGS+set}"; then
cflags=`echo " $cflags " | sed "$cflagspat;s/^ *//;s/ *$//"`
orig_cflags="$cflags"
cflags="$cflags "'${optflags} ${debugflags} ${warnflags}'
fi
if test -z "${CXXFLAGS+set}"; then
cxxflags=`echo " $cxxflags " | sed "$cflagspat;s/^ *//;s/ *$//"`
orig_cxxflags="$cxxflags"
cxxflags="$cxxflags "'${optflags} ${debugflags} ${warnflags}'
fi
RUBY_NACL
AS_CASE(["$host_os:$build_os"],
[darwin*:darwin*], [
AC_CHECK_TOOLS(CC, [clang gcc cc])
# Following Apple deployed clang are broken
# clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/tags/Apple/clang-23 exported)
# Apple clang version 2.0 (tags/Apple/clang-137) (based on LLVM 2.9svn)
# Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn)
if ! $CC -E -xc - <<SRC >/dev/null; then
@%:@if defined __APPLE_CC__ && defined __clang_major__ && __clang_major__ < 3
@%:@error premature clang
@%:@endif
SRC
AC_MSG_ERROR([clang version 3.0 or later is required])
fi
])
if test x"${build}" != x"${host}"; then
AC_CHECK_TOOL(CC, gcc)
fi
AC_PROG_CC
AC_PROG_CXX
RUBY_MINGW32
AC_PROG_GCC_TRADITIONAL
AC_SUBST(GCC)
AS_CASE(["$target_os"],
[solaris*], [AC_PATH_TOOL([LD], [ld], [/usr/ccs/bin/ld], [/usr/ccs/bin:$PATH])],
[AC_CHECK_TOOL([LD], [ld], [ld])])
AC_SUBST(LD)
if test "$GCC" = yes; then
linker_flag=-Wl,
: ${optflags=-O3}
gcc_major=`echo =__GNUC__ | $CC -E -xc - | sed '/^=/!d;s///'`
gcc_minor=`echo =__GNUC_MINOR__ | $CC -E -xc - | sed '/^=/!d;s///'`
test -n "$gcc_major" || gcc_major=0
test -n "$gcc_minor" || gcc_minor=0
# RUBY_APPEND_OPTIONS(XCFLAGS, ["-include ruby/config.h" "-include ruby/missing.h"])
else
linker_flag=
fi
RUBY_PROG_GNU_LD
RUBY_CPPOUTFILE
: ${OUTFLAG='-o '}
: ${COUTFLAG=${OUTFLAG}}
AC_SUBST(OUTFLAG)
AC_SUBST(COUTFLAG)
cc_version=
for option in --version -v -V -qversion; do
cc_version_message=`$CC $option 2>&1`
cc_version_status=$?
AS_CASE($cc_version_status, [0], [:], [continue])
AS_CASE($cc_version_message, [*Warning*], [continue])
cc_version='$(CC) '$option
done
AC_SUBST(CC_VERSION, $cc_version)
RUBY_UNIVERSAL_ARCH
if test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "$cross_compiling" = no -a "$universal_binary" = no; then
RUBY_DEFAULT_ARCH("$target_cpu")
fi
AS_CASE(["$target_cpu-$target_os"], [[i[3-6]86*]], [
AC_CACHE_CHECK([for __sync_val_compare_and_swap], [rb_cv_gcc_compiler_cas], [
AC_TRY_LINK([unsigned long atomic_var;],
[
__sync_val_compare_and_swap(&atomic_var, 0, 1);
],
[rb_cv_gcc_compiler_cas=yes],
[rb_cv_gcc_compiler_cas=no])])
if test "$rb_cv_gcc_compiler_cas" = no; then
unset rb_cv_gcc_compiler_cas
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -march=i486"
AC_CACHE_CHECK([for __sync_val_compare_and_swap with -march=i486], [rb_cv_gcc_compiler_cas], [
AC_TRY_LINK([unsigned long atomic_var;],
[
__sync_val_compare_and_swap(&atomic_var, 0, 1);
],
[rb_cv_gcc_compiler_cas=yes
ARCH_FLAG="-march=i486"],
[rb_cv_gcc_compiler_cas=no])])
CFLAGS="$save_CFLAGS"
fi])
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(AR, ar)
if test -z "$AR"; then
AC_CHECK_PROGS(AR, aal, ar)
fi
AC_CACHE_CHECK([for $AR D option], [rb_cv_ar_D_option], [
AS_IF([$AR rcD conftest.a > /dev/null 2>&1 && rm conftest.a],
[rb_cv_ar_D_option=yes], [rb_cv_ar_D_option=no])
])
AS_IF([test "$rb_cv_ar_D_option" = yes], [ARFLAGS='rcD '], [ARFLAGS='rcu '])
AC_SUBST(ARFLAGS)
AC_CHECK_TOOL(AS, as)
ASFLAGS=$ASFLAGS
AC_SUBST(ASFLAGS)
AS_CASE(["$target_os"],[cygwin*|mingw*], [ac_cv_prog_ac_ct_OBJCOPY=":"])
# BSD's ports and MacPorts prefix GNU binutils with 'g'
AC_CHECK_TOOLS(OBJDUMP, [objdump gobjdump])
AC_CHECK_TOOLS(OBJCOPY, [objcopy gobjcopy])
AS_CASE(["$target_os"],
[cygwin*|mingw*], [
AC_CHECK_TOOL(WINDRES, windres)
AC_CHECK_TOOL(DLLWRAP, dllwrap)
target=`echo $target | sed "s/^$target_cpu-/-/"`
target_alias=`echo $target_alias | sed "s/^$target_cpu-/-/"`
target_cpu=`echo $target_cpu | sed s/i.86/i386/`
AS_CASE(["$target"], [-*], [ target="$target_cpu${target}"])
AS_CASE(["$target_alias"], [-*], [ target_alias="$target_cpu${target_alias}"])
AS_CASE(["$target_os"],
[mingw*], [
test "$rb_cv_msvcrt" = "" && unset rb_cv_msvcrt
AC_CACHE_CHECK(for mingw32 runtime DLL, rb_cv_msvcrt, [
AC_TRY_LINK([@%:@include <stdio.h>],
[FILE* volatile f = stdin; return 0;],
[rb_cv_msvcrt=`$OBJDUMP -p conftest$ac_exeext |
tr A-Z a-z |
sed -n '/^[[ ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`],
[rb_cv_msvcrt=msvcrt])
test "$rb_cv_msvcrt" = "" && rb_cv_msvcrt=msvcrt])
RT_VER=`echo "$rb_cv_msvcrt" | tr -cd [0-9]`
test "$RT_VER" = "" && RT_VER=60
AC_DEFINE_UNQUOTED(RUBY_MSVCRT_VERSION, $RT_VER)
])
: ${enable_shared=yes}
],
[aix*], [AC_CHECK_TOOL(NM, nm, /usr/ccs/bin/nm, /usr/ccs/bin:$PATH)],
[hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)]) # by TOYODA Eizi <[email protected]>
AC_CHECK_TOOL(NM, nm)
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_MKDIR_P
if test "x$MKDIR_P" = "x -d"; then
if test x"$as_mkdir_p" != xfalse; then
MKDIR_P='mkdir -p'
echo "use 'mkdir -p' as MKDIR_P"
else
AC_MSG_ERROR([mkdir -p is required])
fi
fi
MAKEDIRS="$MKDIR_P"
AC_SUBST(MAKEDIRS)
AC_DEFUN([RUBY_DTRACE_AVAILABLE],
[AC_CACHE_CHECK(whether dtrace USDT is available, rb_cv_dtrace_available,
[
echo "provider conftest{ probe fire(); };" > conftest_provider.d
if $DTRACE -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null; then
AC_TRY_COMPILE([@%:@include "conftest_provider.h"], [CONFTEST_FIRE();], [
# DTrace is available on the system
rb_cv_dtrace_available=yes
], [rb_cv_dtrace_available=no])
else
# DTrace is not available while dtrace command exists
# for example FreeBSD 8 or FreeBSD 9 without DTrace build option
rb_cv_dtrace_available=no
fi
rm -f conftest.[co] conftest_provider.[dho]
])
])
AC_DEFUN([RUBY_DTRACE_POSTPROCESS],
[AC_CACHE_CHECK(whether $DTRACE needs post processing, rb_cv_prog_dtrace_g,
[
rb_cv_prog_dtrace_g=no
if {
cat >conftest_provider.d <<_PROBES &&
provider conftest {
probe fire();
};
_PROBES
$DTRACE -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null &&
:
}; then
AC_TRY_COMPILE([@%:@include "conftest_provider.h"], [CONFTEST_FIRE();], [
if {
cp -p conftest.${ac_objext} conftest.${ac_objext}.save &&
$DTRACE -G -s conftest_provider.d conftest.${ac_objext} 2>/dev/null &&
:
}; then
if cmp -s conftest.o conftest.${ac_objext}.save; then
rb_cv_prog_dtrace_g=yes
else
rb_cv_prog_dtrace_g=rebuild
fi
fi])
fi
rm -f conftest.[co] conftest_provider.[dho]
])
])
AC_CHECK_PROG([DTRACE], [${ac_tool_prefix}dtrace], [${ac_tool_prefix}dtrace])
if test "$cross_compiling:$ac_cv_prog_DTRACE" = no: -a -n "$ac_tool_prefix"; then
AC_CHECK_PROG([DTRACE], [dtrace], [dtrace])
fi
AC_CHECK_PROGS(DOT, dot)
AC_CHECK_PROGS(DOXYGEN, doxygen)
AS_CASE(["${host_os}"], [nacl], [AC_PATH_PROG(PYTHON, python)])
AC_CHECK_PROG(PKG_CONFIG, pkg-config, [pkg-config], [], [],
[`"$as_dir/$ac_word$ac_exec_ext" --print-errors --version > /dev/null 2>&1 || echo "$as_dir/$ac_word$ac_exec_ext"`])
# checks for UNIX variants that set C preprocessor variables
AC_USE_SYSTEM_EXTENSIONS
AC_SUBST(RM, ['rm -f'])
AC_SUBST(CP, ['cp'])
RMDIRS='$(top_srcdir)/tool/rmdirs'
RMDIR=rmdir
mkdir "rmdirs_$$_test" "rmdirs_$$_test/a"
rmdir --ignore-fail-on-non-empty "rmdirs_$$_test" 2>/dev/null &&
RMDIR='rmdir --ignore-fail-on-non-empty'
$RMDIR -p "rmdirs_$$_test/a" 2>/dev/null &&
{ test -d "rmdirs_$$_test" || RMDIRS="$RMDIR -p"; }
rmdir "rmdirs_$$_test/a" "rmdirs_$$_test" 2>/dev/null
AC_SUBST(RMDIR)
AC_SUBST(RMDIRS)
AC_SUBST(RMALL, ['rm -fr'])
AC_MSG_CHECKING([for cd using physical directory])
rm -fr conf$$.dir
mkdir conf$$.dir &&
(cd conf$$.dir && mkdir src build && cd src &&
$as_ln_s ../build . > /dev/null 2>&1 && cd build &&
for chdir in 'cd -P' 'PWD= cd'; do
/bin/sh -c "$chdir ../src && echo '$chdir' > cdcmd" 2> /dev/null && break
done)
if test -f conf$$.dir/src/cdcmd; then
read CHDIR < conf$$.dir/src/cdcmd 2> /dev/null
else
CHDIR=cd
fi
rm -fr conf$$.dir
AC_MSG_RESULT([$CHDIR])
AC_SUBST(CHDIR)
}
{ # compiler section
AC_DEFUN([RUBY_WERROR_FLAG], [dnl
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $rb_cv_warnflags"
if test "${ac_c_werror_flag+set}"; then
rb_c_werror_flag="$ac_c_werror_flag"
else
unset rb_c_werror_flag
fi
ac_c_werror_flag=yes
$1
CFLAGS="$save_CFLAGS"
save_CFLAGS=
if test "${rb_c_werror_flag+set}"; then
ac_c_werror_flag="$rb_c_werror_flag"
else
unset ac_c_werror_flag
fi])
RUBY_WERROR_FLAG([
AC_MSG_CHECKING([whether CFLAGS is valid])
AC_TRY_COMPILE([], [],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
AC_MSG_ERROR([something wrong with CFLAGS="$CFLAGS"])
]
)
AC_MSG_CHECKING([whether LDFLAGS is valid])
{
mkdir tmp.$$.try_link &&
cd tmp.$$.try_link &&
cp ../confdefs.h . &&
echo '<?xml?><plist><dict><key>CFBundleIdentifier</key><string></string></dict></plist>' > Info.plist &&
:
} || AC_MSG_ERROR([faild to make temporary directory])
AC_TRY_LINK([], [],
[AC_MSG_RESULT(yes)],
[
cd .. && rm -fr tmp.$$.try_link
AC_MSG_RESULT(no)
AC_MSG_ERROR([something wrong with LDFLAGS="$LDFLAGS"])
]
)
cd .. && rm -fr tmp.$$.try_link
])
AC_DEFUN([RUBY_TRY_CFLAGS], [
AC_MSG_CHECKING([whether ]$1[ is accepted as CFLAGS])
RUBY_WERROR_FLAG([
CFLAGS="[$]CFLAGS $1"
AC_TRY_COMPILE([$4], [$5],
[$2
AC_MSG_RESULT(yes)],
[$3
AC_MSG_RESULT(no)])
])
])
AC_DEFUN([RUBY_TRY_LDFLAGS], [
save_LDFLAGS="$LDFLAGS"
LDFLAGS="[$]LDFLAGS $1"
AC_MSG_CHECKING([whether $1 is accepted as LDFLAGS])
RUBY_WERROR_FLAG([
AC_TRY_LINK([$4], [$5],
[$2
AC_MSG_RESULT(yes)],
[$3
AC_MSG_RESULT(no)])
])
LDFLAGS="$save_LDFLAGS"
save_LDFLAGS=
])
AS_CASE([$RUBY_PATCHLEVEL], [-*],
[particular_werror_flags=yes], [particular_werror_flags=no])
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--disable-werror],
[don't make warnings into errors
even if a compiler support -Werror feature
[[disabled by default unless development version]]]),
[particular_werror_flags=$enableval])
rb_cv_warnflags="$warnflags"
if test "$GCC:${warnflags+set}:no" = yes::no; then
if test $gcc_major -ge 4; then
extra_warning=-Werror=extra-tokens
else
extra_warning=
fi
if test $gcc_major -eq 5; then
extra_warning="$extra_warning -Wno-maybe-uninitialized"
fi
for wflag in -Wno-unused-parameter -Wno-parentheses -Wno-long-long \
-diag-disable=2259 \
-Wno-missing-field-initializers \
-Wno-tautological-compare \
-Wno-parentheses-equality \
-Wno-constant-logical-operand \
-Wno-self-assign \
-Wunused-variable \
-Werror=pointer-arith \
-Werror=write-strings \
-Werror=declaration-after-statement \
-Werror=shorten-64-to-32 \
-Werror=implicit-function-declaration \
-Werror=division-by-zero \
-Werror=deprecated-declarations \
-Wno-packed-bitfield-compat \
$extra_warning \
; do
if test "$particular_werror_flags" != yes; then
wflag=`echo x$wflag | sed 's/^x-Werror=/-W/;s/^x//'`
fi
ok=no
RUBY_TRY_CFLAGS($wflag, [
RUBY_APPEND_OPTIONS(warnflags, $wflag)
ok=yes
])
AS_CASE([$ok:$wflag], [no:-Werror=*], [
wflag=`echo x$wflag | sed 's/^x-Werror=/-W/'`
RUBY_TRY_CFLAGS($wflag, [
RUBY_APPEND_OPTIONS(warnflags, $wflag)
particular_werror_flags=no
])
])
done
AS_CASE([" $warnflags "],[*" -Wno-missing-field-initializers "*], [wflag="-Wall -Wextra"],
[wflag=-Wall])
RUBY_TRY_CFLAGS($wflag, [warnflags="$wflag${warnflags+ $warnflags}"])
# Disable warnflags while conftest. -Werror=* flags might make bad OS capability guess.
rb_cv_warnflags="$warnflags"
warnflags=
fi
RUBY_TRY_CFLAGS(-Qunused-arguments, [RUBY_APPEND_OPTIONS(rb_cv_wsuppress_flags, -Qunused-arguments)])
for n in infinity nan; do
m=AS_TR_CPP($n)
AC_CACHE_CHECK([whether $m is available without C99 option], rb_cv_$n,
[AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY(AC_INCLUDES_DEFAULT([@%:@include <math.h>
@%:@ifndef $m
@%:@error no $m
@%:@endif
]), [1])], [eval rb_cv_$n=yes], [eval rb_cv_$n=no])])
if eval test '"$rb_cv_'$n'"' = yes; then
AC_DEFINE_UNQUOTED([HAVE_]$m)
fi
done
if test "$GCC" = yes; then
# NaCl's glibc build generates undefined references to __memset_chk.
# TODO(sbc): Remove this once NaCl's glibc is fixed.
AS_CASE(["$target_os"], [nacl], [], [
# -D_FORTIFY_SOURCE
# When defined _FORTIFY_SOURCE, glibc enables some additional sanity
# argument check. The performance drop is very little and Ubuntu enables
# _FORTIFY_SOURCE=2 by default. So, let's support it for protecting us from
# a mistake of silly C extensions.
RUBY_TRY_CFLAGS(-D_FORTIFY_SOURCE=2, [RUBY_APPEND_OPTION(XCFLAGS, -D_FORTIFY_SOURCE=2)])
])
# -fstack-protector
AS_CASE(["$target_os"],
[mingw*|nacl], [
stack_protector=no
])
if test -z "${stack_protector+set}"; then
RUBY_TRY_CFLAGS(-fstack-protector, [stack_protector=yes], [stack_protector=no])
if test "x$stack_protector" = xyes; then
RUBY_TRY_LDFLAGS(-fstack-protector, [], [stack_protector=broken])
fi
fi
if test "x$stack_protector" = xyes; then
RUBY_APPEND_OPTION(XCFLAGS, -fstack-protector)
RUBY_APPEND_OPTION(XLDFLAGS, -fstack-protector)
RUBY_APPEND_OPTION(LDFLAGS, -fstack-protector)
fi
AS_CASE(["$target_os"],[mingw*], [
# On Windows platforms, system provided headers are VC++
# optimized. That is, C++ habits are often contaminated into
# various headers. Most frequent situation is the use of //
# comments. We bypass ANSI C mode for them. Otherwise
# extension libs cannot include those headers.
],
[cygwin*|darwin*|netbsd*|nacl], [
# need lgamma_r(), finite()
],
[
# ANSI (no XCFLAGS because this is C only)
for ansi_options in -std=iso9899:1999 "-ansi -std=iso9899:199409"; do
RUBY_TRY_CFLAGS(${ansi_options}, [
RUBY_APPEND_OPTIONS(warnflags, ${ansi_options})
RUBY_APPEND_OPTIONS(strict_warnflags, ${ansi_options})
], [ansi_options=])
test "x${ansi_options}" = x || break
done
])
# suppress annoying -Wstrict-overflow warnings
RUBY_TRY_CFLAGS(-fno-strict-overflow, [RUBY_APPEND_OPTION(XCFLAGS, -fno-strict-overflow)])
test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb3, [debugflags=-ggdb3])}
test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb, [debugflags=-ggdb])}
test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-g3, [debugflags=-g3])}
fi
test $ac_cv_prog_cc_g = yes && : ${debugflags=-g}
if test "$GCC" = ""; then
AS_CASE(["$target_os"],[aix*],[warnflags="$warnflags -qinfo=por" rb_cv_warnflags="$rb_cv_warnflags -qinfo=por"])
fi
if test "$GCC" = yes; then
if test "$gcc_major" -ge 4; then
RUBY_TRY_CFLAGS(-fvisibility=hidden, [visibility_option=yes], [visibility_option=no])
fi
AC_SUBST(WERRORFLAG, "-Werror")
if test "$visibility_option" = yes; then
RUBY_APPEND_OPTION(XCFLAGS, -fvisibility=hidden)
AC_DEFINE(RUBY_SYMBOL_EXPORT_BEGIN, [_Pragma("GCC visibility push(default)")])
AC_DEFINE(RUBY_SYMBOL_EXPORT_END, [_Pragma("GCC visibility pop")])
else
RUBY_TRY_LDFLAGS([-Wl,-unexported_symbol,_Init_*], [visibility_option=ld], [visibility_option=no])
fi
test "$visibility_option" = no -o "$host_os" = nacl || OBJCOPY=:
fi
if test "$GCC" = yes; then
# optflags
AS_CASE(["$target_os"], [mingw*], [
RUBY_TRY_CFLAGS(-fno-omit-frame-pointer, [optflags="${optflags+$optflags }-fno-omit-frame-pointer"])
RUBY_TRY_CFLAGS(-static-libgcc, [static_libgcc=yes], [static_libgcc=no])
if test "$static_libgcc" = yes; then
RUBY_APPEND_OPTION(EXTLDFLAGS, -static-libgcc)
fi
])
# disable fast-math
for oflag in -fno-fast-math -fp-model\ precise; do
RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(optflags, $oflag)])
done
fi
AC_ARG_WITH(opt-dir,
AS_HELP_STRING([--with-opt-dir=DIR-LIST],
[add optional headers and libraries directories separated by $PATH_SEPARATOR]),
[
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //"`
CPPFLAGS="$CPPFLAGS $val"
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib|g;s/^ //"`
LDFLAGS="$LDFLAGS $val"
LDFLAGS_OPTDIR="$val"
OPT_DIR="$withval"
], [OPT_DIR=])
test -z "${ac_env_CFLAGS_set}" -a -n "${cflags+set}" && eval CFLAGS="\"$cflags $ARCH_FLAG\""
test -z "${ac_env_CXXFLAGS_set}" -a -n "${cxxflags+set}" && eval CXXFLAGS="\"$cxxflags $ARCH_FLAG\""
}
{ # header and library section
AC_ARG_WITH(winnt-ver,
AS_HELP_STRING([--with-winnt-ver=0xXXXX], [target Windows NT version (default to 0x0501)]),
[with_winnt_ver="$withval"], [with_winnt_ver="0x0501"])
AS_CASE(["$target_os"],
[mingw*], [
RUBY_APPEND_OPTION(CPPFLAGS, -D_WIN32_WINNT=$with_winnt_ver)
RUBY_APPEND_OPTION(CPPFLAGS, -D__MINGW_USE_VC2005_COMPAT)
])
AS_CASE(["$target_os"],
[freebsd*], [