-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
3334 lines (3104 loc) · 103 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.60)
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))])
{ # 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)])
],
[
BASERUBY="ruby"
])
if test "`RUBYOPT=- $BASERUBY -e 'p 42' 2>/dev/null`" = 42; then
if test "`RUBYOPT=- $BASERUBY --disable=gems -e 'p 42' 2>/dev/null`" = 42; then
BASERUBY="$BASERUBY --disable=gems"
fi
else
BASERUBY="echo executable host ruby is required. use --with-baseruby option.; false"
fi
AC_SUBST(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(["$build_cpu"],
[x86_64|i?86], [nacl_cv_cpu_nick=x86], [nacl_cv_cpu_nick=$build_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 -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}"
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_SUBST(NACL_TOOLCHAIN)
AC_SUBST(NACL_SDK_ROOT)
AC_SUBST(NACL_SDK_VARIANT, nacl_cv_build_variant)
])])
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]*\)/\1=\2/p' $srcdir/include/ruby/version.h`
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
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(TEENY)
RUBY_PROGRAM_VERSION=`sed -n 's/^#define RUBY_VERSION "\(.*\)"/\1/p' $srcdir/version.h`
AC_SUBST(RUBY_PROGRAM_VERSION)
RUBY_RELEASE_DATE=`sed -n 's/^#define RUBY_RELEASE_DATE "\(.*\)"/\1/p' $srcdir/version.h`
AC_SUBST(RUBY_RELEASE_DATE)
AC_DEFINE(CANONICALIZATION_FOR_MATHN)
dnl checks for alternative programs
AC_CANONICAL_BUILD
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"],
[darwin11.*], [
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++}],
[xclang|x/usr/bin/clang], [: ${CXX=clang++}])
])
test -z "$CC" || ac_cv_prog_CC="$CC"
if test "$program_prefix" = NONE; then
program_prefix=
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_CANONICAL_TARGET
target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
ac_install_sh='' # unusable for extension libraries.
AC_DEFUN([RUBY_APPEND_OPTION],
[# RUBY_APPEND_OPTION($1, $2)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="[$]$1 $2"])])
AC_DEFUN([RUBY_APPEND_OPTIONS],
[{ for rb_opt in $2; do # RUBY_APPEND_OPTIONS($1, $2)
AS_CASE([" [$]{$1-} "],
[*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ $1="[$]$1 [$]{rb_opt}"])
done; }])
AC_DEFUN([RUBY_PREPEND_OPTION],
[# RUBY_PREPEND_OPTION($1, $2)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="$2 [$]$1"])])
AC_DEFUN([RUBY_PREPEND_OPTIONS],
[{ unset rb_opts; for rb_opt in $2; do # RUBY_PREPEND_OPTIONS($1, $2)
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 " $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
RUBY_PREREQ_AC(2.63, [ to compile universal binary])
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 ${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, [gcc-4.2 clang gcc cc])
])
if test x"${build}" != x"${host}"; then
AC_CHECK_TOOL(CC, gcc)
fi
AC_CHECK_TOOL(DTRACE, dtrace)
AS_CASE(["$target_os"],
[freebsd*], [DTRACE=]
)
AC_PROG_CC
AC_PROG_CXX
RUBY_MINGW32
AC_PROG_GCC_TRADITIONAL
AC_SUBST(GCC)
AC_CHECK_TOOL([LD], [ld], [ld])
AC_SUBST(LD)
if test "$GCC" = yes; then
linker_flag=-Wl,
: ${optflags=-O3}
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)
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
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(AR, ar)
if test -z "$AR"; then
AC_CHECK_PROGS(AR, aal, ar)
fi
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 <toyoda@npd.kishou.go.jp>
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_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])
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=
])
rb_cv_warnflags="$warnflags"
if test "$GCC:${warnflags+set}:no" = yes::no; then
particular_werror_flags=yes
for wflag in -Wno-unused-parameter -Wno-parentheses -Wno-long-long \
-Wno-missing-field-initializers \
-Wunused-variable \
-Werror=pointer-arith \
-Werror=write-strings \
-Werror=declaration-after-statement \
-Werror=shorten-64-to-32 \
-Werror-implicit-function-declaration \
; do
if test "$particular_werror_flags" = yes; then
wflag=`echo x$wflag | sed 's/^x-Werror-/-Werror=/;s/^x//'`
else
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
if test "$GCC" = yes; then
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])}
# -D_FORTIFY_SOURCE
RUBY_TRY_CFLAGS(-D_FORTIFY_SOURCE=2, [RUBY_APPEND_OPTION(XCFLAGS, -D_FORTIFY_SOURCE=2)])
# -fstack-protector
AS_CASE(["$target_os"],
[mingw*|nacl|haiku], [
stack_protector=no
],
[
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
])
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*], [
# need lgamma_r(), finite()
],
[haiku], [
# Haiku R1/alpha3 uses gcc-4.4.4 which can not handle anonymous union
# with ANSI standard flags. Anonumous union is required to compile
# socket extension where <net/if.h> uses anonymous union.
],
[
# ANSI (no XCFLAGS because this is C only)
RUBY_TRY_CFLAGS(-ansi -std=iso9899:199409, [
RUBY_APPEND_OPTION(warnflags, -ansi -std=iso9899:199409)
RUBY_APPEND_OPTION(strict_warnflags, -ansi -std=iso9899:199409)
])
])
# suppress annoying -Wstrict-overflow warnings
RUBY_TRY_CFLAGS(-fno-strict-overflow, [RUBY_APPEND_OPTION(XCFLAGS, -fno-strict-overflow)])
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
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
@%:@if !(defined __GNUC__ && __GNUC__ >= 4)
@%:@error not GCC 4 or later
>>>not GCC 4 or later<<<
@%:@endif])],
[visibility_option=yes], [visibility_option=no])
if test "$visibility_option" = yes; 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)
else
RUBY_TRY_LDFLAGS([-Wl,-unexported_symbol,_Init_*], [visibility_option=ld], [visibility_option=no])
fi
test "$visibility_option" = no || 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"])
])
# disable fast-math
for oflag in -fno-fast-math; do
RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(optflags, $oflag)])
done
fi
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\""
dnl check for large file stuff
mv confdefs.h confdefs1.h
: > confdefs.h
AC_SYS_LARGEFILE
mv confdefs.h largefile.h
mv confdefs1.h confdefs.h
cat largefile.h >> confdefs.h
AS_CASE(["$target_os"],[mingw*], [ac_cv_type_off_t=yes;ac_cv_sizeof_off_t=8])
AC_C_BIGENDIAN
AC_C_CONST
AC_C_CHAR_UNSIGNED
AC_C_INLINE
AC_C_VOLATILE
AS_CASE(":$ac_cv_c_const:$ac_cv_c_volatile:",
[*:no:*], [AC_MSG_ERROR(ANSI C-conforming const and volatile are mandatory)])
AC_CHECK_TYPES([long long, off_t])
AC_CACHE_CHECK([char bit], [rb_cv_char_bit],
[test "$universal_binary" = yes && cross_compiling=yes
AC_COMPUTE_INT([rb_cv_char_bit], [CHAR_BIT],
[AC_INCLUDES_DEFAULT([@%:@include <limits.h>])], [rb_cv_char_bit=8])
test "$universal_binary" = yes && cross_compiling=$real_cross_compiling])
dnl RUBY_CHECK_SIZEOF [typename], [maybe same size types], [macros], [include]
AC_DEFUN([RUBY_CHECK_SIZEOF],
[m4_bmatch([$1], [\.], [], [if test "$universal_binary" = yes; then])
AC_CACHE_CHECK([size of $1], [AS_TR_SH([ac_cv_sizeof_$1])], [
unset AS_TR_SH(ac_cv_sizeof_$1)
rbcv_var="
typedef m4_bpatsubst([$1], [\..*]) ac__type_sizeof_;
static ac__type_sizeof_ *rbcv_ptr;
@%:@define AS_TR_CPP(SIZEOF_$1) sizeof((*rbcv_ptr)[]m4_bmatch([$1], [\.], .m4_bpatsubst([$1], [^[^.]*\.])))
"
m4_ifval([$2], [test -z "${AS_TR_SH(ac_cv_sizeof_$1)+set}" && {
for t in $2; do
AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY(AC_INCLUDES_DEFAULT([$4]
[$rbcv_var]),
[AS_TR_CPP(SIZEOF_$1) == sizeof($t)])], [
AS_TR_SH(ac_cv_sizeof_$1)=AS_TR_CPP([SIZEOF_]$t)
break])
done
}])
unset cond
m4_ifval([$3], [test -z "${AS_TR_SH(ac_cv_sizeof_$1)+set}" && {
for s in 32 64 128; do
for t in $3; do
cond="${cond}
@%:@${cond+el}if defined(__${t}${s}__) || defined(__${t}${s}) || defined(_${t}${s}) || defined(${t}${s})"
hdr="AC_INCLUDES_DEFAULT([$4
@%:@if defined(__${t}${s}__) || defined(__${t}${s}) || defined(_${t}${s}) || defined(${t}${s})
@%:@ define AS_TR_CPP(HAVE_$1) 1
@%:@else
@%:@ define AS_TR_CPP(HAVE_$1) 0
@%:@endif])"
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$hdr], [!AS_TR_CPP(HAVE_$1)])], [continue])
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$hdr]
[$rbcv_var],
[AS_TR_CPP(HAVE_$1) == (AS_TR_CPP(SIZEOF_$1) == ([$[s / rb_cv_char_bit]]))])],
[AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}${s}"])
done
done
}])
m4_ifval([$2][$3],
[test "${AS_TR_SH(ac_cv_sizeof_$1)@%:@SIZEOF_}" = "${AS_TR_SH(ac_cv_sizeof_$1)}" && ]){
test "$universal_binary" = yes && cross_compiling=yes
AC_COMPUTE_INT([t], AS_TR_CPP(SIZEOF_$1), [AC_INCLUDES_DEFAULT([$4])]
[${cond+$cond
@%:@else}
$rbcv_var
${cond+@%:@endif}
@%:@ifndef AS_TR_CPP(SIZEOF_$1)
@%:@define AS_TR_CPP(SIZEOF_$1) 0
@%:@endif], [t=0])
test "$universal_binary" = yes && cross_compiling=$real_cross_compiling
if test ${t-0} != 0; then
AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}"
fi
}
: ${AS_TR_SH(ac_cv_sizeof_$1)=0}
])
{
unset cond
for t in ${AS_TR_SH(ac_cv_sizeof_$1)-}; do
AS_CASE(["$t"],
[[[0-9]*|SIZEOF_*]], [
${cond+echo "@%:@else"}
echo "[@%:@define ]AS_TR_CPP(SIZEOF_$1) [$t]"
break
],
[
s=`expr $t : ['.*[^0-9]\([0-9][0-9]*\)$']`
echo "@%:@${cond+el}if defined(__${t}__) || defined(__${t}) || defined(_${t}) || defined($t)"
echo "@%:@define AS_TR_CPP(SIZEOF_$1) [$[s / rb_cv_char_bit]]"
cond=1
])
done
${cond+echo "@%:@endif"}
} >> confdefs.h
m4_bmatch([$1], [\.], [], [else
AC_CHECK_SIZEOF([$1], 0, [$4])
fi])
])
RUBY_CHECK_SIZEOF(int, [], [ILP])
RUBY_CHECK_SIZEOF(short)
RUBY_CHECK_SIZEOF(long, [int], [ILP LP])
RUBY_CHECK_SIZEOF(long long)
RUBY_CHECK_SIZEOF(__int64)
RUBY_CHECK_SIZEOF(off_t)
RUBY_CHECK_SIZEOF(void*, [int long "long long"], [ILP LP LLP])
RUBY_CHECK_SIZEOF(float)
RUBY_CHECK_SIZEOF(double)
RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>])
AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[
[rb_cv_pri_prefix_]AS_TR_SH($1)=[NONE]
RUBY_WERROR_FLAG(for pri in $2; do
AC_TRY_COMPILE(
[@%:@include <stdio.h>
@%:@include <stddef.h>
@%:@ifdef __GNUC__
@%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
decl __attribute__((format(printf, string_index, first_to_check)))
@%:@else
@%:@define PRINTF_ARGS(decl, string_index, first_to_check) decl
@%:@endif
PRINTF_ARGS(void test_sprintf(const char*, ...), 1, 2);],
[printf("%]${pri}[d", (]$1[)42);
test_sprintf("%]${pri}[d", (]$1[)42);],
[rb_cv_pri_prefix_]AS_TR_SH($1)[=[$pri]; break])
done)])
if test "[$rb_cv_pri_prefix_]AS_TR_SH($1)" != NONE; then
AC_DEFINE_UNQUOTED([PRI_]m4_ifval($3,$3,AS_TR_CPP(m4_bpatsubst([$1],[_t$])))[_PREFIX],
"[$rb_cv_pri_prefix_]AS_TR_SH($1)")
fi
])
if test "x$ac_cv_type_long_long" = xyes; then
RUBY_CHECK_PRINTF_PREFIX(long long, ll I64, LL)
elif test "x$ac_cv_type___int64" = xyes; then
RUBY_CHECK_PRINTF_PREFIX(__int64, ll I64, LL)
fi
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
AC_CHECK_TYPE([$1],
[n="patsubst([$1],["],[\\"])"],
[n="patsubst([$2],["],[\\"])"],
[$4])
AC_CACHE_CHECK([for convertible type of [$1]], rb_cv_[$1]_convertible, [
u= t=
AS_CASE(["$n "],
[*" signed "*], [ ],
[*" unsigned "*], [
u=U],
[
AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])], [($n)-1 > 0])],
[u=U])])
if test x"$t" = x; then
for t in "long long" long int short; do
test -n "$u" && t="unsigned $t"
AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])]
[typedef $n rbcv_conftest_target_type;
typedef $t rbcv_conftest_replace_type;
extern rbcv_conftest_target_type rbcv_conftest_var;
extern rbcv_conftest_replace_type rbcv_conftest_var;
extern rbcv_conftest_target_type rbcv_conftest_func(void);
extern rbcv_conftest_replace_type rbcv_conftest_func(void);
], [sizeof(rbcv_conftest_target_type) == sizeof(rbcv_conftest_replace_type)])],
[n="$t"; break])
done
fi
AS_CASE([" $n "],
[*" long long "*], [
t=LL],
[*" long "*], [
t=LONG],
[
t=INT])
rb_cv_[$1]_convertible=${u}${t}])
test "${AS_TR_SH(ac_cv_type_[$1])}" = "yes" && n="$1"
AC_DEFINE_UNQUOTED(rb_[$1], $n)
AC_DEFINE_UNQUOTED([$3]2NUM[(v)], [${rb_cv_[$1]_convertible}2NUM(v)])
AC_DEFINE_UNQUOTED(NUM2[$3][(v)], [NUM2${rb_cv_[$1]_convertible}(v)])
AC_DEFINE_UNQUOTED(PRI_[$3]_PREFIX,
[PRI_`echo ${rb_cv_[$1]_convertible} | sed ['s/^U//']`_PREFIX])
])
RUBY_REPLACE_TYPE(pid_t, int, PIDT)
RUBY_REPLACE_TYPE(uid_t, int, UIDT)
RUBY_REPLACE_TYPE(gid_t, int, GIDT)
RUBY_REPLACE_TYPE(time_t, [], TIMET, [@%:@include <time.h>])
RUBY_REPLACE_TYPE(dev_t, [int long "long long"], DEVT)
RUBY_REPLACE_TYPE(mode_t, ["unsigned int" long], MODET, [@%:@include <sys/stat.h>])
RUBY_REPLACE_TYPE(rlim_t, [int long "long long"], RLIM, [@%:@include <sys/resource.h>])
AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
[AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
rb_cv_have_prototypes=yes,
rb_cv_have_prototypes=no)])
if test "$rb_cv_have_prototypes" = yes; then
AC_DEFINE(HAVE_PROTOTYPES)
fi
AC_CACHE_CHECK(token paste string, rb_cv_tokenpaste,
[AC_TRY_COMPILE([@%:@define paste(a,b) a@%:@@%:@b],
[int xy = 1; return paste(x,y);],
rb_cv_tokenpaste=ansi,
rb_cv_tokenpaste=knr)])
if test "$rb_cv_tokenpaste" = ansi; then
AC_DEFINE(TOKEN_PASTE(x,y),[x@%:@@%:@y])
else
AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
fi
AC_CACHE_CHECK(stringization, rb_cv_stringization, [
rb_cv_stringization=no
for string in "#expr" '"expr"'; do
AC_COMPILE_IFELSE([
AC_LANG_BOOL_COMPILE_TRY([
#define STRINGIZE0(expr) $string
#define STRINGIZE(expr) STRINGIZE0(expr)
#undef real_test_for_stringization
#define test_for_stringization -.real_test_for_stringization.-
const char stringized[[]] = STRINGIZE(test_for_stringization);
], [sizeof(stringized) == 32])],
[rb_cv_stringization="$string"; break],
[rb_cv_stringization=no])
done]
)
AC_DEFINE(STRINGIZE(expr),STRINGIZE0(expr))
if test x"$rb_cv_stringization" != xno -a "$rb_cv_stringization" != "#expr"; then
AC_DEFINE_UNQUOTED(STRINGIZE0(expr),$rb_cv_stringization)
AC_DEFINE(OLD_FASHIONED_STRINGIZATION,1)
fi
AC_CACHE_CHECK([string literal concatenation],
rb_cv_string_literal_concatenation, [
AC_COMPILE_IFELSE([
AC_LANG_BOOL_COMPILE_TRY([
const char concatenated_literal[[]] = "literals" "to"
"be" "concatenated.";
], [sizeof(concatenated_literal) == 26])],
[rb_cv_string_literal_concatenation=yes],
[rb_cv_string_literal_concatenation=no])]
)
if test "$rb_cv_string_literal_concatenation" = no; then
AC_DEFINE(NO_STRING_LITERAL_CONCATENATION,1)
fi
AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg,
[AC_TRY_COMPILE([
#include <stdarg.h>
int foo(int x, ...) {
va_list va;
va_start(va, x);
va_arg(va, int);
va_arg(va, char *);
va_arg(va, double);
return 0;
}
], [return foo(10, "", 3.14);],
rb_cv_stdarg=yes,
rb_cv_stdarg=no)])
if test "$rb_cv_stdarg" = yes; then
AC_DEFINE(HAVE_STDARG_PROTOTYPES)
fi
AC_CACHE_CHECK(for variable length macro, rb_cv_va_args_macro,
[AC_TRY_COMPILE([
int foo(int x, ...);
@%:@define FOO(a, ...) foo(a, @%:@@%:@__VA_ARGS__)
], [FOO(1);FOO(1,2);FOO(1,2,3);],
rb_cv_va_args_macro=yes,
rb_cv_va_args_macro=no)])
if test "$rb_cv_va_args_macro" = yes; then
AC_DEFINE(HAVE_VA_ARGS_MACRO)
fi
AC_DEFUN([RUBY_DEFINE_IF], [dnl
m4_ifval([$1], [AS_LITERAL_IF([$1], [], [test "X$1" = X || ])cat <<EOH >> confdefs.h
@%:@if $1
EOH
])dnl
AC_DEFINE_UNQUOTED($2, $3)dnl
m4_ifval([$1], [AS_LITERAL_IF([$1], [], [test "X$1" = X || ])cat <<EOH >> confdefs.h
@%:@endif /* $1 */
EOH
])dnl
])dnl
dnl RUBY_FUNC_ATTRIBUTE(attrib, macroname, cachevar, condition)
AC_DEFUN([RUBY_FUNC_ATTRIBUTE], [dnl
m4_ifval([$2], dnl
[AS_VAR_PUSHDEF([attrib],[$2])], dnl
[AS_VAR_PUSHDEF([attrib],[FUNC_]AS_TR_CPP($1))] dnl
)dnl
m4_ifval([$3], dnl
[AS_VAR_PUSHDEF([rbcv],[$3])], dnl
[AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
)dnl
m4_ifval([$4], [rbcv_cond=["$4"]; test "$rbcv_cond" || unset rbcv_cond])
AC_CACHE_CHECK(for [$1] function attribute, rbcv,
[rbcv=x
RUBY_WERROR_FLAG([
for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do
m4_ifval([$4],mac="$mac"${rbcv_cond+" /* only if $rbcv_cond */"})