dnl Process
this file with autoconf to produce a configure script. AC_INIT() { AC_CONFIG_AUX_DIR(tool)
AC_PREREQ(2.67)
AC_DISABLE_OPTION_CHECKING
AC_ARG_VAR(, [additional CFLAGS]) AC_ARG_VAR(, [additional CPPFLAGS]) AC_ARG_VAR(, [additional CXXFLAGS])
AC_DEFUN(, [ m4_version_prereq(, [-1], [ # suppress error messages, rm: cannot remove 'conftest.dSYM', from # AC_EGREP_CPP with CFLAGS=-g on Darwin. AS_CASE(, [darwin*], [ rm() {
rm_recursive='' for arg do AS_CASE("$arg", [--*], [], [-*r*], [break], [conftest.*], [AS_IF([test -d "$arg"], [rm_recursive=-r; break])], []) done command rm $rm_recursive "[$]@"
} ])])])
{ # environment section
HAVE_BASERUBY=yes 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], [no],[HAVE_BASERUBY=no], [AC_MSG_ERROR(need ruby)]) ], [ AC_PATH_PROG([BASERUBY], [ruby], [false]) ])
AS_IF([test “$HAVE_BASERUBY” = yes -a “`RUBYOPT=- $BASERUBY -e 'print 42' 2>/dev/null`” = 42], [
AS_IF([test "`RUBYOPT=- $BASERUBY --disable=gems -e 'print 42' 2>/dev/null`" = 42], [ BASERUBY="$BASERUBY --disable=gems" ]) $BASERUBY -C "$srcdir" tool/downloader.rb -d tool -e gnu config.guess config.sub
], [
BASERUBY="echo executable host ruby is required. use --with-baseruby option.; false" HAVE_BASERUBY=no
]) AC_SUBST(BASERUBY) AC_SUBST(HAVE_BASERUBY)
: ${GIT=git} HAVE_GIT=yes AC_ARG_WITH(git,
AS_HELP_STRING([--without-git], [never use git]), [AS_CASE([$withval], [no], [GIT=never-use HAVE_GIT=no], [yes], [], [GIT=$withval])])
AS_IF([test x“$HAVE_GIT” = xyes], [command -v “$GIT” > /dev/null || HAVE_GIT=no]) AC_SUBST(GIT) AC_SUBST(HAVE_GIT)
AC_DEFUN(, [AS_CASE(, [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*]) AS_IF([test “$rb_cv_mingw32” = yes], [
target_os="mingw32" : ${ac_tool_prefix:="`expr "$CC" : ['\(.*-\)g\?cc[^/]*$']`"}
]) ]) AS_CASE(, [mingw*msvc], [ target_os=“`echo ${target_os} | sed 's/msvc$//'`” ]) AS_CASE(, [x86_64-mingw*], [ target_cpu=x64 ]) ])
AC_DEFUN(, [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(,
[grep test-for-cppout conftest-1.i > /dev/null && rb_cv_cppoutfile=yes])
CPPFLAGS=“$save_CPPFLAGS” rm -f conftest*]) AS_IF([test “$rb_cv_cppoutfile” = yes], [
CPPOUTFILE='-o conftest.i'
], [test “$rb_cv_cppoutfile” = no], [
CPPOUTFILE='> conftest.i'
], [test -n “$rb_cv_cppoutfile”], [
CPPOUTFILE="$rb_cv_cppoutfile"
]) AC_SUBST(CPPOUTFILE)])
AC_DEFUN(, [AC_CACHE_CHECK(whether the linker is GNU ld, rb_cv_prog_gnu_ld, [AS_IF([`$CC $CFLAGS $CPPFLAGS $LDFLAGS –print-prog-name=ld 2>&1` -v 2>&1 | grep “GNU ld” > /dev/null], [
rb_cv_prog_gnu_ld=yes
], [
rb_cv_prog_gnu_ld=no
])]) GNU_LD=$rb_cv_prog_gnu_ld AC_SUBST(GNU_LD)])
eval `sed -n ['s/^@%:@define RUBY_API_VERSION_([A-Z_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
AS_IF([eval "test \"\$$v\" = ''"], [ AC_MSG_ERROR(could not determine $v number from version.h) ])
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) AC_SUBST(RUBY_API_VERSION, '$(MAJOR).$(MINOR)') 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 AS_IF([test ! -z “$ac_cv_prog_CC” -a ! -z “$CC” -a “$CC” != “$ac_cv_prog_CC”], [
AC_MSG_ERROR(cached CC is different -- throw away $cache_file
(it is also a good idea to do 'make clean' before compiling)) ]) test -z “$CC” || ac_cv_prog_CC=“$CC”
AS_IF([test “$program_prefix” = NONE], [
program_prefix=
]) AS_IF([test “$prefix” -ef .], [
AC_MSG_ERROR(--prefix cannot be the current working directory.)
]) 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"` ])
[# RUBY_APPEND_OPTION($1) AS_CASE([" [$]{$1-} "], [*" $2 "*], [], [' '], [ $1="$2"], [ $1="[$]$1 $2"])])
[# RUBY_APPEND_OPTIONS($1) for rb_opt in $2; do AS_CASE([" [$]{$1-} "], [*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ $1="[$]$1 [$]{rb_opt}"]) done])
[# RUBY_PREPEND_OPTION($1) AS_CASE([" [$]{$1-} "], [*" $2 "*], [], [' '], [ $1="$2"], [ $1="$2 [$]$1"])])
[# 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(, [ AC_MSG_CHECKING([arch option]) AS_CASE(,
[*64], [ARCH_FLAG=-m64], [[i[3-6]86]], [ARCH_FLAG=-m32], [AC_MSG_ERROR(unknown target architecture: $target_archs)] )
AC_MSG_RESULT() ])
AC_DEFUN(, [ # RUBY_UNIVERSAL_ARCH begin ARCH_FLAG=`expr “ $CXXFLAGS ” : ['.* (-m[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]*) ']` 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 AS_IF([test ${target_archs+set}], [
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-/-/"` AS_IF([test "${universal_binary-no}" = yes], [ AC_SUBST(try_header,try_compile) target_cpu=universal real_cross_compiling=$cross_compiling ], [ AS_IF([test x"$target_cpu" != x"${target_archs}"], [ echo 'int main(){return 0;}' > conftest.c AS_IF([$CC $CFLAGS $ARCH_FLAG -o conftest conftest.c > /dev/null 2>&1], [ rm -fr conftest.* ], [ RUBY_DEFAULT_ARCH("$target_archs") ]) ]) target_cpu=${target_archs} ]) AS_CASE(["$target"], [-*], [ target="$target_cpu${target}"]) AS_CASE(["$target_alias"], [-*], [ target_alias="$target_cpu${target_alias}"])
], [
AS_IF([test x"$target_alias" = x], [ 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]) ]) ]) target_archs="$target_cpu"
]) AS_IF([test “${target_archs}” != “${rb_cv_target_archs-${target_archs}}”], [
AC_MSG_ERROR([target arch(s) has changed from ${rb_cv_target_archs-nothing} to ${target_archs}])
], [
rb_cv_target_archs=${target_archs}
]) AS_IF([test “x${ARCH_FLAG}” != x], [
CFLAGS="${CFLAGS:+$CFLAGS }${ARCH_FLAG}" LDFLAGS="${LDFLAGS:+$LDFLAGS }${ARCH_FLAG}"
]) # 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'
AS_IF([test -z “${CFLAGS+set}”], [
cflags=`echo " $cflags " | sed "$cflagspat;s/^ *//;s/ *$//"` orig_cflags="$cflags" cflags="$cflags "'${optflags} ${debugflags} ${warnflags}'
]) AS_IF([test -z “${CXXFLAGS+set}”], [
cxxflags=`echo " $cxxflags " | sed "$cflagspat;s/^ *//;s/ *$//"` orig_cxxflags="$cxxflags" cxxflags="$cxxflags "'${optflags} ${debugflags} ${warnflags}'
])
AS_CASE(, [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) AS_IF([! $CC -E -xc - <<SRC >/dev/null], [ @%:@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]) ])
]) AS_IF([test x“${build}” != x“${host}”], [
AC_CHECK_TOOL(CC, gcc)
])
AC_PROG_CC
dnl Select the appropriate C++ compiler in OS X AS_CASE(,
[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 “$CXX” || ac_cv_prog_CXX=“$CXX”
AC_PROG_CXX RUBY_MINGW32 AC_PROG_GCC_TRADITIONAL AC_SUBST(GCC) AS_CASE(, [solaris*], [AC_PATH_TOOL(, [ld], [/usr/ccs/bin/ld], [/usr/ccs/bin:$PATH])], [AC_CHECK_TOOL(, [ld], [ld])]) AC_SUBST(LD) AS_IF([test “$GCC” = yes], [
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 AS_CASE(["x$CC"], [xicc], [ icc_version=`echo =__ICC | $CC -E -xc - | sed '/^=/!d;s///'` ]) test -n "$icc_version" || icc_version=0 # RUBY_APPEND_OPTIONS(XCFLAGS, ["-include ruby/config.h" "-include ruby/missing.h"])
], [
linker_flag=
])
RUBY_PROG_GNU_LD RUBY_CPPOUTFILE
: ${OUTFLAG='-o '} : ${COUTFLAG=${OUTFLAG}} : ${CSRCFLAG=''} AC_SUBST(OUTFLAG) AC_SUBST(COUTFLAG) AC_SUBST(CSRCFLAG)
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 break
done AC_SUBST(CC_VERSION, $cc_version) AC_SUBST(CC_VERSION_MESSAGE, $cc_version_message)
RUBY_UNIVERSAL_ARCH AS_IF([test “$target_cpu” != “$host_cpu” -a “$GCC” = yes -a “$cross_compiling” = no -a “$universal_binary” = no], [
RUBY_DEFAULT_ARCH("$target_cpu")
])
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])]) AS_IF([test "$rb_cv_gcc_compiler_cas" = no], [ 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" ])])
AS_CASE(, [darwin*], [ if libtool 2>&1 | grep no_warning_for_no_symbols > /dev/null; then
ac_cv_prog_ac_ct_RANLIB=: ac_cv_prog_ac_ct_AR='libtool -static' rb_cv_arflags='-no_warning_for_no_symbols -o'
fi ]) AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(AR, ar) AS_IF([test -z “$AR”], [
AC_CHECK_PROGS(AR, aal, ar)
]) AC_CACHE_CHECK([for $AR flags], [rb_cv_arflags], [
AS_IF([$AR rcD conftest.a > /dev/null 2>&1 && rm conftest.a], [rb_cv_arflags=rcD], [rb_cv_arflags=rcu])
]) AC_SUBST(ARFLAGS, [“$rb_cv_arflags ”])
AC_CHECK_TOOL(AS, as) ASFLAGS=$ASFLAGS AC_SUBST(ASFLAGS)
AS_CASE(,[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(, [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) sysconfdir= ]) : ${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 AS_IF([test “x$MKDIR_P” = “x -d”], [
AS_IF([test x"$as_mkdir_p" != xfalse], [ MKDIR_P='mkdir -p' echo "use 'mkdir -p' as MKDIR_P" ], [ AC_MSG_ERROR([mkdir -p is required]) ])
]) MAKEDIRS=“$MKDIR_P” AC_SUBST(MAKEDIRS)
AC_DEFUN(, [AC_CACHE_CHECK(whether dtrace USDT is available, rb_cv_dtrace_available, [
echo "provider conftest{ probe fire(); };" > conftest_provider.d rb_cv_dtrace_available=no AS_FOR(opt, rb_dtrace_opt, ["-xnolibs" ""], [dnl AS_IF([$DTRACE opt -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null], [], [continue]) AC_TRY_COMPILE([@%:@include "conftest_provider.h"], [CONFTEST_FIRE();], [], [continue]) # DTrace is available on the system rb_cv_dtrace_available=yes${rb_dtrace_opt:+"(opt)"} break ]) rm -f conftest.[co] conftest_provider.[dho]
]) AS_CASE(, [“yes(”*“)”],
[DTRACE_OPT=`expr "$rb_cv_dtrace_available" : "yes(\(.*\))"`])
])
AC_DEFUN(, [AC_CACHE_CHECK(whether $DTRACE needs post processing, rb_cv_prog_dtrace_g, [
rb_cv_prog_dtrace_g=no AS_IF([{ cat >conftest_provider.d <<_PROBES && provider conftest { probe fire(); };
_PROBES
$DTRACE ${DTRACE_OPT} -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null && : }], [ AC_TRY_COMPILE([@%:@include "conftest_provider.h"], [CONFTEST_FIRE();], [ AS_IF([{ cp -p conftest.${ac_objext} conftest.${ac_objext}.save && $DTRACE ${DTRACE_OPT} -G -s conftest_provider.d conftest.${ac_objext} 2>/dev/null && : }], [ AS_IF([cmp -s conftest.o conftest.${ac_objext}.save], [ rb_cv_prog_dtrace_g=yes ], [ rb_cv_prog_dtrace_g=rebuild ]) ])]) ]) rm -f conftest.[co] conftest_provider.[dho]
]) ])
AC_CHECK_PROG(, [${ac_tool_prefix}dtrace], [${ac_tool_prefix}dtrace]) AS_IF([test “$cross_compiling:$ac_cv_prog_DTRACE” = no: -a -n “$ac_tool_prefix”], [
AC_CHECK_PROG([DTRACE], [dtrace], [dtrace])
])
AC_CHECK_PROGS(DOT, dot) AC_CHECK_PROGS(DOXYGEN, doxygen)
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) AS_IF([test -f conf$$.dir/src/cdcmd], [
read CHDIR < conf$$.dir/src/cdcmd 2> /dev/null
], [
CHDIR=cd
]) rm -fr conf$$.dir AC_MSG_RESULT() AC_SUBST(CHDIR)
} { # compiler section
AC_DEFUN(, [dnl save_CFLAGS=“$CFLAGS” CFLAGS=“$CFLAGS $rb_cv_warnflags” AS_IF([test “${ac_c_werror_flag+set}”], [
rb_c_werror_flag="$ac_c_werror_flag"
], [
unset rb_c_werror_flag
]) ac_c_werror_flag=yes $1 CFLAGS=“$save_CFLAGS” save_CFLAGS= AS_IF([test “${rb_c_werror_flag+set}”], [
ac_c_werror_flag="$rb_c_werror_flag"
], [
unset ac_c_werror_flag
])])
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([failed 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(, [
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(, [
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=
])
: ${DLDFLAGS=“$LDFLAGS”} : ${RPATHFLAG=''} rpathflag='' AS_IF([test x“${RPATHFLAG}” = x], [
AS_CASE(["$target_os"], [hpux*], [AS_IF([test "$rb_cv_prog_gnu_ld" = no], [rpathflag='+b '])], [aix*], [rpathflag='-blibpath:'], [for rpathflag in -R "-rpath "; do AS_CASE("$rpathflag", [*" "], [AS_CASE(["${linker_flag}"], [*,], [rpathflag=`echo "$rpathflag" | tr ' ' ,`])]) rpathflag="${linker_flag}${rpathflag}" RUBY_TRY_LDFLAGS([${rpathflag}.], [], [rpathflag=]) AS_IF([test "x${rpathflag}" != x], []) done])
], [
rpathflag=`echo "$RPATHFLAG" | sed 's/%.*//'`
])
AS_CASE(, [-*],
[RUBY_DEVEL=yes], [RUBY_DEVEL=no])
particular_werror_flags=$RUBY_DEVEL 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” AS_IF([test “$GCC:${warnflags+set}:no” = yes::no], [
AS_IF([test $gcc_major -ge 4], [ extra_warning=-Werror=extra-tokens ], [ extra_warning= ]) AS_IF([test $gcc_major -ge 5 -a $gcc_major -le 6], [ extra_warning="$extra_warning -Wno-maybe-uninitialized" ]) # ICC doesn't support -Werror= AS_IF([test $icc_version -gt 0], [ particular_werror_flags=no ]) for wflag in -Wno-unused-parameter -Wno-parentheses -Wno-long-long \ -diag-disable=175,188,2259 \ -Wno-missing-field-initializers \ -Wno-tautological-compare \ -Wno-parentheses-equality \ -Wno-constant-logical-operand \ -Wno-self-assign \ -Wunused-variable \ -Werror=implicit-int \ -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 \ -Werror=misleading-indentation \ -Wno-packed-bitfield-compat \ -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=format \ -Wimplicit-fallthrough=0 \ -Werror=duplicated-cond \ -Werror=restrict \ $extra_warning \ ; do AS_IF([test "$particular_werror_flags" != yes], [ wflag=`echo x$wflag | sed 's/^x-Werror=/-W/;s/^x//'` ]) 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=
]) 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])])
AS_IF([eval test '"$rb_cv_'$n'"' = yes], [ AC_DEFINE_UNQUOTED([HAVE_]$m) ])
done
AC_ARG_WITH(compress-debug-sections,
AS_HELP_STRING([--with-compress-debug-sections=type], [enable debug section compression]), [compress_debug_sections=$withval], [compress_debug_sections=])
AS_IF([test “$GCC” = yes], [
# -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*], [ stack_protector=no ]) AS_IF([test -z "${stack_protector+set}"], [ RUBY_TRY_CFLAGS(-fstack-protector, [stack_protector=yes], [stack_protector=no]) AS_IF([test "x$stack_protector" = xyes], [ RUBY_TRY_LDFLAGS(-fstack-protector, [], [stack_protector=broken]) ]) ]) AS_IF([test "x$stack_protector" = xyes], [ RUBY_APPEND_OPTION(XCFLAGS, -fstack-protector) RUBY_APPEND_OPTION(XLDFLAGS, -fstack-protector) RUBY_APPEND_OPTION(LDFLAGS, -fstack-protector) ]) AS_CASE("${compress_debug_sections:-zlib}", [none|no], [], [ RUBY_TRY_LDFLAGS(${linker_flag}--compress-debug-sections=${compress_debug_sections:-zlib}, [compress_debug_sections=${compress_debug_sections:-zlib}], [compress_debug_sections=no]) ]) AS_IF([test "x$compress_debug_sections" != xno], [ RUBY_APPEND_OPTION(DLDFLAGS, ${linker_flag}--compress-debug-sections=$compress_debug_sections) ]) 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. # Since math.h in some mingw64 wrongly delcares frexp and modf # to be pure, the variables pointed by the second arguments are # considered uninitialized unexpectedly. AC_CACHE_CHECK([whether frexp and modf are broken], rb_cv_mingw64_broken_frexp_modf, [ save_CFLAGS="$CFLAGS" AS_IF([test "$particular_werror_flags" = "yes"], [ CFLAGS="$CFLAGS -Werror=uninitialized" ], [ CFLAGS="$CFLAGS -Werror -Wuninitialized" ]) AC_TRY_COMPILE([@%:@include <math.h> int foo(double x) { int exp; frexp(x, &exp); return exp; }], [if (foo(0.0)) return 1;], [rb_cv_mingw64_broken_frexp_modf=no], [rb_cv_mingw64_broken_frexp_modf=yes]) CFLAGS="$save_CFLAGS" ]) AS_IF([test "$rb_cv_mingw64_broken_frexp_modf" = yes], [ AC_DEFINE(RUBY_MINGW64_BROKEN_FREXP_MODF) ]) ], [cygwin*|darwin*|netbsd*], [ # need lgamma_r(), finite() ], [ # ANSI (no XCFLAGS because this is C only) for ansi_options in -std=gnu99; 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])}
]) test $ac_cv_prog_cc_g = yes && : ${debugflags=-g} AS_IF([test “x$RUBY_DEVEL” = xyes], [RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_DEVEL=1)])
AS_IF([test “$GCC” = “”], [
AS_CASE(["$target_os"],[aix*],[warnflags="$warnflags -qinfo=por" rb_cv_warnflags="$rb_cv_warnflags -qinfo=por"])
]) AS_IF([test “$GCC” = yes], [
AS_IF([test "$gcc_major" -ge 4], [ RUBY_TRY_CFLAGS(-fvisibility=hidden, [visibility_option=yes], [visibility_option=no]) ]) AC_SUBST(WERRORFLAG, "-Werror") AS_IF([test "$visibility_option" = yes], [ 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")]) ], [ RUBY_TRY_LDFLAGS([-Wl,-unexported_symbol,_Init_*], [visibility_option=ld], [visibility_option=no]) ]) test "$visibility_option" = no || OBJCOPY=:
])
AS_IF([test “$GCC” = yes], [
# 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]) AS_IF([test "$static_libgcc" = yes], [ RUBY_APPEND_OPTION(EXTLDFLAGS, -static-libgcc) ]) ]) # disable fast-math for oflag in -fno-fast-math; do RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(CFLAGS, $oflag)]) done for oflag in -fexcess-precision=standard -fp-model\ precise; do RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(XCFLAGS, $oflag)]) done
])
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${rpathflag:+ $rpathflag\\\\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(, [mingw*], [
RUBY_APPEND_OPTION(CPPFLAGS, -D_WIN32_WINNT=$with_winnt_ver) RUBY_APPEND_OPTION(CPPFLAGS, -D__MINGW_USE_VC2005_COMPAT)
])
AS_CASE(, [freebsd*], [
AC_CACHE_CHECK([whether pthread should be enabled by default], rb_cv_enable_pthread_default, [AC_TRY_CPP([
include <osreldate.h> if __FreeBSD_version < 502102 error pthread should be disabled on this platform endif
], rb_cv_enable_pthread_default=yes, rb_cv_enable_pthread_default=no)]) enable_pthread=$rb_cv_enable_pthread_default ],
[mingw*], [
enable_pthread=no ],
[
enable_pthread=yes ])
dnl Checks for libraries. AS_CASE(,[bsd|dragonfly*],[],)
POSTLINK=: AC_SUBST(POSTLINK) AS_CASE(, [nextstep*], [ ], [openstep*], [ ], [rhapsody*], [ ], [darwin*], [ RUBY_PREPEND_OPTION(LIBS, -lobjc)
RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT) AC_MSG_CHECKING(whether Mac OS X 10.5 or later) AC_TRY_CPP([#include <AvailabilityMacros.h> #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040 #error pre OS X 10.4 [!<===== pre OS X 10.4 =====>] #endif ], [macosx_10_5=yes], [macosx_10_5=no]) AC_MSG_RESULT($macosx_10_5) AS_IF([test "${target_os@%:@darwin}" -ge 16], [ ac_cv_func___syscall=no ac_cv_func_syscall=no ac_cv_header_sys_syscall_h=no ac_cv_header_syscall_h=no ]) AS_IF([test $macosx_10_5 = yes], [ ac_cv_func_getcontext=no ac_cv_func_setcontext=no ], [ AC_DEFINE(BROKEN_SETREUID, 1) AC_DEFINE(BROKEN_SETREGID, 1) ]) incs=`$CC -v -E -xc - < /dev/null 2>&1 | sed ['1,/^@%:@include </d;s/^ *//;s|[^./][^/]*/\.\./||g;/\/include$/!d;s||/lib|;/\/usr\/lib/d']` for d in `$CC -print-search-dirs | sed -e '/^libraries: */!d;s///' | tr : '\012' | fgrep -v /../ | sed -n 's|^\(/.*/lib\)/$|\1|p'`; do incs=`echo "$incs" | fgrep -v "$d"` done for d in $incs; do test -d "$d" && RUBY_APPEND_OPTIONS(LDFLAGS, "-L$d") done ac_cv_type_getgroups=gid_t # getgroups() on Rosetta fills garbage ac_cv_lib_crypt_crypt=no ac_cv_func_fdatasync=no # Mac OS X wrongly reports it has fdatasync() ac_cv_func_vfork=no AS_IF([test $gcc_major -lt 4 -o \( $gcc_major -eq 4 -a $gcc_minor -lt 3 \)], [ ac_cv_func___builtin_setjmp=no ]) AC_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt, [AC_TRY_RUN([
include <stdio.h> include <unistd.h> include <string.h>
void broken_crypt(const char *salt, const char *buf1, const char *buf2) { if 0
printf("%.2x%.2x: %s -> %s\n", (unsigned char)salt[0], (unsigned char)salt[1], buf1+2, buf2+2);
endif }
int main() {
int i; char salt[2], buf[256], *s; for (i = 0; i < 128*128; i++) { salt[0] = 0x80 | (i & 0x7f); salt[1] = 0x80 | (i >> 7); strcpy(buf, crypt("", salt)); if (strcmp(buf, s = crypt("", salt))) { broken_crypt(salt, buf, s); return 1; } } salt[0] = salt[1] = ' '; strcpy(buf, crypt("", salt)); salt[0] = salt[1] = 0x80 | ' '; if (strcmp(buf, s = crypt("", salt))) { broken_crypt(salt, buf, s); return 1; } return 0;
} ],
rb_cv_broken_crypt=no, rb_cv_broken_crypt=yes, rb_cv_broken_crypt=yes)]) AS_IF([test "$rb_cv_broken_crypt" = yes], [ AC_DEFINE(BROKEN_CRYPT, 1) ]) POSTLINK="" AC_CHECK_PROGS(codesign, codesign) AC_CHECK_PROGS(dsymutil, dsymutil) AS_IF([test -n "$codesign"], [ POSTLINK="{ test -z '\$(RUBY_CODESIGN)' || $codesign -s '\$(RUBY_CODESIGN)' -f \$@; }${POSTLINK:+; $POSTLINK}" ]) AS_IF([test -n "$dsymutil"], [ POSTLINK="$dsymutil \$@${POSTLINK:+; $POSTLINK}" ]) AS_IF([test -n "${POSTLINK}"], [ LINK_SO="$LINK_SO
$(POSTLINK)“
]) AC_CHECK_HEADERS(crt_externs.h, [], [], [ #include <crt_externs.h> ]) ],
[hpux*], [ LIBS=“-lm $LIBS”
ac_cv_c_inline=no],
[solaris*], [ LIBS=“-lm $LIBS”
ac_cv_func_vfork=no AC_MSG_CHECKING(whether _XOPEN_SOURCE is already given) AC_TRY_COMPILE([#include <unistd.h> #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ], [], [given_xopen_source=yes], [given_xopen_source=no]) AC_MSG_RESULT($given_xopen_source) AS_IF([test $given_xopen_source = no], [ # On Solaris, with gcc, -std=iso9899:1999 in $ansi_options # is often also needed in CPPFLAGS, because some feature # definitions vary depending on such standards options. AS_CASE(["${ansi_options}"], [*-std=iso9899:1999*], [ RUBY_APPEND_OPTIONS(CPPFLAGS, ${ansi_options}) ]) AC_MSG_CHECKING(appropriate _XOPEN_SOURCE value to define) define_xopen_source="" for tmp_xpg in 7 6 5; do AS_IF([test x"$define_xopen_source" != x], [ break ]) # Both AC_TRY_CPP and AC_TRY_COMPILE should pass # because some options may not be set to CPPFLAGS. AC_TRY_CPP([ #define _XOPEN_SOURCE ${tmp_xpg}00 #include <unistd.h> #ifndef _XPG${tmp_xpg} #error _XPG${tmp_xpg} should be defined by _XOPEN_SOURCE=${tmp_xpg}00 #endif ], [ AC_TRY_COMPILE([ #define _XOPEN_SOURCE ${tmp_xpg}00 #include <unistd.h> #ifndef _XPG${tmp_xpg} #error _XPG${tmp_xpg} should be defined by _XOPEN_SOURCE=${tmp_xpg}00 #endif ], [], [define_xopen_source=${tmp_xpg}00], []) ], []) done AS_IF([test x"$define_xopen_source" = x], [ define_xopen_source=no ]) AC_MSG_RESULT($define_xopen_source) AS_IF([test x"$define_xopen_source" != xno], [ RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE=$define_xopen_source) ]) ]) ],
[haiku*], [
LIBS="$LIBS" # m lib is include in root ],
[cygwin*], [ ac_cv_header_langinfo_h=yes
RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE -D_GNU_SOURCE) AC_CHECK_FUNCS(cygwin_conv_path) AC_LIBOBJ([langinfo]) ],
[mingw*], [ LIBS=“-lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi $LIBS”
ac_cv_header_a_out_h=no ac_cv_header_pwd_h=no ac_cv_header_utime_h=no ac_cv_header_sys_ioctl_h=no ac_cv_header_sys_param_h=no ac_cv_header_sys_resource_h=no ac_cv_header_sys_select_h=no ac_cv_header_sys_time_h=no ac_cv_header_sys_times_h=no ac_cv_header_sys_socket_h=no ac_cv_func_lstat=yes ac_cv_func_times=yes ac_cv_func_waitpid=yes ac_cv_func_fsync=yes ac_cv_func_seekdir=yes ac_cv_func_telldir=yes ac_cv_func_isinf=yes ac_cv_func_isnan=yes ac_cv_func_finite=yes ac_cv_func_lchown=yes ac_cv_func_link=yes ac_cv_func_readlink=yes ac_cv_func_symlink=yes ac_cv_lib_crypt_crypt=no ac_cv_func_getpgrp_void=no ac_cv_func_memcmp_working=yes ac_cv_lib_dl_dlopen=no rb_cv_binary_elf=no rb_cv_negative_time_t=no ac_cv_func_fcntl=yes ac_cv_func_flock=yes ac_cv_func_gmtime_r=yes rb_cv_large_fd_select=yes ac_cv_type_struct_timeval=yes ac_cv_func_clock_gettime=yes ac_cv_func_clock_getres=yes ac_cv_func_malloc_usable_size=no AS_IF([test "$target_cpu" = x64], [ ac_cv_func___builtin_setjmp=no ac_cv_func_round=no ]) ac_cv_func_tgamma=no rb_cv_negative_time_t=yes AC_CHECK_TYPE([NET_LUID], [], [], [@%:@include <winsock2.h> @%:@include <iphlpapi.h>]) AS_IF([test x"$ac_cv_type_NET_LUID" = xyes], [ AC_DEFINE(HAVE_TYPE_NET_LUID, 1) ]) AC_CHECK_FUNCS(_gmtime64_s) AC_CHECK_FUNCS(_wfreopen_s) AC_LIBOBJ([langinfo]) ],
[bsdi*], [ LIBS=“-lm $LIBS”
AC_DEFINE(BROKEN_SETREUID, 1) AC_DEFINE(BROKEN_SETREGID, 1) ac_cv_sizeof_rlim_t=8],
[freebsd*], [ LIBS=“-lm $LIBS”
ac_cv_func_getpeername=no ac_cv_func_getsockname=no ac_cv_func_shutdown=no ac_cv_func_close=no ],
[netbsd*], [ LIBS=“-lm $LIBS”
],
[dragonfly*], [ LIBS=“-lm $LIBS”
# isinf() and isnan() are macros on DragonFly. ac_cv_func_isinf=yes ac_cv_func_isnan=yes ],
[aix*],[ LIBS=“-lm $LIBS”
ac_cv_func_round=no ],
[ LIBS=“-lm $LIBS”])
AC_CHECK_LIB(crypt, crypt) # glibc (GNU/Linux, GNU/Hurd, GNU/kFreeBSD) AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX AC_CHECK_LIB(socket, shutdown) # SunOS/Solaris
dnl Checks for header files. AC_HEADER_DIRENT dnl AC_HEADER_STDC has been checked in AC_USE_SYSTEM_EXTENSIONS AC_HEADER_STDBOOL AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(a.out.h) AC_CHECK_HEADERS(atomic.h) AC_CHECK_HEADERS(direct.h) AC_CHECK_HEADERS(grp.h) AC_CHECK_HEADERS(fcntl.h) AC_CHECK_HEADERS(float.h) AC_CHECK_HEADERS(ieeefp.h) AC_CHECK_HEADERS(intrinsics.h) AC_CHECK_HEADERS(langinfo.h) AC_CHECK_HEADERS(limits.h) AC_CHECK_HEADERS(locale.h) AC_CHECK_HEADERS(malloc.h) AC_CHECK_HEADERS(malloc/malloc.h) AC_CHECK_HEADERS(malloc_np.h) AC_CHECK_HEADERS(net/socket.h) AC_CHECK_HEADERS(process.h) AC_CHECK_HEADERS(pwd.h) AC_CHECK_HEADERS(setjmpex.h) AC_CHECK_HEADERS(sys/attr.h) AC_CHECK_HEADERS(sys/fcntl.h) AC_CHECK_HEADERS(sys/file.h) AC_CHECK_HEADERS(sys/id.h) AC_CHECK_HEADERS(sys/ioctl.h) AC_CHECK_HEADERS(sys/mkdev.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/prctl.h) AC_CHECK_HEADERS(sys/resource.h) AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(sys/sendfile.h) AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(sys/syscall.h) AC_CHECK_HEADERS(sys/sysmacros.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/times.h) AC_CHECK_HEADERS(sys/uio.h) AC_CHECK_HEADERS(sys/utime.h) AC_CHECK_HEADERS(syscall.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(ucontext.h) AC_CHECK_HEADERS(utime.h)
[AS_HELP_STRING([--without-gmp], [disable GNU GMP to accelerate Bignum operations])], [], [with_gmp=yes])
AS_IF([test “x$with_gmp” != xno],
[AC_CHECK_HEADERS(gmp.h) AS_IF([test "x$ac_cv_header_gmp_h" != xno], AC_SEARCH_LIBS([__gmpz_init], [gmp], [AC_DEFINE(HAVE_LIBGMP, 1)]))])
[AS_HELP_STRING([--with-jemalloc],[use jemalloc allocator])], [with_jemalloc=$withval], [with_jemalloc=no])
AS_IF([test “x$with_jemalloc” = xyes],[
AC_SEARCH_LIBS([malloc_conf], [jemalloc], [AC_DEFINE(HAVE_LIBJEMALLOC, 1)], [with_jemalloc=no]) AC_CHECK_HEADER(jemalloc/jemalloc.h, [ AC_DEFINE(RUBY_ALTERNATIVE_MALLOC_HEADER, [<jemalloc/jemalloc.h>]) ]) AS_IF([test "x$with_jemalloc" = xno], [ AC_CACHE_CHECK([for jemalloc with JEMALLOC_MANGLE], rb_cv_jemalloc_demangle, [AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@define JEMALLOC_MANGLE 1 @%:@ifdef RUBY_ALTERNATIVE_MALLOC_HEADER @%:@include RUBY_ALTERNATIVE_MALLOC_HEADER @%:@else @%:@include <jemalloc.h> @%:@endif], [return !&malloc_conf])], [rb_cv_jemalloc_demangle=yes], [rb_cv_jemalloc_demangle=no]) ]) ]) AS_IF([test "x$rb_cv_jemalloc_demangle" = xyes], [ AC_DEFINE(JEMALLOC_MANGLE) with_jemalloc=yes ]) AS_IF([test "x$with_jemalloc" = xyes], [ AC_DEFINE(HAVE_MALLOC_CONF) ac_cv_func_malloc_usable_size=yes ], [AC_MSG_ERROR([jemalloc requested but not found]) ])
])
dnl check for large file stuff mv confdefs.h confdefs1.h : > confdefs.h AC_SYS_LARGEFILE # On 32-bit Solaris, it is safe to define _LARGEFILE_SOURCE # which is not added by AC_SYS_LARGEFILE. AS_IF([test x“$enable_largefile” != xno], [
AS_CASE(["$target_os"], [solaris*], [ AC_MSG_CHECKING([wheather _LARGEFILE_SOURCE should be defined]) AS_CASE(["${ac_cv_sys_file_offset_bits}:${ac_cv_sys_large_files}"], ["64:"|"64:no"|"64:unknown"], [ # insert _LARGEFILE_SOURCE before _FILE_OFFSET_BITS line # that is the same order as "getconf LFS_CFLAGS" output mv confdefs.h largefile0.h : > confdefs.h AC_DEFINE(_LARGEFILE_SOURCE) cat largefile0.h >> confdefs.h rm largefile0.h AC_MSG_RESULT([yes]) ], [AC_MSG_RESULT([no])]) ])
]) mv confdefs.h largefile.h mv confdefs1.h confdefs.h cat largefile.h >> confdefs.h
[mingw*], [ac_cv_type_off_t=yes;ac_cv_sizeof_off_t=8], [aix*], [ AS_CASE(["$target_cpu:$ac_cv_sys_large_files"], [ppc64:*|powerpc64:*], [], [*:no|*:unknown], [], [ # AIX currently does not support a 32-bit call to posix_fadvise() # if _LARGE_FILES is defined. ac_cv_func_posix_fadvise=no ]) ])
AC_C_BIGENDIAN AC_C_CONST AC_C_CHAR_UNSIGNED AC_C_INLINE AC_C_VOLATILE AC_C_TYPEOF
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(, [dnl AS_VAR_PUSHDEF(, [rbcv_sizeof_var])dnl AS_VAR_PUSHDEF(, [rbcv_sizeof_cond])dnl AS_VAR_PUSHDEF(, [rbcv_sizeof_type])dnl AS_VAR_PUSHDEF(, [rbcv_sizeof_size])dnl ] [m4_bmatch(, [.], [], [if test “$universal_binary” = yes; then]) AC_CACHE_CHECK([size of $1], [AS_TR_SH()], [
unset AS_TR_SH(ac_cv_sizeof_$1) rbcv_var="
typedef m4_bpatsubst(, [..*]) ac__type_sizeof_; static ac__type_sizeof_ *rbcv_ptr; @%:@define AS_TR_CPP(SIZEOF_$1) sizeof((*rbcv_ptr)[]m4_bmatch(, [.], .m4_bpatsubst(, [^[^.]*.]))) “
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 }], [ AC_COMPUTE_INT([AS_TR_SH(ac_cv_sizeof_$1)], [AS_TR_CPP(SIZEOF_$1)], [AC_INCLUDES_DEFAULT([$4])
$rbcv_var],
[AS_TR_SH(ac_cv_sizeof_$1)=]) ]) 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}"; continue]) AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$hdr]
[ @%:@if AS_TR_CPP(HAVE_$1) $rbcv_var @%:@else @%:@define AS_TR_CPP(SIZEOF_$1) 0 @%:@endif ],
[AS_TR_CPP(HAVE_$1) == (AS_TR_CPP(SIZEOF_$1) == (m4_bmatch([$2], [^[0-9][0-9]*$], [$2], [($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}m4_bmatch([$2], [^[0-9][0-9]*$], [:$2])"]) done done }]) test "${AS_TR_SH(ac_cv_sizeof_$1)@%:@@<:@1-9@:>@}" = "${AS_TR_SH(ac_cv_sizeof_$1)}" && 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 AS_IF([test ${t-0} != 0], [ AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}" ]) } : ${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]*\)$']` AS_CASE([$t], [*:*], [t="${t%:*}"], [s=`expr $s / $rb_cv_char_bit`]) echo "@%:@${cond+el}if defined(__${t}__) || defined(__${t}) || defined(_${t}) || defined($t)" echo "@%:@define AS_TR_CPP(SIZEOF_$1) $s" cond=1 ]) done ${cond+echo "@%:@endif"}
} >> confdefs.h m4_bmatch(, [.], [], [else AC_CHECK_SIZEOF(, 0, [$4]) fi]) AS_VAR_POPDEF()dnl AS_VAR_POPDEF()dnl AS_VAR_POPDEF()dnl AS_VAR_POPDEF()dnl ])
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, [8], [ILP LP]) RUBY_CHECK_SIZEOF(__int128, [16], [ILP LP]) 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>]) RUBY_CHECK_SIZEOF(clock_t, [], [], [@%:@include <time.h>])
AC_CACHE_CHECK(packed struct attribute, rb_cv_packed_struct,
[rb_cv_packed_struct=no for mac in \ "__pragma(pack(push, 1)) x __pragma(pack(pop))" \ "x __attribute__((packed))" \ ; do AC_TRY_COMPILE([@%:@define PACKED_STRUCT(x) $mac PACKED_STRUCT(struct { int a; });], [], [rb_cv_packed_struct=$mac; break]) done])
AS_IF([test “$rb_cv_packed_struct” != no], [
AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], [$rb_cv_packed_struct]) RUBY_TRY_CFLAGS(-Wno-address-of-packed-member, [AC_DEFINE(USE_UNALIGNED_MEMBER_ACCESS)])
], [
AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], x)
])
AC_DEFUN(, [ 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(RUBY_APPEND_OPTIONS(CFLAGS, $rb_cv_wsuppress_flags) 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)])
AS_IF([test “[$rb_cv_pri_prefix_]AS_TR_SH($1)” != NONE], [
AC_DEFINE_UNQUOTED([PRI_]m4_ifval($3,$3,AS_TR_CPP(m4_bpatsubst([$1],[_t$])))[_PREFIX], "[$rb_cv_pri_prefix_]AS_TR_SH($1)")
]) ])
AS_IF([test “x$ac_cv_type_long_long” = xyes], [
RUBY_CHECK_PRINTF_PREFIX(long long, ll I64, LL)
], [test “x$ac_cv_type___int64” = xyes], [
RUBY_CHECK_PRINTF_PREFIX(__int64, ll I64, LL)
])
dnl RUBY_CHECK_SIGNEDNESS [typename] [if-signed] [if-unsigned] [included] AC_DEFUN(, [dnl
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])], [($1)-1 > 0])], [$3], [$2])])
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included] AC_DEFUN(, [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], [RUBY_CHECK_SIGNEDNESS($n, [], [u=U], [$4])]) AS_IF([test x"$t" = x], [ 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 ]) AS_CASE([" $n "], [*" long long "*], [ t=LL], [*" long "*], [ t=LONG], [ t=INT]) rb_cv_[$1]_convertible=${u}${t}]) AS_IF([test "${AS_TR_SH(ac_cv_type_[$1])}" = "yes"], [ n="$1" ], [ AS_CASE(["${rb_cv_[$1]_convertible}"], [*LL], [n="long long"], [*LONG], [n="long"], [n="int"]) AS_CASE(["${rb_cv_[$1]_convertible}"], [U*], [n="unsigned $n"]) ]) AS_CASE("${rb_cv_[$1]_convertible}", [U*], [u=+1], [u=-1]) AC_DEFINE_UNQUOTED(rb_[$1], $n) AC_DEFINE_UNQUOTED([SIGNEDNESS_OF_]AS_TR_CPP($1), $u) 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, [ @%:@ifdef HAVE_SYS_TYPES_H @%:@include <sys/types.h> @%:@endif @%:@ifdef HAVE_SYS_TYPES_H @%:@include <sys/time.h> @%:@endif @%:@include <sys/resource.h> ]) RUBY_REPLACE_TYPE(off_t, [], OFFT) RUBY_REPLACE_TYPE(clockid_t, [], CLOCKID)
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)])
AS_IF([test “$rb_cv_have_prototypes” = yes], [
AC_DEFINE(HAVE_PROTOTYPES)
])
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)])
AS_IF([test “$rb_cv_tokenpaste” = ansi], [
AC_DEFINE(TOKEN_PASTE(x,y),[x@%:@@%:@y])
], [
AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
])
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)) AS_IF([test x“$rb_cv_stringization” != xno -a “$rb_cv_stringization” != “#expr”], [
AC_DEFINE_UNQUOTED(STRINGIZE0(expr),$rb_cv_stringization) AC_DEFINE(OLD_FASHIONED_STRINGIZATION,1)
])
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])]
) AS_IF([test “$rb_cv_string_literal_concatenation” = no], [
AC_DEFINE(NO_STRING_LITERAL_CONCATENATION,1)
])
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)])
AS_IF([test “$rb_cv_stdarg” = yes], [
AC_DEFINE(HAVE_STDARG_PROTOTYPES)
])
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)])
AS_IF([test “$rb_cv_va_args_macro” = yes], [
AC_DEFINE(HAVE_VA_ARGS_MACRO)
])
AC_DEFUN(, [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_DECL_ATTRIBUTE(attrib, macroname, cachevar, condition, type, code) AC_DEFUN(, [dnl m4_ifval(, dnl
[AS_VAR_PUSHDEF([attrib], m4_bpatsubst([$2], [(.*)], []))], dnl [AS_VAR_PUSHDEF([attrib], m4_toupper(m4_format(%.4s, [$5]))[_]AS_TR_CPP($1))] dnl
)dnl m4_ifval(, dnl
[AS_VAR_PUSHDEF([rbcv],[$3])], dnl [AS_VAR_PUSHDEF([rbcv],[rb_cv_]m4_format(%.4s, [$5])[_][$1])]dnl
)dnl m4_pushdef(,[m4_bpatsubst(,[“],[\”])])dnl m4_pushdef(,[m4_bpatsubst(,[^[^()]*(([^()]*)).*],[1])])dnl m4_ifval(, [rbcv_cond=; test “$rbcv_cond” || unset rbcv_cond]) AC_CACHE_CHECK(for m4_ifval(,[m4_bpatsubst(, [(.*)], [])],[$1]) [$5] attribute, rbcv, dnl [rbcv=x RUBY_WERROR_FLAG([ for mac in \
"__attribute__ ((attrib_code)) x" \ "x __attribute__ ((attrib_code))" \ "__declspec(attrib_code) x" \ x; do m4_ifval([$4],mac="$mac"${rbcv_cond+" /* only if $rbcv_cond */"}) AC_TRY_COMPILE( m4_ifval([$4],${rbcv_cond+[@%:@if ]$rbcv_cond})
m4_ifval(,${rbcv_cond+} ${rbcv_cond+[@%:@define ]attrib[](attrib_params)[ x]} ${rbcv_cond+}) $6 @%:@define mesg (“”)
attrib[](attrib_params)[;], [], [rbcv="$mac"; break])
done ])]) AS_IF([test “$rbcv” != x], [
RUBY_DEFINE_IF(m4_ifval([$4],[${rbcv_cond}]), attrib[](attrib_params)[], $rbcv)
]) m4_ifval(, [unset rbcv_cond]) dnl m4_popdef()dnl m4_popdef()dnl AS_VAR_POPDEF()dnl AS_VAR_POPDEF()dnl ])
dnl RUBY_FUNC_ATTRIBUTE(attrib, macroname, cachevar, condition) AC_DEFUN(, [dnl
RUBY_DECL_ATTRIBUTE([$1], [$2], [$3], [$4], [function], [@%:@define x int conftest_attribute_check(void)] )
])
dnl RUBY_TYPE_ATTRIBUTE(attrib, macroname, cachevar, condition) AC_DEFUN(, [dnl
RUBY_DECL_ATTRIBUTE([$1], [$2], [$3], [$4], [type], [
@%:@define x struct conftest_attribute_check {int i;} ]) ])
RUBY_FUNC_ATTRIBUTE(__const__, CONSTFUNC) RUBY_FUNC_ATTRIBUTE(__pure__, PUREFUNC) RUBY_FUNC_ATTRIBUTE(__noreturn__, NORETURN) RUBY_FUNC_ATTRIBUTE(__deprecated__, DEPRECATED) RUBY_FUNC_ATTRIBUTE(__deprecated__(“by ”@%:@n), DEPRECATED_BY(n,x), rb_cv_func_deprecated_by) RUBY_TYPE_ATTRIBUTE(__deprecated__ mesg, DEPRECATED_TYPE(mesg,x), rb_cv_type_deprecated) RUBY_FUNC_ATTRIBUTE(__noinline__, NOINLINE) RUBY_FUNC_ATTRIBUTE(always_inline, ALWAYS_INLINE) RUBY_FUNC_ATTRIBUTE(warn_unused_result, WARN_UNUSED_RESULT) RUBY_FUNC_ATTRIBUTE(__unused__, MAYBE_UNUSED) RUBY_FUNC_ATTRIBUTE(__error__ mesg, ERRORFUNC(mesg,x), rb_cv_func___error__) RUBY_FUNC_ATTRIBUTE(__warning__ mesg, WARNINGFUNC(mesg,x), rb_cv_func___warning__) RUBY_FUNC_ATTRIBUTE(__weak__, WEAK, rb_cv_func_weak) AS_IF([test “$rb_cv_func_weak” != x], [
AC_DEFINE(HAVE_FUNC_WEAK)
])
if_i386=${universal_binary+[defined i386]} RUBY_FUNC_ATTRIBUTE(__stdcall__, FUNC_STDCALL, rb_cv_func_stdcall, ${if_i386}) RUBY_FUNC_ATTRIBUTE(__cdecl__, FUNC_CDECL, rb_cv_func_cdecl, ${if_i386}) RUBY_FUNC_ATTRIBUTE(__fastcall__, FUNC_FASTCALL, rb_cv_func_fastcall, ${if_i386}) RUBY_FUNC_ATTRIBUTE(__optimize__(“O0”), FUNC_UNOPTIMIZED, rb_cv_func_unoptimized) RUBY_FUNC_ATTRIBUTE(__optimize__(“-Os”,“-fomit-frame-pointer”), FUNC_MINIMIZED, rb_cv_func_minimized)
AS_IF([test “$GCC” = yes], [
AC_CACHE_CHECK([for function alias], [rb_cv_gcc_function_alias], [rb_cv_gcc_function_alias=no for a in alias weak,alias; do AC_TRY_LINK([void foo(void) {} void bar(void) __attribute__(($a("foo")));], [bar()], [rb_cv_gcc_function_alias=$a; break]) done]) AS_IF([test "$rb_cv_gcc_function_alias" != no], [ AC_DEFINE(HAVE_ATTRIBUTE_FUNCTION_ALIAS) AC_DEFINE_UNQUOTED([RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args)], [type prot __attribute__(($rb_cv_gcc_function_alias(@%:@name)));]) AC_DEFINE_UNQUOTED([RUBY_ALIAS_FUNCTION_VOID(prot, name, args)], [RUBY_ALIAS_FUNCTION_TYPE(void, prot, name, args)]) ]) AC_CACHE_CHECK([for __atomic builtins], [rb_cv_gcc_atomic_builtins], [ AC_TRY_LINK([unsigned char atomic_var;], [ __atomic_exchange_n(&atomic_var, 0, __ATOMIC_SEQ_CST); __atomic_exchange_n(&atomic_var, 1, __ATOMIC_SEQ_CST); __atomic_fetch_add(&atomic_var, 1, __ATOMIC_SEQ_CST); __atomic_fetch_sub(&atomic_var, 1, __ATOMIC_SEQ_CST); __atomic_or_fetch(&atomic_var, 1, __ATOMIC_SEQ_CST); ], [rb_cv_gcc_atomic_builtins=yes], [rb_cv_gcc_atomic_builtins=no])]) AS_IF([test "$rb_cv_gcc_atomic_builtins" = yes], [ AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS) ]) AC_CACHE_CHECK([for __sync builtins], [rb_cv_gcc_sync_builtins], [ AC_TRY_LINK([unsigned char atomic_var;], [ __sync_lock_test_and_set(&atomic_var, 0); __sync_lock_test_and_set(&atomic_var, 1); __sync_fetch_and_add(&atomic_var, 1); __sync_fetch_and_sub(&atomic_var, 1); __sync_or_and_fetch(&atomic_var, 1); __sync_val_compare_and_swap(&atomic_var, 0, 1); ], [rb_cv_gcc_sync_builtins=yes], [rb_cv_gcc_sync_builtins=no])]) AS_IF([test "$rb_cv_gcc_sync_builtins" = yes], [ AC_DEFINE(HAVE_GCC_SYNC_BUILTINS) ]) AC_CACHE_CHECK(for __builtin_unreachable, rb_cv_func___builtin_unreachable, [RUBY_WERROR_FLAG( [AC_TRY_LINK([volatile int zero;], [if (zero) __builtin_unreachable();], [rb_cv_func___builtin_unreachable=yes], [rb_cv_func___builtin_unreachable=no]) ]) ]) AS_IF([test "$rb_cv_func___builtin_unreachable" = yes], [ AC_DEFINE_UNQUOTED(UNREACHABLE, [__builtin_unreachable()]) ])
])
AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [ rb_cv_func_exported=no RUBY_WERROR_FLAG([ for mac in '__attribute__ ((__visibility__(“default”)))' '__declspec(dllexport)'; do
AC_TRY_COMPILE([@%:@define RUBY_FUNC_EXPORTED $mac extern RUBY_FUNC_EXPORTED void conftest_attribute_check(void);], [], [rb_cv_func_exported="$mac"; break])
done ])]) AS_IF([test “$rb_cv_func_exported” != no], [
AC_DEFINE_UNQUOTED(RUBY_FUNC_EXPORTED, [$rb_cv_func_exported extern])
])
RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT)
AC_CACHE_CHECK(for function name string predefined identifier,
rb_cv_function_name_string, [rb_cv_function_name_string=no RUBY_WERROR_FLAG([ for func in __func__ __FUNCTION__; do AC_TRY_LINK([@%:@include <stdio.h>], [puts($func);], [rb_cv_function_name_string=$func break]) done ])]
) AS_IF([test “$rb_cv_function_name_string” != no], [
AC_DEFINE_UNQUOTED(RUBY_FUNCTION_NAME_STRING, [$rb_cv_function_name_string])
])
AC_CACHE_CHECK(if enum over int is allowed, rb_cv_enum_over_int, [
rb_cv_enum_over_int=no AS_IF([test "x$ac_cv_type_long_long" = xyes], [ type="unsigned long long" max="ULLONG_MAX" ], [ type="unsigned long" max="ULONG_MAX" ]) RUBY_WERROR_FLAG([ AC_COMPILE_IFELSE([ AC_LANG_BOOL_COMPILE_TRY([ @%:@include <limits.h> enum {conftest_max = $max}; ], [ (conftest_max == $max) && (sizeof(conftest_max) == sizeof($type)) ] )], [rb_cv_enum_over_int=yes], [rb_cv_enum_over_int=no] ) ])
]) AS_IF([test $rb_cv_enum_over_int = yes], [
AC_DEFINE(ENUM_OVER_INT, 1)
])
dnl Check whether we need to define sys_nerr locally AC_CHECK_DECLS(, [], [], [$ac_includes_default @%:@include <errno.h>])
AS_CASE(, [alpha*|sh4|sh4el|sh4eb], [AS_CASE(,
[*::yes], # gcc [CFLAGS="-mieee $CFLAGS"], [osf*], # ccc [CFLAGS="-ieee $CFLAGS"], )],
[sparc*], [AC_LIBOBJ()])
ac_cv_header_net_socket_h=${ac_cv_header_net_socket_h=no} AS_IF([test “$ac_cv_header_net_socket_h” = yes], [
ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h=no}
], [
ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h=yes}
])
AC_TYPE_SIZE_T RUBY_CHECK_SIGNEDNESS(size_t, [AC_MSG_ERROR(size_t is signed)], [],
[@%:@include <sys/types.h>])
RUBY_CHECK_SIZEOF(size_t, [int long void*], [], [@%:@include <sys/types.h>]) RUBY_CHECK_SIZEOF(ptrdiff_t, size_t, [], [@%:@include <stddef.h>]) RUBY_CHECK_PRINTF_PREFIX(size_t, z) RUBY_CHECK_PRINTF_PREFIX(ptrdiff_t, t) AC_STRUCT_ST_BLKSIZE AC_STRUCT_ST_BLOCKS AC_STRUCT_ST_RDEV RUBY_CHECK_SIZEOF([struct stat.st_size], [off_t int long “long long”], [], [@%:@include <sys/stat.h>]) AS_IF([test “$ac_cv_member_struct_stat_st_blocks” = yes], [
RUBY_CHECK_SIZEOF([struct stat.st_blocks], [off_t int long "long long"], [], [@%:@include <sys/stat.h>])
]) RUBY_CHECK_SIZEOF([struct stat.st_ino], [long “long long”], [], [@%:@include <sys/stat.h>]) AC_CHECK_MEMBERS([struct stat.st_atim]) AC_CHECK_MEMBERS([struct stat.st_atimespec]) AC_CHECK_MEMBERS([struct stat.st_atimensec]) AC_CHECK_MEMBERS([struct stat.st_mtim]) AC_CHECK_MEMBERS([struct stat.st_mtimespec]) AC_CHECK_MEMBERS([struct stat.st_mtimensec]) AC_CHECK_MEMBERS([struct stat.st_ctim]) AC_CHECK_MEMBERS([struct stat.st_ctimespec]) AC_CHECK_MEMBERS([struct stat.st_ctimensec]) AC_CHECK_MEMBERS([struct stat.st_birthtimespec])
AC_CHECK_TYPES([struct timeval], [], [], [@%:@ifdef HAVE_TIME_H @%:@include <time.h> @%:@endif @%:@ifdef HAVE_SYS_TIME_H @%:@include <sys/time.h> @%:@endif])
AS_IF([test “${ac_cv_type_struct_timeval}” = yes], [
RUBY_CHECK_SIZEOF([struct timeval.tv_sec], [time_t long "long long"], [], [@%:@ifdef HAVE_TIME_H
@%:@include <time.h> @%:@endif @%:@ifdef HAVE_SYS_TIME_H @%:@include <sys/time.h> @%:@endif])
AS_CASE(${ac_cv_sizeof_struct_timeval_tv_sec}, [SIZEOF_INT], [t=int], [SIZEOF_LONG], [t=long], [SIZEOF_LONG_LONG], [t=LONG_LONG], [t=]) AS_IF([test "${t}" != ""], [ AC_DEFINE_UNQUOTED(TYPEOF_TIMEVAL_TV_SEC, [$t]) ])
])
AC_CHECK_TYPES([struct timespec], [], [], [@%:@ifdef HAVE_TIME_H @%:@include <time.h> @%:@endif @%:@ifdef HAVE_SYS_TIME_H @%:@include <sys/time.h> @%:@endif])
AC_CHECK_TYPES([struct timezone], [], [], [@%:@ifdef HAVE_TIME_H @%:@ include <time.h> @%:@endif @%:@ifdef HAVE_SYS_TIME_H @%:@ include <sys/time.h> @%:@endif])
AC_CHECK_TYPES(, [], [], [@%:@ifdef HAVE_TIME_H @%:@ include <time.h> @%:@endif @%:@ifdef HAVE_SYS_TIME_H @%:@ include <sys/time.h> @%:@endif])
[AC_CHECK_TYPE(fd_mask, [rb_cv_large_fd_select=yes], [rb_cv_large_fd_select=no], [AC_INCLUDES_DEFAULT([])
@%:@ifdef HAVE_SYS_SELECT_H @%:@ include <sys/select.h> @%:@endif])]) AS_IF([test “$rb_cv_large_fd_select” = yes], [
AC_DEFINE(HAVE_RB_FD_INIT, 1)
])
dnl RUBY_DEFINT TYPENAME, SIZE, [UNSIGNED], [INCLUDES = DEFAULT-INCLUDES] AC_DEFUN(, [dnl AS_VAR_PUSHDEF(, [rb_defint_cond])dnl AS_VAR_PUSHDEF(, [rb_defint_type])dnl AC_CACHE_CHECK([for $1], [rb_cv_type_$1], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT() typedef $1 t; int s = sizeof(t) == 42;])],
[rb_cv_type_$1=yes], [AS_CASE([m4_bmatch([$2], [^[1-9][0-9]*$], $2, [$ac_cv_sizeof_]AS_TR_SH($2))], ["1"], [ rb_cv_type_$1="m4_if([$3], [], [signed ], [$3 ])char"], ["$ac_cv_sizeof_short"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])short"], ["$ac_cv_sizeof_int"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])int"], ["$ac_cv_sizeof_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long"], ["$ac_cv_sizeof_long_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long long"], ["${ac_cv_sizeof___int64@%:@*:}"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int64"], ["${ac_cv_sizeof___int128@%:@*:}"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int128"], [ rb_cv_type_$1=no])])])
AS_IF([test “${rb_cv_type_$1}” != no], [
type="${rb_cv_type_$1@%:@@%:@unsigned }" AS_IF([test "$type" != yes && eval 'test -n "${ac_cv_sizeof_'$type'+set}"'], [ eval cond='"${ac_cv_sizeof_'$type'}"' AS_CASE([$cond], [*:*], [ cond=AS_TR_CPP($type) echo "@%:@if defined SIZEOF_"$cond" && SIZEOF_"$cond" > 0" >> confdefs.h ], [cond=]) ], [cond=]) AC_DEFINE([HAVE_]AS_TR_CPP($1), 1) AS_IF([test "${rb_cv_type_$1}" = yes], [ m4_bmatch([$2], [^[1-9][0-9]*$], [AC_CHECK_SIZEOF([$1], 0, [AC_INCLUDES_DEFAULT([$4])])], [RUBY_CHECK_SIZEOF([$1], [$2], [], [AC_INCLUDES_DEFAULT([$4])])]) ], [ AC_DEFINE_UNQUOTED($1, [$rb_cv_type_$1]) AC_DEFINE_UNQUOTED([SIZEOF_]AS_TR_CPP($1), [SIZEOF_]AS_TR_CPP([$type])) ]) test -n "$cond" && echo "@%:@endif /* $cond */" >> confdefs.h
]) AS_VAR_POPDEF()dnl AS_VAR_POPDEF()dnl ])
RUBY_DEFINT(int8_t, 1) RUBY_DEFINT(uint8_t, 1, unsigned) RUBY_DEFINT(int16_t, 2) RUBY_DEFINT(uint16_t, 2, unsigned) RUBY_DEFINT(int32_t, 4) RUBY_DEFINT(uint32_t, 4, unsigned) RUBY_DEFINT(int64_t, 8) RUBY_DEFINT(uint64_t, 8, unsigned) RUBY_DEFINT(int128_t, 16) RUBY_DEFINT(uint128_t, 16, unsigned) RUBY_DEFINT(intptr_t, void*) RUBY_DEFINT(uintptr_t, void*, unsigned) RUBY_DEFINT(ssize_t, size_t, [], [@%:@include <sys/types.h>]) dnl may differ from int, so not use AC_TYPE_SSIZE_T.
AC_CACHE_CHECK(for stack end address, rb_cv_stack_end_address, [rb_cv_stack_end_address=no
AC_TRY_LINK( [extern void *__libc_stack_end;], [if (!__libc_stack_end) return 1;], [rb_cv_stack_end_address="__libc_stack_end"])
]) AS_IF([test $rb_cv_stack_end_address != no], [
AC_DEFINE_UNQUOTED(STACK_END_ADDRESS, $rb_cv_stack_end_address)
])
# posix_memalign(memptr, alignment, size) implemented for OpenBSD 4.8 doesn't work if alignment > MALLOC_PAGESIZE. # [ruby-core:42158] bugs.ruby-lang.org/issues/5901 # OpenBSD 5.2 fixed the problem. (src/lib/libc/stdlib/malloc.c:1.142) # MirOS #10semel has the problem but fixed in the repository. (src/lib/libc/stdlib/malloc.c:1.9) AS_CASE(, [openbsd*|mirbsd*], [
AC_CACHE_CHECK(for heap align log on openbsd, rb_cv_page_size_log, [rb_cv_page_size_log=no for page_log in 12 13; do AC_TRY_RUN([
include <math.h> include <unistd.h>
int main() {
if ((int)log2((double)sysconf(_SC_PAGESIZE)) != $page_log) return 1; return 0;
}
], rb_cv_page_size_log="$page_log"; break) done]) AS_IF([test $rb_cv_page_size_log != no], [ AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, $rb_cv_page_size_log) ], [ AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, 12) ])
])
dnl Checks for library functions. AC_TYPE_GETGROUPS AC_TYPE_SIGNAL AS_CASE(, [powerpc-darwin*], [
AC_LIBSOURCES(alloca.c) AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.${ac_objext}]) AC_DEFINE(C_ALLOCA) AC_DEFINE_UNQUOTED(alloca, alloca) ],
[universal-darwin*:ppc], [
AC_LIBSOURCES(alloca.c) AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.${ac_objext}]) RUBY_DEFINE_IF([defined __powerpc__], C_ALLOCA, 1) RUBY_DEFINE_IF([defined __powerpc__], alloca, alloca) ],
[
AC_FUNC_ALLOCA ])
AS_IF([test “x$ALLOCA” = “x”], [
AC_CACHE_CHECK([for dynamic size alloca], rb_cv_dynamic_alloca, [ for chk in ok __chkstk; do AC_TRY_LINK([ @%:@ifdef HAVE_ALLOCA_H @%:@include <alloca.h> @%:@endif void $chk() {} int dynamic_alloca_test; int dynamic_alloca_result;], [dynamic_alloca_result = alloca(dynamic_alloca_test) != 0;], [rb_cv_dynamic_alloca=$chk; break]) done]) AS_IF([test "x$rb_cv_dynamic_alloca" = "x__chkstk"], [ AC_DEFINE_UNQUOTED(RUBY_ALLOCA_CHKSTK, _$rb_cv_dynamic_alloca) AS_CASE("$target_cpu", [x64|x86_64], [ AC_SUBST([ALLOCA], [\${LIBOBJDIR}x86_64-chkstk.${ac_objext}]) ],) ])
]) AC_FUNC_MEMCMP
# sources.redhat.com/ml/libc-hacker/2005-08/msg00008.html # Debian GNU/Linux Etch's libc6.1 2.3.6.ds1-13etch5 has this problem. # Debian GNU/Linux Lenny's libc6.1 2.7-10 has no problem. AC_CACHE_CHECK(for broken erfc of glibc-2.3.6 on IA64, rb_cv_broken_glibc_ia64_erfc,
[AC_TRY_RUN([
include <math.h> int main() {
erfc(10000.0); return 0;
} ],
rb_cv_broken_glibc_ia64_erfc=no, rb_cv_broken_glibc_ia64_erfc=yes, rb_cv_broken_glibc_ia64_erfc=no)])
AS_CASE(,[freebsd*],[
AC_DEFINE(BROKEN_CLOSE) AC_REPLACE_FUNCS(close) ])
AC_REPLACE_FUNCS(acosh) AC_REPLACE_FUNCS(cbrt) AC_REPLACE_FUNCS(crypt) AC_REPLACE_FUNCS(dup2) AC_REPLACE_FUNCS(erf) AC_REPLACE_FUNCS(explicit_bzero) AC_REPLACE_FUNCS(ffs) AC_REPLACE_FUNCS(finite) AC_REPLACE_FUNCS(flock) AC_REPLACE_FUNCS(hypot) AC_REPLACE_FUNCS(isinf) AC_REPLACE_FUNCS(isnan) AC_REPLACE_FUNCS(lgamma_r) AC_REPLACE_FUNCS(memmove) AC_REPLACE_FUNCS(nextafter) AC_REPLACE_FUNCS(setproctitle) AC_REPLACE_FUNCS(strchr) AC_REPLACE_FUNCS(strerror) AC_REPLACE_FUNCS(strlcat) AC_REPLACE_FUNCS(strlcpy) AC_REPLACE_FUNCS(strstr) AC_REPLACE_FUNCS(tgamma)
# for missing/setproctitle.c AS_CASE(, [aix* | k*bsd*-gnu | kopensolaris*-gnu | linux* | darwin*], [AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)], [hpux*], [AC_DEFINE(SPT_TYPE,SPT_PSTAT) ], []) AC_CHECK_HEADERS(sys/pstat.h)
AC_CACHE_CHECK(for signbit, rb_cv_have_signbit,
[AC_TRY_LINK([
include <math.h> ], [int v = signbit(-0.0);],
rb_cv_have_signbit=yes, rb_cv_have_signbit=no)])
AS_IF([test “$rb_cv_have_signbit” = yes], [
AC_DEFINE(HAVE_SIGNBIT)
], [
AC_LIBOBJ([signbit])
])
AC_CACHE_CHECK(for broken memmem, rb_cv_broken_memmem, [
AC_TRY_RUN([
@%:@include <string.h>
int main(int argc, char **argv) {
const char *str = "hogefugafoobar"; const char *rs = "foo"; const char *empty = ""; char *p; p = memmem(str, strlen(str), rs, strlen(rs)); if (p == str+8) { p = memmem(str, strlen(str), empty, strlen(empty)); if (p == str) return 0; } return 1;
}
], rb_cv_broken_memmem=no, rb_cv_broken_memmem=yes, rb_cv_broken_memmem=yes)
]) test x“$rb_cv_broken_memmem” = xyes && ac_cv_func_memmem=no
AC_FUNC_FORK
AC_CHECK_FUNCS(__syscall) AC_CHECK_FUNCS(_longjmp) # used for AC_ARG_WITH(setjmp-type) # we don't use _setjmp if _longjmp doesn't exist. test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no AC_CHECK_FUNCS(arc4random_buf) AC_CHECK_FUNCS(atan2l atan2f) AC_CHECK_FUNCS(chroot) AC_CHECK_FUNCS(chsize) AC_CHECK_FUNCS(clock_gettime) AC_CHECK_FUNCS(cosh) AC_CHECK_FUNCS(crypt_r) AC_CHECK_FUNCS(daemon) AC_CHECK_FUNCS(dirfd) AC_CHECK_FUNCS(dl_iterate_phdr) AC_CHECK_FUNCS(dlopen) AC_CHECK_FUNCS(dladdr) AC_CHECK_FUNCS(dup) AC_CHECK_FUNCS(dup3) AC_CHECK_FUNCS(eaccess) AC_CHECK_FUNCS(endgrent) AC_CHECK_FUNCS(fchmod) AC_CHECK_FUNCS(fchown) AC_CHECK_FUNCS(fcntl) AC_CHECK_FUNCS(fdatasync) AC_CHECK_FUNCS(fdopendir) AC_CHECK_FUNCS(fgetattrlist) AC_CHECK_FUNCS(fmod) AC_CHECK_FUNCS(fstatat) AC_CHECK_FUNCS(fsync) AC_CHECK_FUNCS(ftruncate) AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform AC_CHECK_FUNCS(getattrlist) AC_CHECK_FUNCS(getcwd) AC_CHECK_FUNCS(getgidx) AC_CHECK_FUNCS(getgrnam) AC_CHECK_FUNCS(getgrnam_r) AC_CHECK_FUNCS(getgroups) AC_CHECK_FUNCS(getpgid) AC_CHECK_FUNCS(getpgrp) AC_CHECK_FUNCS(getpriority) AC_CHECK_FUNCS(getpwnam_r) AC_CHECK_FUNCS(getresgid) AC_CHECK_FUNCS(getresuid) AC_CHECK_FUNCS(getrlimit) AC_CHECK_FUNCS(getsid) AC_CHECK_FUNCS(gettimeofday) # for making ac_cv_func_gettimeofday AC_CHECK_FUNCS(getuidx) AC_CHECK_FUNCS(gmtime_r) AC_CHECK_FUNCS(initgroups) AC_CHECK_FUNCS(ioctl) AC_CHECK_FUNCS(isfinite) AC_CHECK_FUNCS(issetugid) AC_CHECK_FUNCS(killpg) AC_CHECK_FUNCS(lchmod) AC_CHECK_FUNCS(lchown) AC_CHECK_FUNCS(link) AC_CHECK_FUNCS(llabs) AC_CHECK_FUNCS(lockf) AC_CHECK_FUNCS(log2) AC_CHECK_FUNCS(lstat) AC_CHECK_FUNCS(lutimes) AC_CHECK_FUNCS(malloc_usable_size) AC_CHECK_FUNCS(malloc_size) AC_CHECK_FUNCS(mblen) AC_CHECK_FUNCS(memalign) AC_CHECK_FUNCS(memset_s) AC_CHECK_FUNCS(writev) AC_CHECK_FUNCS(memrchr) AC_CHECK_FUNCS(memmem) AC_CHECK_FUNCS(mkfifo) AC_CHECK_FUNCS(mknod) AC_CHECK_FUNCS(mktime) AC_CHECK_FUNCS(openat) AC_CHECK_FUNCS(pipe2) AC_CHECK_FUNCS(poll) AC_CHECK_FUNCS(posix_fadvise) AC_CHECK_FUNCS(posix_memalign) AC_CHECK_FUNCS(ppoll) AC_CHECK_FUNCS(pread) AC_CHECK_FUNCS(pwrite) AC_CHECK_FUNCS(qsort_r) AC_CHECK_FUNCS(qsort_s) AC_CHECK_FUNCS(readlink) AC_CHECK_FUNCS(round) AC_CHECK_FUNCS(sched_getaffinity) AC_CHECK_FUNCS(seekdir) AC_CHECK_FUNCS(select_large_fdset) AC_CHECK_FUNCS(sendfile) AC_CHECK_FUNCS(setegid) AC_CHECK_FUNCS(setenv) AC_CHECK_FUNCS(seteuid) AC_CHECK_FUNCS(setgid) AC_CHECK_FUNCS(setgroups) AC_CHECK_FUNCS(setpgid) AC_CHECK_FUNCS(setpgrp) AC_CHECK_FUNCS(setregid) AC_CHECK_FUNCS(setresgid) AC_CHECK_FUNCS(setresuid) AC_CHECK_FUNCS(setreuid) AC_CHECK_FUNCS(setrgid) AC_CHECK_FUNCS(setrlimit) AC_CHECK_FUNCS(setruid) AC_CHECK_FUNCS(setsid) AC_CHECK_FUNCS(setuid) AC_CHECK_FUNCS(shutdown) AC_CHECK_FUNCS(sigaction) AC_CHECK_FUNCS(sigaltstack) AC_CHECK_FUNCS(sigprocmask) AC_CHECK_FUNCS(sinh) AC_CHECK_FUNCS(spawnv) AC_CHECK_FUNCS(symlink) AC_CHECK_FUNCS(syscall) AC_CHECK_FUNCS(sysconf) AC_CHECK_FUNCS(tanh) AC_CHECK_FUNCS(telldir) AC_CHECK_FUNCS(timegm) AC_CHECK_FUNCS(times) AC_CHECK_FUNCS(truncate) AC_CHECK_FUNCS(truncate64) # used for Win32 AC_CHECK_FUNCS(unsetenv) AC_CHECK_FUNCS(utimensat) AC_CHECK_FUNCS(utimes) AC_CHECK_FUNCS(wait4) AC_CHECK_FUNCS(waitpid)
AS_IF([test “$ac_cv_func_memset_s” = yes],
[RUBY_DEFINE_IF([!defined __STDC_WANT_LIB_EXT1__], [__STDC_WANT_LIB_EXT1__], 1)])
AS_IF([test “$ac_cv_func_getcwd” = yes], [
AC_CACHE_CHECK(if getcwd allocates buffer if NULL is given, [rb_cv_getcwd_malloc], [AC_TRY_RUN([
@%:@include <stddef.h> @%:@include <stdio.h> @%:@ifdef HAVE_UNISTD_H @%:@include <unistd.h> @%:@endif @%:@ifndef EXIT_SUCCESS @%:@define EXIT_SUCCESS 0 @%:@endif @%:@ifndef EXIT_FAILURE @%:@define EXIT_FAILURE 1 @%:@endif
int main(int argc, char **argv) {
if (!getcwd(NULL, 0)) return EXIT_FAILURE; return EXIT_SUCCESS;
} ],
rb_cv_getcwd_malloc=yes, rb_cv_getcwd_malloc=no, AS_CASE($target_os, [linux*|darwin*|*bsd|cygwin*|mingw*|mswin*], [rb_cv_getcwd_malloc=yes], [rb_cv_getcwd_malloc=no]))]) AS_IF([test "$rb_cv_getcwd_malloc" = no], [AC_DEFINE(NO_GETCWD_MALLOC, 1)])
])
AS_IF([test “$ac_cv_func_crypt_r” = yes],
[AC_CHECK_HEADERS(crypt.h)])
AS_IF([test “$ac_cv_func_crypt_r:$ac_cv_header_crypt_h” = yes:yes],
[AC_CHECK_MEMBERS([struct crypt_data.initialized], [], [], [AC_INCLUDES_DEFAULT([@%:@include <crypt.h>])])])
AC_DEFUN(, [dnl AC_CACHE_CHECK([for $1], AS_TR_SH(rb_cv_builtin_$1),
[AC_LINK_IFELSE( [AC_LANG_PROGRAM([int foo;], [$2;])], [AS_TR_SH(rb_cv_builtin_$1)=yes], [AS_TR_SH(rb_cv_builtin_$1)=no])])
AS_IF([test “${AS_TR_SH(rb_cv_builtin_$1)}” != no], [
AC_DEFINE(AS_TR_CPP(HAVE_BUILTIN_$1))
])]) RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap16, [__builtin_bswap16(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap32, [__builtin_bswap32(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap64, [__builtin_bswap64(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_popcount, [__builtin_popcount(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_popcountll, [__builtin_popcountll(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_clz, [__builtin_clz(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_clzl, [__builtin_clzl(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_clzll, [__builtin_clzll(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_ctz, [__builtin_ctz(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_ctzll, [__builtin_ctzll(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_add_overflow, [int x;__builtin_add_overflow(0,0,&x)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_sub_overflow, [int x;__builtin_sub_overflow(0,0,&x)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_mul_overflow, [int x;__builtin_mul_overflow(0,0,&x)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_mul_overflow_p, [__builtin_mul_overflow_p(0,0,(int)0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_constant_p, [__builtin_constant_p(0)]) RUBY_CHECK_BUILTIN_FUNC(__builtin_choose_expr, [
[int x[__extension__(__builtin_choose_expr(1, 1, -1))]]; [int y[__extension__(__builtin_choose_expr(0, -1, 1))]]; ])
AS_IF([test x$rb_cv_builtin___builtin_choose_expr = xyes], [
RUBY_CHECK_BUILTIN_FUNC(__builtin_choose_expr_constant_p, [ [int x[__extension__(__builtin_choose_expr(__builtin_constant_p(1), 1, -1))]]; [int y[__extension__(__builtin_choose_expr(__builtin_constant_p(foo), -1, 1))]]; ])
]) RUBY_CHECK_BUILTIN_FUNC(__builtin_types_compatible_p, [__builtin_types_compatible_p(int, int)])
AS_IF([test “$ac_cv_func_qsort_r” != no], [
AC_CACHE_CHECK(whether qsort_r is GNU version, rb_cv_gnu_qsort_r, [AC_TRY_COMPILE([
@%:@include <stdlib.h> void qsort_r(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *, void *), void *arg);
],[ ],
[rb_cv_gnu_qsort_r=yes], [rb_cv_gnu_qsort_r=no]) ]) AC_CACHE_CHECK(whether qsort_r is BSD version, rb_cv_bsd_qsort_r, [AC_TRY_COMPILE([
@%:@include <stdlib.h> void qsort_r(void *base, size_t nmemb, size_t size,
void *arg, int (*compar)(void *, const void *, const void *));
],[ ],
[rb_cv_bsd_qsort_r=yes], [rb_cv_bsd_qsort_r=no]) ]) AS_CASE("$rb_cv_gnu_qsort_r:$rb_cv_bsd_qsort_r", [yes:no], [ AC_DEFINE(HAVE_GNU_QSORT_R, 1) ], [no:yes], [ AC_DEFINE(HAVE_BSD_QSORT_R, 1) ])
])
AC_CACHE_CHECK(whether atan2 handles Inf as C99, rb_cv_atan2_inf_c99, [
AS_IF([test $ac_cv_func_atan2f:$ac_cv_func_atan2l = yes:yes], [ AC_TRY_RUN([
@%:@include <math.h> @%:@ifdef HAVE_UNISTD_H @%:@include <unistd.h> @%:@endif @%:@ifndef EXIT_SUCCESS @%:@define EXIT_SUCCESS 0 @%:@endif @%:@ifndef EXIT_FAILURE @%:@define EXIT_FAILURE 1 @%:@endif
int main(int argc, char **argv) {
if (fabs(atan2(INFINITY, INFINITY) - M_PI_4) <= 0.01) return EXIT_SUCCESS; return EXIT_FAILURE;
} ],
[rb_cv_atan2_inf_c99=yes], [rb_cv_atan2_inf_c99=no], [AS_CASE($target_os, [mingw*|mswin*], [rb_cv_atan2_inf_c99=no], [rb_cv_atan2_inf_c99=yes])] ) ], [rb_cv_atan2_inf_c99=no])
]) AS_IF([test “x$rb_cv_atan2_inf_c99” = xyes], [AC_DEFINE(ATAN2_INF_C99)])
# Some platform need -lrt for clock_gettime, but the other don't. AS_IF([test x“$ac_cv_func_clock_gettime” != xyes], [
# glibc 2.17 moves clock_* functions from librt to the main C library. # http://sourceware.org/ml/libc-announce/2012/msg00001.html AC_CHECK_LIB(rt, clock_gettime) AS_IF([test x"$ac_cv_lib_rt_clock_gettime" = xyes], [ AC_DEFINE(HAVE_CLOCK_GETTIME, 1) ])
]) AC_CHECK_FUNCS(clock_getres) # clock_getres should be tested after clock_gettime test including librt test.
AC_CACHE_CHECK(for unsetenv returns a value, rb_cv_unsetenv_return_value,
[AC_TRY_COMPILE([
include <stdlib.h> ], [int v = unsetenv(“foo”);],
rb_cv_unsetenv_return_value=yes, rb_cv_unsetenv_return_value=no)])
AS_IF([test “$rb_cv_unsetenv_return_value” = no], [
AC_DEFINE(VOID_UNSETENV)
])
# used for AC_ARG_WITH(setjmp-type) AC_DEFUN(, [ AC_CACHE_CHECK([for ]$1[ as a macro or function], ac_cv_func_$1,
[AC_TRY_COMPILE([
@%:@include <setjmp.h> ]AC_INCLUDES_DEFAULT()[ @%:@define JMPARGS_1 env @%:@define JMPARGS_2 env,1 @%:@define JMPARGS JMPARGS_]m4_ifval($2,2,1)[ ],
m4_ifval($2,$2,jmp_buf)[ env; $1(JMPARGS);], ac_cv_func_$1=yes, ac_cv_func_$1=no)]
) AS_IF([test “$ac_cv_func_]$1[” = yes], [AC_DEFINE(AS_TR_CPP($1), 1)]) ])
AC_DEFUN(, [ AS_IF([test x“${ac_cv_func___builtin_setjmp}” = xyes], [
unset ac_cv_func___builtin_setjmp
]) AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
[ ac_cv_func___builtin_setjmp=no for cast in "" "(void **)"; do RUBY_WERROR_FLAG( [AC_TRY_LINK([@%:@include <setjmp.h> @%:@include <stdio.h> jmp_buf jb; @%:@ifdef NORETURN NORETURN(void t(void)); @%:@endif void t(void) {__builtin_longjmp($cast jb, 1);} int jump(void) {(void)(__builtin_setjmp($cast jb) ? 1 : 0); return 0;}], [ void (*volatile f)(void) = t; if (!jump()) printf("%d\n", f != 0); ], [ac_cv_func___builtin_setjmp="yes with cast ($cast)"]) ]) test "$ac_cv_func___builtin_setjmp" = no || break done])
])
AC_DEFUN(, [ RUBY_CHECK_BUILTIN_SETJMP RUBY_CHECK_SETJMP(_setjmpex, [], [@%:@include <setjmpex.h>]) RUBY_CHECK_SETJMP(_setjmp) RUBY_CHECK_SETJMP(sigsetjmp, [sigjmp_buf]) AC_MSG_CHECKING(for setjmp type) setjmp_suffix= unset setjmp_sigmask AC_ARG_WITH(setjmp-type,
AS_HELP_STRING([--with-setjmp-type], [select setjmp type]), [ AS_CASE([$withval], [__builtin_setjmp], [setjmp=__builtin_setjmp], [_setjmp], [ setjmp_prefix=_], [sigsetjmp,*], [ setjmp_prefix=sig setjmp_sigmask=`expr "$withval" : 'sigsetjmp\(,.*\)'`], [sigsetjmp], [ setjmp_prefix=sig], [setjmp], [ setjmp_prefix=], [setjmpex], [ setjmp_prefix= setjmp_suffix=ex], [''], [ unset setjmp_prefix], [ AC_MSG_ERROR(invalid setjmp type: $withval)])], [unset setjmp_prefix])
setjmp_cast= AS_IF([test ${setjmp_prefix+set}], [
AS_IF([test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp${setjmp_suffix} = no], [ AC_MSG_ERROR(${setjmp_prefix}setjmp${setjmp_suffix} is not available) ])
], [{ AS_CASE(“$ac_cv_func___builtin_setjmp”, [yes*], [true], [false]) }], [
setjmp_cast=`expr "$ac_cv_func___builtin_setjmp" : "yes with cast (\(.*\))"` setjmp_prefix=__builtin_ setjmp_suffix=
], [test “$ac_cv_header_setjmpex_h:$ac_cv_func__setjmpex” = yes:yes], [
setjmp_prefix= setjmp_suffix=ex
], [test “$ac_cv_func__setjmp” = yes], [
setjmp_prefix=_ setjmp_suffix=
], [test “$ac_cv_func_sigsetjmp” = yes], [
AS_CASE([$target_os],[solaris*|cygwin*],[setjmp_prefix=],[setjmp_prefix=sig]) setjmp_suffix=
], [
setjmp_prefix= setjmp_suffix=
]) AS_IF([test x$setjmp_prefix:$setjmp_sigmask = xsig:], [
setjmp_sigmask=,0
]) AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix}${setjmp_cast:+($setjmp_cast)}${setjmp_sigmask}) AC_DEFINE_UNQUOTED(, [${setjmp_prefix}setjmp${setjmp_suffix}($setjmp_cast(env)${setjmp_sigmask})]) AC_DEFINE_UNQUOTED(, [${setjmp_prefix}longjmp($setjmp_cast(env),val)]) AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf) AS_IF([test x$setjmp_suffix = xex], [AC_DEFINE_UNQUOTED(RUBY_USE_SETJMPEX, 1)]) ]) # End of setjmp check.
AC_ARG_ENABLE(setreuid,
AS_HELP_STRING([--enable-setreuid], [use setreuid()/setregid() according to need even if obsolete]), [use_setreuid=$enableval])
AS_IF([test “$use_setreuid” = yes], [
AC_DEFINE(USE_SETREUID) AC_DEFINE(USE_SETREGID)
]) AC_STRUCT_TIMEZONE AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
[AC_TRY_COMPILE([
@%:@define _BSD_SOURCE @%:@define _DEFAULT_SOURCE @%:@include <time.h>
], [struct tm t; t.tm_gmtoff = 3600;], [rb_cv_member_struct_tm_tm_gmtoff=yes], [rb_cv_member_struct_tm_tm_gmtoff=no])])
AS_IF([test “$rb_cv_member_struct_tm_tm_gmtoff” = yes], [
AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF)
]) AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
[AC_TRY_LINK([#include <time.h> int i;], [i = daylight;], rb_cv_have_daylight=yes, rb_cv_have_daylight=no)])
AS_IF([test “$rb_cv_have_daylight” = yes], [
AC_DEFINE(HAVE_DAYLIGHT)
])
AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
[AC_TRY_RUN([
include <stdlib.h> include <time.h>
void check(tm, y, m, d, h, s)
struct tm *tm; int y, m, d, h, s;
{
if (!tm || tm->tm_year != y || tm->tm_mon != m-1 || tm->tm_mday != d || tm->tm_hour != h || tm->tm_sec != s) { exit(1); }
}
int main() {
time_t t = -1; struct tm *tm; check(gmtime(&t), 69, 12, 31, 23, 59); t = ~(time_t)0 << 31; check(gmtime(&t), 1, 12, 13, 20, 52); return 0;
} ],
rb_cv_negative_time_t=yes, rb_cv_negative_time_t=no, rb_cv_negative_time_t=yes)])
AS_IF([test “$rb_cv_negative_time_t” = yes], [
AC_DEFINE(NEGATIVE_TIME_T)
])
# [ruby-dev:40910] overflow of time on FreeBSD # www.freebsd.org/cgi/query-pr.cgi?pr=145341 AC_CACHE_CHECK(for localtime(3) overflow correctly, rb_cv_localtime_overflow,
[AC_TRY_RUN([
include <stdlib.h> include <time.h>
void check(time_t t1) {
struct tm *tm; time_t t2; tm = localtime(&t1); if (!tm) return; /* overflow detected. ok. */ t2 = mktime(tm); if (t1 == t2) return; /* round-trip. ok. */ exit(1);
}
int main() {
time_t t; if (~(time_t)0 <= 0) { t = (((time_t)1) << (sizeof(time_t) * 8 - 2)); t |= t - 1; } else { t = ~(time_t)0; } check(t); return 0;
} ],
rb_cv_localtime_overflow=yes, rb_cv_localtime_overflow=no, rb_cv_localtime_overflow=no)])
AS_IF([test “$rb_cv_localtime_overflow” = no], [
AC_DEFINE(LOCALTIME_OVERFLOW_PROBLEM)
])
AS_IF([test “$ac_cv_func_sigprocmask” = yes && test “$ac_cv_func_sigaction” = yes], [
AC_DEFINE(POSIX_SIGNAL)
], [
AC_CHECK_FUNCS(sigsetmask) AC_CACHE_CHECK(for BSD signal semantics, rb_cv_bsd_signal, [AC_TRY_RUN([
include <stdio.h> include <signal.h>
void sig_handler(dummy)
int dummy;
{ }
int main() {
signal(SIGINT, sig_handler); kill(getpid(), SIGINT); kill(getpid(), SIGINT); return 0;
} ],
rb_cv_bsd_signal=yes, rb_cv_bsd_signal=no, rb_cv_bsd_signal=$ac_cv_func_sigsetmask)]) AS_IF([test "$rb_cv_bsd_signal" = yes], [ AC_DEFINE(BSD_SIGNAL) ])
])
AC_CHECK_TYPES(,[],[],[@%:@include <signal.h>])
AS_IF([test “$ac_cv_func_getpgid” = no], [
# AC_FUNC_GETPGRP fails when cross-compiling with old autoconf. # autoconf is changed between 2.52d and 2.52f? # http://lists.gnu.org/archive/html/bug-gnu-utils/2001-09/msg00181.html # "autoconf cleanup for AC_FUNC_GETPGRP and GETPGRP_VOID"
AC_FUNC_GETPGRP ]) AS_IF([test “$ac_cv_func_setpgid:$ac_cv_func_setpgrp” = no:yes], [
# AC_FUNC_SETPGRP fails when cross-compiling. (until autoconf 2.69?) # https://lists.gnu.org/archive/html/bug-autoconf/2013-02/msg00002.html # "AC_FUNC_SETPGRP fails to work properly when cross-compiling"
AC_FUNC_SETPGRP ])
AS_IF([test x“$ac_cv_func_dirfd” = xno], [
AS_CASE(["$target_os"],[solaris*], [AC_CHECK_MEMBERS([DIR.d_fd, DIR.dd_fd],,,[
include <sys/types.h> include <dirent.h> ])]) ])
AS_IF([test x“$target_cpu” = xia64], [
AC_LIBOBJ([ia64]) AC_CACHE_CHECK(for __libc_ia64_register_backing_store_base, rb_cv___libc_ia64_register_backing_store_base, [rb_cv___libc_ia64_register_backing_store_base=no AC_TRY_LINK( [extern unsigned long __libc_ia64_register_backing_store_base;], [unsigned long p = __libc_ia64_register_backing_store_base; printf("%ld\n", p);], [rb_cv___libc_ia64_register_backing_store_base=yes])]) AS_IF([test $rb_cv___libc_ia64_register_backing_store_base = yes], [ AC_DEFINE(HAVE___LIBC_IA64_REGISTER_BACKING_STORE_BASE) ])
])
AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [(-1==(-1>>1))])], rb_cv_rshift_sign=yes, rb_cv_rshift_sign=no)])
AS_IF([test “$rb_cv_rshift_sign” = yes], [
AC_DEFINE(RSHIFT(x,y), ((x)>>(int)(y)))
], [
AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>(int)(y)) : (x)>>(int)(y)))
])
AS_IF([test x“$ac_cv_func_gettimeofday” != xyes], [
AC_MSG_ERROR(gettimeofday() must exist)
])
AS_IF([test “$ac_cv_func_sysconf” = yes], [
AC_DEFUN([RUBY_CHECK_SYSCONF], [dnl AC_CACHE_CHECK([whether _SC_$1 is supported], rb_cv_have_sc_[]m4_tolower($1), [AC_TRY_COMPILE([#include <unistd.h> ], [_SC_$1 >= 0], rb_cv_have_sc_[]m4_tolower($1)=yes, rb_cv_have_sc_[]m4_tolower($1)=no) ]) AS_IF([test "$rb_cv_have_sc_[]m4_tolower($1)" = yes], [ AC_DEFINE(HAVE__SC_$1) ]) ]) RUBY_CHECK_SYSCONF(CLK_TCK)
])
AC_DEFUN(, [
AS_VAR_PUSHDEF([stack_grow_dir], [rb_cv_stack_grow_dir_$1]) AC_CACHE_CHECK(stack growing direction on $1, stack_grow_dir, [
AS_CASE(, [m68*|x86*|x64|i?86|ia64|ppc*|sparc*|alpha*], [ $2=-1], [hppa*], [ $2=+1], [
AC_TRY_RUN([
/* recurse to get rid of inlining */ static int stack_growup_p(addr, n)
volatile int *addr, n;
{
volatile int end; if (n > 0) return *addr = stack_growup_p(addr, n - 1); else return (&end > addr);
} int main() {
int x; return stack_growup_p(&x, 10);
} ], $2=-1, $2=+1, $2=0)
])
eval stack_grow_dir=$$2]) eval $2=$stack_grow_dir AS_VAR_POPDEF()]) AS_IF([test “${universal_binary-no}” = yes ], [
archflagpat=`eval echo '"'"${ARCH_FLAG}"'"' | sed 's/[[][|.*]]/\\&/g'` save_CFLAGS="$CFLAGS" new_cflags=`echo "$CFLAGS" | sed "s|$archflagpat"'||'` save_LDFLAGS="$LDFLAGS" new_ldflags=`echo "$LDFLAGS" | sed "s|$archflagpat"'||'` stack_dir= for archs in ${universal_archnames}; do archs=`echo $archs | sed 's/=.*//'` CFLAGS="$new_cflags -arch $archs" LDFLAGS="$new_ldflags -arch $archs" RUBY_STACK_GROW_DIRECTION($archs, dir) AS_IF([test x$stack_dir = x], [ stack_dir=$dir ], [test x$stack_dir != x$dir], [ stack_dir=no ]) done CFLAGS="$save_CFLAGS" LDFLAGS="$save_LDFLAGS" AS_IF([test x$stack_dir = xno], [ for archs in ${universal_archnames}; do archs=`echo $archs | sed 's/=.*//'` eval dir=\$[rb_cv_stack_grow_dir_]AS_TR_SH([$archs]) RUBY_DEFINE_IF([defined __${archs}__], STACK_GROW_DIRECTION, $dir) done ], [ AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $stack_dir) ])
], [
RUBY_STACK_GROW_DIRECTION($target_cpu, dir) AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $dir)
])
AS_IF([test x“$enable_pthread” = xyes], [
for pthread_lib in thr pthread pthreads c c_r root; do AC_CHECK_LIB($pthread_lib, pthread_kill, rb_with_pthread=yes, rb_with_pthread=no) AS_IF([test "$rb_with_pthread" = "yes"], [ break; fi done AS_IF([test x"$rb_with_pthread" = xyes], [ AC_DEFINE(_REENTRANT) AC_DEFINE(_THREAD_SAFE) AC_DEFINE(HAVE_LIBPTHREAD) AC_CHECK_HEADERS(pthread_np.h, [], [], [@%:@include <pthread.h>]) AS_CASE([$pthread_lib], [c], [], [root], [], [c_r], [MAINLIBS="-pthread $MAINLIBS"], [AS_CASE(["$target_os"], [openbsd*|mirbsd*], [LIBS="-pthread $LIBS"], [LIBS="-l$pthread_lib $LIBS"])]) ], [ AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled") ]) AC_CACHE_CHECK([whether pthread_t is scalar type], [rb_cv_scalar_pthread_t], [ AC_TRY_COMPILE([ @%:@include <pthread.h> ], [ pthread_t thread_id; thread_id = 0; if (!thread_id) return 0; ], [rb_cv_scalar_pthread_t=yes], [rb_cv_scalar_pthread_t=no]) ]) AS_IF([test x"$rb_cv_scalar_pthread_t" = xyes], [ : # RUBY_CHECK_SIZEOF(pthread_t, [void* int long], [], [@%:@include <pthread.h>]) ], [ AC_DEFINE(NON_SCALAR_THREAD_ID) ]) AC_CHECK_FUNCS(sched_yield pthread_attr_setinheritsched \ pthread_attr_get_np pthread_attr_getstack pthread_attr_init \ pthread_get_stackaddr_np pthread_get_stacksize_np \ thr_stksegment pthread_stackseg_np pthread_getthrds_np \ pthread_cond_init pthread_condattr_setclock pthread_condattr_init \ pthread_sigmask pthread_setname_np pthread_set_name_np) AS_CASE(["$target_os"],[aix*],[ac_cv_func_pthread_getattr_np=no],[AC_CHECK_FUNCS(pthread_getattr_np)]) set_current_thread_name= AS_IF([test "$ac_cv_func_pthread_setname_np" = yes], [ AC_CACHE_CHECK([arguments of pthread_setname_np], [rb_cv_func_pthread_setname_np_arguments], [rb_cv_func_pthread_setname_np_arguments= # Linux,AIX, (pthread_self(), name) # NetBSD (pthread_self(), name, \"%s\") # Darwin (name) for mac in \ "(pthread_self(), name)" \ "(pthread_self(), name, \"%s\")" \ "(name)" \ ; do AC_TRY_COMPILE([ @%:@include <pthread.h> @%:@ifdef HAVE_PTHREAD_NP_H @%:@include <pthread_np.h> @%:@endif @%:@define SET_THREAD_NAME(name) pthread_setname_np${mac} ], [if (SET_THREAD_NAME("conftest")) return 1;], [rb_cv_func_pthread_setname_np_arguments="${mac}" break]) done ] ) AS_IF([test -n "${rb_cv_func_pthread_setname_np_arguments}"], [ set_current_thread_name="pthread_setname_np${rb_cv_func_pthread_setname_np_arguments}" ]) ], [test "$ac_cv_func_pthread_set_name_np" = yes], [ set_current_thread_name="pthread_set_name_np(pthread_self(), name)" ]) AS_IF([test -n "$set_current_thread_name"], [ AC_DEFINE_UNQUOTED(SET_CURRENT_THREAD_NAME(name), $set_current_thread_name) AS_CASE([$set_current_thread_name], [*'pthread_self()'*], [ set_another_thread_name=`echo "$set_current_thread_name" | sed 's/pthread_self()/thid/'` AC_DEFINE_UNQUOTED(SET_ANOTHER_THREAD_NAME(thid,name), $set_another_thread_name) ]) ])
])
AS_IF([test x“$ac_cv_header_ucontext_h” = xno], [
AC_CACHE_CHECK([if signal.h defines ucontext_t], [rb_cv_ucontext_in_signal_h], [AC_TRY_COMPILE([@%:@include <signal.h>], [size_t size = sizeof(ucontext_t);], [rb_cv_ucontext_in_signal_h=yes], [rb_cv_ucontext_in_signal_h=no])]) AS_IF([test x"$rb_cv_ucontext_in_signal_h" = xyes], [ AC_DEFINE_UNQUOTED(UCONTEXT_IN_SIGNAL_H, 1) ])
]) AS_IF([test x“$ac_cv_header_ucontext_h” = xyes -o x“$rb_cv_ucontext_in_signal_h” = xyes], [
AC_CACHE_CHECK([if mcontext_t is a pointer], [rb_cv_mcontext_t_ptr], [AC_TRY_COMPILE([ @%:@include <signal.h> @%:@ifdef HAVE_UCONTEXT_H @%:@include <ucontext.h> @%:@endif mcontext_t test(mcontext_t mc) {return mc+1;} ], [test(0);], [rb_cv_mcontext_t_ptr=yes], [rb_cv_mcontext_t_ptr=no])]) AS_IF([test x"$rb_cv_mcontext_t_ptr" = xyes], [ AC_DEFINE_UNQUOTED(DEFINE_MCONTEXT_PTR(mc, uc), mcontext_t mc = (uc)->uc_mcontext) ], [ AC_DEFINE_UNQUOTED(DEFINE_MCONTEXT_PTR(mc, uc), mcontext_t *mc = &(uc)->uc_mcontext) ]) AS_IF([test x"$rb_with_pthread" = xyes], [ AC_CHECK_FUNCS(getcontext setcontext) ])
])
AS_IF([test “$ac_cv_func_fork_works” = “yes” -a “$rb_with_pthread” = “yes”], [
AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread, [AC_TRY_RUN([
include <stdlib.h> include <unistd.h> include <pthread.h> include <stdio.h> include <sys/types.h> include <sys/wait.h> include <signal.h> ifndef EXIT_SUCCESS define EXIT_SUCCESS 0 endif ifndef EXIT_FAILURE define EXIT_FAILURE 1 endif
void * thread_func(void *dmy) {
return dmy;
}
int use_threads(void) {
pthread_t tid; if (pthread_create(&tid, 0, thread_func, 0) != 0) { return -1; } if (pthread_join(tid, 0) != 0) { return -1; } return 0;
}
int main(int argc, char *argv[]) {
pid_t pid; if (use_threads()) return EXIT_FAILURE; pid = fork(); if (pid) { int loc; sleep(1); if (waitpid(pid, &loc, WNOHANG) == 0) { kill(pid, SIGKILL); return EXIT_FAILURE; } if (!WIFEXITED(loc) || WEXITSTATUS(loc) != EXIT_SUCCESS) return EXIT_FAILURE; } else { if (use_threads()) return EXIT_FAILURE; } return EXIT_SUCCESS;
}],
rb_cv_fork_with_pthread=yes, rb_cv_fork_with_pthread=no, rb_cv_fork_with_pthread=yes)]) test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
])
} { # runtime section
dnl wheather use dln_a_out or not AC_ARG_WITH(dln-a-out,
AS_HELP_STRING([--with-dln-a-out], [use dln_a_out if possible]), [ AS_CASE([$withval], [yes], [ AS_IF([test "$enable_shared" = yes], [ AC_MSG_ERROR(dln_a_out can not make shared library) ]) with_dln_a_out=yes], [ with_dln_a_out=no])], [with_dln_a_out=no])
AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf, [AC_TRY_LINK([],, [ AS_CASE([“`head -1 conftest$EXEEXT | tr -dc '177ELF' | tr '177' .`”], [.ELF*], [rb_cv_binary_elf=yes], [rb_cv_binary_elf=no])], rb_cv_binary_elf=no)])
AS_IF([test “$rb_cv_binary_elf” = yes], [
AC_DEFINE(USE_ELF) AS_IF([test "$with_dln_a_out" = yes], [ AC_MSG_ERROR(dln_a_out does not work with ELF) ]) AC_CHECK_HEADERS([elf.h elf_abi.h]) AS_IF([test $ac_cv_header_elf_h = yes -o $ac_cv_header_elf_abi_h = yes], [ AC_LIBOBJ([addr2line]) ])
])
AS_CASE(, [linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu], [
AS_IF([test "$rb_cv_binary_elf" = no], [ with_dln_a_out=yes ], [ LDFLAGS="$LDFLAGS -rdynamic" ])])
LIBEXT=a
AC_SUBST(DLDFLAGS)dnl AC_SUBST(ARCH_FLAG)dnl
AC_SUBST(STATIC)dnl AC_SUBST(CCDLFLAGS)dnl AC_SUBST(LDSHARED)dnl AC_SUBST(LDSHAREDXX)dnl AC_SUBST(DLEXT)dnl AC_SUBST(DLEXT2)dnl AC_SUBST(LIBEXT)dnl AC_SUBST(ASMEXT, S)dnl
STATIC=
AS_IF([test “$with_dln_a_out” != yes], [
rb_cv_dlopen=unknown AC_MSG_CHECKING(whether OS depend dynamic link works) AS_IF([test "$GCC" = yes], [ AS_CASE(["$target_os"], [darwin*], [ # The -fno-common is needed if we wish to embed the Ruby interpreter # into a plugin module of some project (as opposed to embedding it # within the project's application). The -I/usr/local/include is # needed because CPP as discovered by configure (cc -E -traditional) # fails to consult /usr/local/include by default. This causes # mkmf.rb's have_header() to fail if the desired resource happens to be # installed in the /usr/local tree. RUBY_APPEND_OPTION(CCDLFLAGS, -fno-common)], [bsdi*|cygwin*|mingw*|aix*|interix*], [ ], [ RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)]) ], [ AS_CASE(["$target_os"], [hpux*], [CCDLFLAGS="$CCDLFLAGS +Z"], [solaris*|irix*], [CCDLFLAGS="$CCDLFLAGS -KPIC"], [sunos*], [CCDLFLAGS="$CCDLFLAGS -PIC"], [esix*|uxpds*], [CCDLFLAGS="$CCDLFLAGS -KPIC"], [: ${CCDLFLAGS=""}]) ]) AC_ARG_ENABLE(rpath, AS_HELP_STRING([--enable-rpath], [embed run path into extension libraries. enabled by default on ELF platforms]), [enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"]) AS_CASE(["$target_os"], [hpux*], [ DLDFLAGS="$DLDFLAGS -E" : ${LDSHARED='$(LD) -b'} XLDFLAGS="$XLDFLAGS -Wl,-E" : ${LIBPATHENV=SHLIB_PATH} rb_cv_dlopen=yes], [solaris*], [ AS_IF([test "$GCC" = yes], [ : ${LDSHARED='$(CC) -shared'} AS_IF([test "$rb_cv_prog_gnu_ld" = yes], [ LDFLAGS="$LDFLAGS -Wl,-E" ]) ], [ : ${LDSHARED='$(CC) -G'} ]) AS_IF([test "$ac_cv_sizeof_voidp" = 8], [ : ${LIBPATHENV=LD_LIBRARY_PATH_64} : ${PRELOADENV=LD_PRELOAD_64} ], [ : ${LIBPATHENV=LD_LIBRARY_PATH_32} : ${PRELOADENV=LD_PRELOAD_32} ]) rb_cv_dlopen=yes], [sunos*], [ : ${LDSHARED='$(LD) -assert nodefinitions'} rb_cv_dlopen=yes], [irix*], [ : ${LDSHARED='$(LD) -shared'} rb_cv_dlopen=yes], [sysv4*], [ : ${LDSHARED='$(LD) -G'} rb_cv_dlopen=yes], [nto-qnx*], [ : ${LDSHARED='$(CC) -shared'} rb_cv_dlopen=yes], [esix*|uxpds*], [ : ${LDSHARED='$(LD) -G'} rb_cv_dlopen=yes], [osf*], [ : ${LDSHARED='$(LD) -shared -expect_unresolved "*"'} rb_cv_dlopen=yes], [bsdi3*], [ AS_CASE(["$CC"], [*shlicc*], [ : ${LDSHARED='$(CC) -r'} rb_cv_dlopen=yes])], [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | haiku*], [ : ${LDSHARED='$(CC) -shared'} AS_IF([test "$rb_cv_binary_elf" = yes], [ LDFLAGS="$LDFLAGS -Wl,-export-dynamic" ]) rb_cv_dlopen=yes], [interix*], [ : ${LDSHARED='$(CC) -shared'} XLDFLAGS="$XLDFLAGS -Wl,-E" LIBPATHFLAG=" -L%1\$-s" rb_cv_dlopen=yes], [freebsd*|dragonfly*], [ : ${LDSHARED='$(CC) -shared'} AS_IF([test "$rb_cv_binary_elf" = yes], [ LDFLAGS="$LDFLAGS -rdynamic" DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@' ], [ test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable' ]) rb_cv_dlopen=yes], [openbsd*|mirbsd*], [ : ${LDSHARED='$(CC) -shared ${CCDLFLAGS}'} AS_IF([test "$rb_cv_binary_elf" = yes], [ LDFLAGS="$LDFLAGS -Wl,-E" ]) rb_cv_dlopen=yes], [darwin*], [ : ${LDSHARED='$(CC) -dynamic -bundle'} : ${LDFLAGS=""} : ${LIBPATHENV=DYLD_LIBRARY_PATH} : ${PRELOADENV=DYLD_INSERT_LIBRARIES} rb_cv_dlopen=yes], [aix*], [ : ${LDSHARED='$(CC)'} LDSHARED="$LDSHARED ${linker_flag}-G" EXTDLDFLAGS='-e$(TARGET_ENTRY)' XLDFLAGS="${linker_flag}"'-bE:$(ARCHFILE)'" ${linker_flag}-brtl" XLDFLAGS="$XLDFLAGS ${linker_flag}-blibpath:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}" : ${ARCHFILE="ruby.imp"} TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)' TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)' : ${LIBPATHENV=LIBPATH} rb_cv_dlopen=yes], [nto-qnx*], [ DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib" : ${LDSHARED='$(LD) -Bshareable -x'} LDFLAGS="$LDFLAGS -L/lib -L/usr/lib -L/usr/local/lib" rb_cv_dlopen=yes], [cygwin*|mingw*], [ : ${LDSHARED='$(CC) -shared'} XLDFLAGS="$XLDFLAGS -Wl,--stack,0x00200000,--enable-auto-import" DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import" : ${LIBPATHENV=PATH} : ${PRELOADENV=""} rb_cv_dlopen=yes], [hiuxmpp], [ : ${LDSHARED='$(LD) -r'}], [atheos*], [ : ${LDSHARED='$(CC) -shared'} rb_cv_dlopen=yes], [ : ${LDSHARED='$(LD)'}]) AC_MSG_RESULT($rb_cv_dlopen) AS_IF([test "$rb_cv_dlopen" = yes], [ AS_CASE(["$target_os"], [darwin*], [ for flag in \ "-undefined dynamic_lookup" \ "-multiply_defined suppress" \ ; do test "x${linker_flag}" = x || flag="${linker_flag}`echo ${flag} | tr ' ' ,`" RUBY_TRY_LDFLAGS([$flag], [], [flag=]) AS_IF([test "x$flag" != x], [ RUBY_APPEND_OPTIONS(DLDFLAGS, [$flag]) ]) done ]) ]) AS_IF([test "$enable_rpath:${RPATHFLAG}" = yes:], [ AS_IF([test "x$rpathflag" != x], [ RPATHFLAG=" ${rpathflag}%1\$-s" ]) ])
]) AS_IF([test “${LDSHAREDXX}” = “”], [
AS_CASE(["${LDSHARED}"], [*'$(CC)'*], [ LDSHAREDXX=`echo "${LDSHARED}" | sed 's/\$(CC)/$(CXX)/'` ], [*'${CC}'*], [ LDSHAREDXX=`echo "${LDSHARED}" | sed 's/\${CC}/${CXX}/'` ], [*$CC*], [ LDSHAREDXX=`echo "${LDSHARED}" | sed "s|$CC|$CXX|"` ], [ld" "*], [ ])
]) AS_CASE(,[*'%1$'*],[: ${LIBPATHFLAG=' -L%1$-s'}],[: ${LIBPATHFLAG=' -L%s'}])
AC_SUBST(LINK_SO) AC_SUBST(LIBPATHFLAG) AC_SUBST(RPATHFLAG) AC_SUBST(LIBPATHENV, “${LIBPATHENV-LD_LIBRARY_PATH}”) AC_SUBST(PRELOADENV, “${PRELOADENV-LD_PRELOAD}”) AC_SUBST(TRY_LINK)
AS_IF([test “x$OPT_DIR” != x], [
pat=`echo "${LDFLAGS_OPTDIR}" | sed ['s/[][\\.*|]/\\\\&/']` LDFLAGS=`echo "${LDFLAGS}" | sed "s| ${pat}||"` val=`IFS="$PATH_SEPARATOR" for dir in $OPT_DIR; do echo x ${LIBPATHFLAG} ${RPATHFLAG} | sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g" done | tr '\012' ' ' | sed 's/ *$//'` AS_IF([test x"$val" != x], [ test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS " LDFLAGS="$LDFLAGS$val" test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS " DLDFLAGS="$DLDFLAGS$val" ]) LDFLAGS_OPTDIR="$val"
])
AS_CASE(, [freebsd*], [
AC_CHECK_LIB([procstat], [procstat_open_sysctl]) AS_IF([test "x$ac_cv_lib_procstat_procstat_open_sysctl" = xyes], [ AC_CHECK_FUNCS(procstat_getvmmap) ]) ])
AS_CASE(, [-darwin], [
AC_CHECK_HEADERS([execinfo.h]) AS_IF([test "x$ac_cv_header_execinfo_h" = xyes], [ AC_CHECK_LIB([execinfo], [backtrace]) AC_CHECK_HEADERS([libunwind.h]) ])],
[-freebsd|x86_64-netbsd*], [
AC_CHECK_HEADERS([execinfo.h]) AS_IF([test "x$ac_cv_header_execinfo_h" = xyes], [ AC_CHECK_LIB([execinfo], [backtrace]) AC_CHECK_LIB([unwind], [unw_backtrace]) ])])
AC_CHECK_FUNCS(backtrace)
AS_IF([test “x$ac_cv_func_backtrace” = xyes], [
AC_CACHE_CHECK(for broken backtrace, rb_cv_broken_backtrace, [AC_TRY_RUN([
include <unistd.h> include <stdio.h> include <stdlib.h> include <stdint.h> include <string.h> include <signal.h> include <execinfo.h>
define TRACE_SIZE 256
void sigsegv(int signum, siginfo_t *info, void *ctx){
void *trace[TRACE_SIZE]; int n = backtrace(trace, TRACE_SIZE); if (n > 0) { /*fprintf(stdout, "backtrace:%d\n",n);*/ } else { _exit(EXIT_FAILURE); } _exit(EXIT_SUCCESS);
} int main(void) {
volatile int *a = NULL; stack_t ss; ss.ss_sp = malloc(SIGSTKSZ); if (ss.ss_sp == NULL) { fprintf(stderr, "cannot allocate memory for sigaltstack\n"); return EXIT_FAILURE; } ss.ss_size = SIGSTKSZ; ss.ss_flags = 0; if (sigaltstack(&ss, NULL) == -1) { fprintf(stderr, "sigaltstack failed\n"); return EXIT_FAILURE; } struct sigaction sa; memset(&sa, 0, sizeof(struct sigaction)); sigemptyset(&sa.sa_mask); sa.sa_sigaction = sigsegv; sa.sa_flags |= SA_SIGINFO; sa.sa_flags |= SA_ONSTACK; sigaction(SIGSEGV, &sa, NULL); a[0] = 1; return EXIT_SUCCESS;
} ],
rb_cv_broken_backtrace=no, rb_cv_broken_backtrace=yes, rb_cv_broken_backtrace=no)]) AS_IF([test "$rb_cv_broken_backtrace" = yes], [ AC_DEFINE(BROKEN_BACKTRACE, 1) ])
])
AC_ARG_WITH(valgrind,
AS_HELP_STRING([--without-valgrind],[disable valgrind memcheck support]), [], with_valgrind=yes)
AS_IF([test x$with_valgrind != xno],
[AC_CHECK_HEADERS(valgrind/memcheck.h)])
dln_a_out_works=no AS_IF([test “$ac_cv_header_a_out_h” = yes], [
AS_IF([test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown], [ cat confdefs.h > config.h AC_CACHE_CHECK(whether matz's dln works, rb_cv_dln_a_out, [AC_TRY_COMPILE([
define USE_DLN_A_OUT include “dln.c” ],
[], rb_cv_dln_a_out=yes, rb_cv_dln_a_out=no)]) AS_IF([test "$rb_cv_dln_a_out" = yes], [ dln_a_out_works=yes AC_DEFINE(USE_DLN_A_OUT) ]) ])
])
AS_IF([test “$dln_a_out_works” = yes], [
AS_IF([test "$GCC" = yes], [ STATIC=-static ], [ STATIC=-Bstatic ]) DLEXT=so CCDLFLAGS=
], [
AS_CASE(["$target_os"], [hpux*], [ DLEXT=sl], [darwin*], [ SOEXT=dylib DLEXT=bundle], [cygwin*|mingw*|*djgpp*], [ LOAD_RELATIVE=1 SOEXT=dll DLEXT=so], [ DLEXT=so])
]) : ${SOEXT=“${DLEXT}”} AC_SUBST(SOEXT) AS_IF([test “$rb_cv_dlopen:$load_relative” = yes:yes], [
AS_IF([test "$ac_cv_func_dladdr" = yes], [ LOAD_RELATIVE=1 ])
]) AS_IF([test x“$LOAD_RELATIVE” = x1], [
load_relative=yes
], [
unset load_relative
])
len=2 # .rb n=`expr “$DLEXT” : '.*'`; test “$n” -gt “$len” && len=$n n=`expr “$DLEXT2” : '.*'`; test “$n” -gt “$len” && len=$n AC_DEFINE_UNQUOTED(DLEXT_MAXLEN, `expr $len + 1`) test “.$DLEXT” = “.” || AC_DEFINE_UNQUOTED(DLEXT, “.$DLEXT”) test “.$DLEXT2” = “.” || AC_DEFINE_UNQUOTED(DLEXT2, “.$DLEXT2”) AC_SUBST(DLEXT)
AS_IF([test “$with_dln_a_out” = yes], [
STRIP=true
], [
AC_CHECK_TOOL(STRIP, strip, :)dnl
])
[linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu], [ STRIP="$STRIP -S -x"], [darwin*], [ STRIP="$STRIP -A -n"])
AC_ARG_WITH(ext,
AC_HELP_STRING([--with-ext=EXTS], [pass to --with-ext option of extmk.rb]))
AC_ARG_WITH(out-ext,
AC_HELP_STRING([--with-out-ext=EXTS], [pass to --without-ext option of extmk.rb]))
EXTSTATIC= AC_SUBST(EXTSTATIC)dnl AC_ARG_WITH(static-linked-ext,
AS_HELP_STRING([--with-static-linked-ext], [link external modules statically]), [AS_CASE([$withval],[yes],[STATIC=;EXTSTATIC=static],[no],[],[EXTSTATIC="$withval"])])
AS_CASE(, [,static,|*,enc,*], [
ENCOBJS='enc/encinit.$(OBJEXT) enc/libenc.$(LIBEXT) enc/libtrans.$(LIBEXT)' EXTOBJS='ext/extinit.$(OBJEXT)' AC_DEFINE_UNQUOTED(EXTSTATIC, 1) AC_SUBST(ENCSTATIC, static)
], [
ENCOBJS='dmyenc.$(OBJEXT)' EXTOBJS='dmyext.$(OBJEXT)'
]) AC_SUBST(ENCOBJS) AC_SUBST(EXTOBJS)
AC_ARG_WITH(setup,
AS_HELP_STRING([--with-setup=SETUP], [use extension libraries setup]), [setup=$withval])
AS_IF([test -n “$setup”], [
AS_IF([! test -f "ext/$setup" -o -f "$srcdir/ext/$setup"], [ AC_MSG_ERROR(Setup file $setup not found under ext or $srcdir/ext) ])
], [test -f “$srcdir/ext/Setup.$target_os”], [
setup="Setup.$target_os"
], [
setup= for file in "$srcdir"/ext/Setup.*; do AS_CASE(["$file"], [*~|*.bak|*.orig|*.rej|*.tmp], [continue]) setup=`basename "$file"` AS_CASE(["$target_os"], [`expr "$setup" : 'Setup.\(.*\)'`*], [break]) platform=`sed '/^option *platform */!d;s///;s/|/*|/g;q' "$file"` AS_IF([test "x$platform" != x], [ eval "AS_CASE([\"\$target_os\"], [$platform*], [break])" ]) setup= done : ${setup:=Setup}
]) AC_SUBST(setup)
rubylibprefix='${libdir}/${RUBY_BASE_NAME}' AC_ARG_WITH(rubylibprefix,
AS_HELP_STRING([--with-rubylibprefix=DIR], [prefix for ruby libraries [[LIBDIR/RUBY_BASE_NAME]]]), [AS_IF([test "x$withval" = xno], [ AC_MSG_ERROR([No ruby, No libprefix]) ]) rubylibprefix="$withval"])
AC_SUBST(rubylibprefix)
AS_IF([test x“${exec_prefix}” != xNONE], [
RUBY_EXEC_PREFIX="$exec_prefix"
], [test x“$prefix” != xNONE], [
RUBY_EXEC_PREFIX="$prefix"
], [
RUBY_EXEC_PREFIX=$ac_default_prefix
]) pat=`echo “${RUBY_EXEC_PREFIX}” | tr -c '012' .`'(.*)' for var in bindir libdir rubylibprefix; do
eval val='"$'$var'"' AS_CASE(["$val"], ["${RUBY_EXEC_PREFIX}"*], [val='${exec_prefix}'"`expr \"$val\" : \"$pat\"`"]) eval $var='"$val"'
done
BTESTRUBY='$(MINIRUBY)' AS_IF([test x“$cross_compiling” = xyes], [
test x"$MINIRUBY" = x && MINIRUBY="${RUBY-$BASERUBY} -I`$CHDIR .; pwd` "-r'$(arch)-fake' XRUBY_LIBDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["libdir"]']` XRUBY_RUBYLIBDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["rubylibdir"]']` XRUBY_RUBYHDRDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["rubyhdrdir"]']` AC_SUBST(XRUBY_LIBDIR) AC_SUBST(XRUBY_RUBYLIBDIR) AC_SUBST(XRUBY_RUBYHDRDIR) PREP='$(arch)-fake.rb' RUNRUBY_COMMAND='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`' RUNRUBY='$(RUNRUBY_COMMAND)' XRUBY='$(MINIRUBY)' BOOTSTRAPRUBY='$(BASERUBY)' TEST_RUNNABLE=no CROSS_COMPILING=yes
], [
MINIRUBY='./miniruby$(EXEEXT) -I$(srcdir)/lib -I.' MINIRUBY="$MINIRUBY"' -I$(EXTOUT)/common' PREP='miniruby$(EXEEXT)' RUNRUBY_COMMAND='$(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT)' RUNRUBY='$(RUNRUBY_COMMAND) --' XRUBY='$(RUNRUBY)' BOOTSTRAPRUBY='$(MINIRUBY)' TEST_RUNNABLE=yes CROSS_COMPILING=no
]) AC_SUBST(TEST_RUNNABLE) AC_SUBST(CROSS_COMPILING) AC_SUBST(MINIRUBY) AC_SUBST(BTESTRUBY) AC_SUBST(PREP) AC_SUBST(RUNRUBY_COMMAND) AC_SUBST(RUNRUBY) AC_SUBST(XRUBY) AC_SUBST(BOOTSTRAPRUBY) AC_SUBST(EXTOUT, [${EXTOUT=.ext}])
])RSTMAKEFILE=“” LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a' LIBRUBY='$(LIBRUBY_A)' LIBRUBYARG_STATIC='-l$(RUBY_SO_NAME)-static' LIBRUBYARG='$(LIBRUBYARG_STATIC)' SOLIBS=
[cygwin*|mingw*|haiku*|darwin*], [ : ${DLDLIBS=""} ], [ DLDLIBS="$DLDLIBS -lc" ])
AC_ARG_ENABLE(multiarch,
AS_HELP_STRING([--enable-multiarch], [enable multiarch compatible directories]), [multiarch=], [unset multiarch])
AS_IF([test ${multiarch+set}], [
AC_DEFINE(ENABLE_MULTIARCH)
])
archlibdir='${libdir}/${arch}' sitearchlibdir='${libdir}/${sitearch}' archincludedir='${includedir}/${arch}' sitearchincludedir='${includedir}/${sitearch}'
AC_ARG_WITH(soname,
AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]), [RUBY_SO_NAME=$withval], [ AS_CASE(["$target_os"], [darwin*], [ RUBY_SO_NAME='$(RUBY_BASE_NAME).$(RUBY_PROGRAM_VERSION)' ], [cygwin*], [ RUBY_SO_NAME='$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0' ], [mingw*], [ RUBY_SO_NAME="${rb_cv_msvcrt}"'-$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0' AS_IF([test x"${target_cpu}" != xi386], [ RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}" ]) ], [RUBY_SO_NAME='$(RUBY_BASE_NAME)']) ])
LIBRUBY_LDSHARED=$LDSHARED LIBRUBY_DLDFLAGS=$DLDFLAGS LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(RUBY_PROGRAM_VERSION)' LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(RUBY_API_VERSION)' LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(SOEXT)' ENABLE_SHARED=no
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared], [build a shared library for Ruby]), [enable_shared=$enableval])
libprefix=${multiarch+'$(archlibdir)'}${multiarch-'$(libdir)'} LIBRUBY_RELATIVE=${load_relative-no} AS_CASE(“$enable_shared”, [yes], [
LIBRUBY='$(LIBRUBY_SO)' LIBRUBYARG_SHARED='-l$(RUBY_SO_NAME)' LIBRUBYARG='$(LIBRUBYARG_SHARED)' LIBRUBY_RELATIVE=no test -z "$CCDLFLAGS" || CFLAGS="$CFLAGS $CCDLFLAGS" ENABLE_SHARED=yes AS_IF([test "$rb_cv_binary_elf" = yes], [ SOLIBS='$(LIBS)' ]) # libdir can be overridden in config.site file (on OpenSUSE at least). libdir_basename=lib AS_IF([test "$bindir" = '${exec_prefix}/bin'], [ AS_CASE(["$libdir"], ['${exec_prefix}/'*], [libdir_basename=`basename "$libdir"`]) ]) AC_DEFINE_UNQUOTED(LIBDIR_BASENAME, ["${libdir_basename}"]) libdir_basename="${libdir_basename}"${multiarch+'/${arch}'} AS_CASE(["$target_os"], [freebsd*|dragonfly*], [], [ AS_IF([test "$GCC" = yes], [ RUBY_TRY_LDFLAGS([${linker_flag}--no-undefined], [no_undefined=yes], [no_undefined=no]) AS_IF([test "no_undefined" = yes], [ RUBY_APPEND_OPTION(EXTLDFLAGS, [${linker_flag}--no-undefined]) ]) ]) ]) AS_CASE(["$target_os"], [sunos4*], [ LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' ], [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | haiku*], [ RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,$(LIBRUBY_SONAME)' "$LDFLAGS_OPTDIR"]) LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' AS_IF([test "$load_relative" = yes], [ libprefix="'\$\${ORIGIN}/../${libdir_basename}'" LIBRUBY_RPATHFLAGS="-Wl,-rpath,${libprefix}" LIBRUBY_RELATIVE=yes ]) ], [freebsd*|dragonfly*], [ SOLIBS='$(LIBS)' LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)' LIBRUBY_SONAME='$(LIBRUBY_SO)' AS_IF([test "$rb_cv_binary_elf" != "yes" ], [ LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)" LIBRUBY_ALIASES='' ]) ], [netbsd*], [ SOLIBS='$(LIBS)' LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)' LIBRUBY_SO="${LIBRUBY_SONAME}"'.$(TEENY)' RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,$(LIBRUBY_SONAME)' "$LDFLAGS_OPTDIR"]) AS_IF([test "$rb_cv_binary_elf" = yes], [ # ELF platforms LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' ], [ # a.out platforms LIBRUBY_ALIASES="" ]) ], [openbsd*|mirbsd*], [ SOLIBS='$(LIBS)' LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}` ], [solaris*], [ SOLIBS='$(LIBS)' LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)' LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(RUBY_PROGRAM_VERSION)' LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' AS_IF([test "$GCC" = yes], [ LIBRUBY_DLDFLAGS="$DLDFLAGS "'-Wl,-h,$(@F)' ], [ LIBRUBY_DLDFLAGS="$DLDFLAGS "'-h $(@F)' ]) XLDFLAGS="$XLDFLAGS "'-R${libdir}' ], [hpux*], [ XLDFLAGS="$XLDFLAGS "'-Wl,+s,+b,$(libdir)' LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' ], [aix*], [ RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ["${linker_flag}-bnoentry" "$XLDFLAGS" "$LDFLAGS_OPTDIR"]) LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}' SOLIBS='-lm -lc' ], [darwin*], [ LIBRUBY_LDSHARED='$(CC) -dynamiclib' AS_IF([test "$load_relative" = yes], [ libprefix="@executable_path/../${libdir_basename}" LIBRUBY_RELATIVE=yes ]) LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS -install_name ${libprefix}"'/$(LIBRUBY_SONAME)' LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-compatibility_version $(RUBY_API_VERSION)' LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(RUBY_PROGRAM_VERSION)' AS_IF([test "$visibility_option" = ld], [ LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_Init_*' LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_ruby_static_id_*' LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,*_threadptr_*' ]) LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "' $(XLDFLAGS)' LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT)' LIBRUBY_SONAME='lib$(RUBY_BASE_NAME).$(RUBY_API_VERSION).$(SOEXT)' LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_INSTALL_NAME).$(SOEXT)' SOLIBS='$(LIBS)' ], [interix*], [ LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)' ], [mingw*|cygwin*|mswin*], [ LIBRUBY_RELATIVE=yes ])
], [
LIBRUBYARG_SHARED= # enable PIE if possible AC_ARG_ENABLE(pie, AS_HELP_STRING([--disable-pie], [disable PIE feature]), [pie=$enableval], [pie=]) AS_IF([test "$GCC" = yes -a -z "$EXTSTATIC" -a "x$pie" != xno], [ RUBY_TRY_CFLAGS(-fPIE, [pie=yes], [pie=no]) AS_IF([test "$pie" = yes], [ # Use -fPIE when testing -pie. RUBY_TRY_LDFLAGS sets # $save_CFLAGS internally, so set other name here. save_CFLAGS_before_pie="$CFLAGS" CFLAGS="$CFLAGS -fPIE" # gcc need -pie but clang need -Wl,-pie. for pie in -pie -Wl,-pie; do RUBY_TRY_LDFLAGS([$pie], [], [pie=]) AS_IF([test "x$pie" != x], [ RUBY_APPEND_OPTION(XCFLAGS, -fPIE) RUBY_APPEND_OPTION(XLDFLAGS, $pie) break ]) done CFLAGS="$save_CFLAGS_before_pie" ]) ])
]) AS_IF([test “$enable_rpath” = yes], [
test -z "$LIBRUBY_RPATHFLAGS" || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS " rpathflag="${RPATHFLAG}" AS_CASE(["${cross_compiling}${load_relative}"], [*yes*], [], [rpathflag="$RPATHFLAG$LIBPATHFLAG"]) rpathflag=`IFS="$PATH_SEPARATOR" echo x "$rpathflag" | sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${libprefix}${IFS}g;s${IFS}%s${IFS}${libprefix}${IFS}g" ` LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${rpathflag}" LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED" LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC"
]) AC_SUBST(LIBRUBY_RELATIVE)
LDFLAGS=“-L. $LDFLAGS” AC_SUBST(ARCHFILE)
AS_IF([test “$EXEEXT” = .exe], [
EXECUTABLE_EXTS='".exe",".com",".cmd",".bat"' AC_DEFINE_UNQUOTED(EXECUTABLE_EXTS, $EXECUTABLE_EXTS) EXECUTABLE_EXTS=`echo $EXECUTABLE_EXTS | tr -d '"' | tr , ' '` AC_SUBST(EXECUTABLE_EXTS)
])
AS_CASE(“$cross_compiling:${LIBPATHENV}”, [yes:* | no:], [], [
AC_MSG_CHECKING(whether wrapper for $LIBPATHENV is needed) AS_IF([env ${LIBPATHENV}=/lib /bin/sh -c ': ${'${LIBPATHENV}'?}' 2>/dev/null], [AC_MSG_RESULT(no)], [PREP="$PREP"' exe/$(PROGRAM)' AC_MSG_RESULT(yes)] )
])
AC_ARG_ENABLE(dtrace,
AS_HELP_STRING([--enable-dtrace], [enable DTrace for tracing inside ruby. enabled by default on systems having dtrace]), [enable_dtrace=$enableval], [enable_dtrace=auto])
LIBRUBY_A_OBJS='$(OBJS)' DTRACE_REBUILD= AS_CASE(, [yes|auto], [
RUBY_DTRACE_AVAILABLE()
], [
rb_cv_dtrace_available=no
]) AS_IF([test “${enable_dtrace}” = yes], [dnl
AS_IF([test -z "$DTRACE"], [dnl AC_MSG_ERROR([dtrace(1) is missing]) ], [test "$cross_compiling" = yes], [dnl AC_MSG_ERROR([--enable-dtrace, however, cross compiling]) ], [test "${rb_cv_dtrace_available}" = "no"], [dnl AC_MSG_ERROR([--enable-dtrace, however, USDT is not available]) ])
]) AS_CASE(, [yes*], [dnl
RUBY_DTRACE_POSTPROCESS() AS_IF([test "$rb_cv_prog_dtrace_g" != no], [dnl DTRACE_OBJ='probes.$(OBJEXT)' ]) AS_IF([test "$rb_cv_prog_dtrace_g" = rebuild], [dnl DTRACE_REBUILD=yes LIBRUBY_A_OBJS='$(DTRACE_GLOMMED_OBJ)' ]) AS_CASE("${target_os}", [freebsd*], [dnl # FreeBSD's dtrace requires libelf LIBS="-lelf $LIBS" ]) DTRACE_EXT=d
], [dnl
enable_dtrace=no DTRACE_EXT=dmyh
]) AC_SUBST(DTRACE_EXT) AC_SUBST(DTRACE_OBJ) AC_SUBST(DTRACE_REBUILD) AC_SUBST(DTRACE_OPT) AC_SUBST(LIBRUBY_A_OBJS)
AC_ARG_ENABLE(gcov,
AS_HELP_STRING([--enable-gcov], [enable coverage measurement by gcov]), [gcov=yes])
AS_IF([test x“$gcov” = xyes], [
CFLAGS="$CFLAGS -coverage" LDFLAGS="$LDFLAGS -coverage"
])
RUBY_SETJMP_TYPE } { # build section
dnl build rdoc index if requested RDOCTARGET=“” CAPITARGET=“” AC_ARG_ENABLE(install-doc,
AS_HELP_STRING([--disable-install-doc], [do not install either rdoc indexes or C API documents during install]), [install_doc=$enableval], [install_doc=yes])
AC_ARG_ENABLE(install-rdoc,
AS_HELP_STRING([--disable-install-rdoc], [do not install rdoc indexes during install]), [install_rdoc=$enableval], [install_rdoc=yes])
AC_ARG_ENABLE(install-capi,
AS_HELP_STRING([--disable-install-capi], [do not install C API documents during install]), [install_capi=$enableval], [install_capi=no])
AS_IF([test “$install_doc” != no], [
AS_IF([test "$install_rdoc" != no], [ RDOCTARGET="rdoc" ], [ RDOCTARGET="nodoc" ]) AS_IF([test "$install_capi" != no -a -n "$DOXYGEN"], [ CAPITARGET="capi" ], [ CAPITARGET="nodoc" ])
], [
RDOCTARGET="nodoc" CAPITARGET="nodoc"
])
AC_SUBST(RDOCTARGET) AC_SUBST(CAPITARGET)
AS_CASE(,[nodoc:nodoc],,[INSTALLDOC=all]) AC_SUBST(INSTALLDOC)
AC_ARG_ENABLE(install-static-library,
AS_HELP_STRING([--disable-install-static-library], [do not install static ruby library]), [INSTALL_STATIC_LIBRARY=$enableval], AS_IF([test x"$enable_shared" = xyes], [INSTALL_STATIC_LIBRARY=no], [INSTALL_STATIC_LIBRARY=yes]))
AC_SUBST(INSTALL_STATIC_LIBRARY)
AS_IF([test “$rb_with_pthread” = “yes”], [
THREAD_MODEL=pthread
]) AC_CACHE_CHECK([for prefix of external symbols], rb_cv_symbol_prefix, [
AC_TRY_COMPILE([extern void conftest_external(void) {}], [], [ rb_cv_symbol_prefix=`$NM conftest.$ac_objext | sed -n ['/.*T[ ]\([^ ]*\)conftest_external.*/!d;s//\1/p;q']` ], [rb_cv_symbol_prefix='']) test -n "$rb_cv_symbol_prefix" || rb_cv_symbol_prefix=NONE
]) SYMBOL_PREFIX=“$rb_cv_symbol_prefix” test “x$SYMBOL_PREFIX” = xNONE && SYMBOL_PREFIX='' DLNOBJ=dln.o AC_ARG_ENABLE(dln,
AC_HELP_STRING([--disable-dln], [disable dynamic link feature]), [test "$enableval" = yes || DLNOBJ=dmydln.o])
AC_SUBST(DLNOBJ) MINIDLNOBJ=dmydln.o
[linux*], [ ], [netbsd*], [ RUBY_APPEND_OPTION(CFLAGS, -pipe) ], [darwin*], [ RUBY_APPEND_OPTION(CFLAGS, -pipe) RUBY_APPEND_OPTION(XLDFLAGS, [-framework Foundation]) RUBY_APPEND_OPTION(LIBRUBYARG_STATIC, [-framework Foundation]) ], [osf*], [ AS_IF([test "$GCC" != "yes" ], [ # compile something small: taint.c is fine for this. # the main point is the '-v' flag of 'cc'. AS_CASE(["`cc -v -I. -c main.c -o /tmp/main.o 2>&1`"], [*/gemc_cc*], [ # we have the new DEC GEM CC CFLAGS="$CFLAGS -oldc" ], [ # we have the old MIPS CC ]) # cleanup rm -f /tmp/main.o CFLAGS="$CFLAGS -std" ]) ], [cygwin*|mingw*], [ LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)' AS_CASE(["$target_os"], [cygwin*], [ AS_IF([test x"$enable_shared" = xyes], [ LIBRUBY_SO='cyg$(RUBY_SO_NAME)'.dll LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)' ]) ], [mingw*], [ AS_IF([test x"$enable_shared" = xyes], [ LIBRUBY_SO='$(RUBY_SO_NAME)'.dll LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)' ]) EXPORT_PREFIX=' ' DLDFLAGS="${DLDFLAGS}"' $(DEFFILE)' AC_LIBOBJ([win32/win32]) AC_LIBOBJ([win32/file]) COMMON_LIBS=m
# COMMON_MACROS=“WIN32_LEAN_AND_MEAN=”
COMMON_HEADERS="winsock2.h windows.h" THREAD_MODEL=win32 PLATFORM_DIR=win32 ]) LIBRUBY_ALIASES='' FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in SOLIBS='$(LIBS)' AS_IF([test x"$enable_shared" = xyes], [ LIBRUBY='lib$(RUBY_SO_NAME).dll.a' ], [ LIBRUBY_SO=dummy LIBRUBY='lib$(RUBY_SO_NAME).a' LIBRUBYARG='-l$(RUBY_SO_NAME)' ]) ], [hpux*], [ AS_CASE(["$YACC"],[*yacc*], [ XCFLAGS="$XCFLAGS -DYYMAXDEPTH=300" YACC="$YACC -Nl40000 -Nm40000" ])
])
MINIOBJS=“$MINIDLNOBJ”
AS_CASE(, [pthread], [AC_CHECK_HEADERS(pthread.h)], [win32], [], [“”], [AC_MSG_ERROR(thread model is missing)],
[AC_MSG_ERROR(unknown thread model $THREAD_MODEL)])
AC_ARG_ENABLE(debug-env,
AS_HELP_STRING([--enable-debug-env], [enable RUBY_DEBUG environment variable]), [AC_SUBST(ENABLE_DEBUG_ENV, yes)])
AS_CASE(, [GNUmakefile:], [gnumake=yes], [
AC_MSG_CHECKING([if ${MAKE-make} is GNU make]) mkdir conftest.dir echo "all:; @echo yes" > conftest.dir/GNUmakefile echo "all:; @echo no" > conftest.dir/Makefile gnumake=`(cd conftest.dir; ${MAKE-make})` rm -fr conftest.dir AS_CASE(["$gnumake"], [*yes*], [ FIRSTMAKEFILE=GNUmakefile:template/GNUmakefile.in gnumake=yes], [ gnumake=no]) AC_MSG_RESULT($gnumake)
]) AS_IF([test “$gnumake” = yes], [ NULLCMD=: ], [
AC_MSG_CHECKING([for safe null command for ${MAKE-make}]) mkdir conftest.dir NULLCMD= for cmd in : true; do echo 'A=1' > conftest.dir/Makefile echo 'B=$(A:1=@'$cmd')' >> conftest.dir/Makefile echo 'all:; $B 1 2 3 4 5 6 7 8 9' >> conftest.dir/Makefile AS_IF([(cd conftest.dir; ${MAKE-make} >/dev/null 2>/dev/null)], [ NULLCMD=$cmd break ]) done rm -fr conftest.dir AS_IF([test -z "$NULLCMD"], [ AC_MSG_ERROR(no candidate for safe null command) ]) AC_MSG_RESULT($NULLCMD)
]) AC_SUBST(NULLCMD)
AS_IF([test “${universal_binary-no}” = yes ], [
AC_CACHE_CHECK([for architecture macros], rb_cv_architecture_macros, [ mv confdefs.h confdefs1.h : > confdefs.h AC_TRY_COMPILE([@%:@if defined __`echo ${universal_archnames} | sed 's/=[^ ]*//g;s/ /__ || defined __/g'`__
@%:@else @%:@error >>>>>><<<<<< @%:@endif], [], [
rb_cv_architecture_macros=yes mv -f confdefs1.h confdefs.h
], [
rb_cv_architecture_macros=no archflagpat=`eval echo '"'"${ARCH_FLAG}"'"' | sed 's/[[][|.*]]/\\&/g'` new_cflags=`echo "$CFLAGS" | sed "s|$archflagpat"'||'` for archs in ${universal_archnames}; do cpu=${archs@%:@*=} archs=${archs%=*} CFLAGS="$new_cflags -arch $archs" archs="__${archs}__" AC_MSG_CHECKING([for macro ${archs} on ${cpu}]) AC_TRY_COMPILE([@%:@ifndef ${archs}
@%:@error @%:@endif], [], [AC_MSG_RESULT()], [AC_MSG_RESULT()])
done mv -f confdefs1.h confdefs.h AC_MSG_ERROR([failed]) ])]) AC_CACHE_CHECK(whether __ARCHITECTURE__ is available, rb_cv_architecture_available, AC_TRY_COMPILE([@%:@include <stdio.h> const char arch[[]] = __ARCHITECTURE__;], [puts(arch);], [rb_cv_architecture_available=yes], [rb_cv_architecture_available=no]))
])
CPPFLAGS=“$CPPFLAGS ”'$(DEFS)' test -z “$CPPFLAGS” || CPPFLAGS=“$CPPFLAGS ”; CPPFLAGS=“$CPPFLAGS”'${cppflags}' AS_IF([test -n “${cflags+set}”], [
cflagspat=`eval echo '"'"${cflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/^ *$/ /'` CFLAGS=`echo " $CFLAGS " | sed "s|$cflagspat"'|${cflags}|;s/^ *//;s/ *$//'`
]) AS_IF([test -n “${cxxflags+set}”], [
cxxflagspat=`eval echo '"'"${cxxflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/^ *$/ /'` CXXFLAGS=`echo " $CXXFLAGS " | sed "s|$cxxflagspat"'|${cxxflags}|;s/^ *//;s/ *$//'`
]) AS_IF([test “${ARCH_FLAG}”], [
archflagpat=`eval echo '"'"${ARCH_FLAG}"'"' | sed 's/[[][|.*]]/\\&/g'` CFLAGS=`echo "$CFLAGS" | sed "s| *$archflagpat"'||'` CXXFLAGS=`echo "$CXXFLAGS" | sed "s| *$archflagpat"'||'` LDFLAGS=`echo "$LDFLAGS" | sed "s| *$archflagpat"'||'`
]) warnflags=“$rb_cv_warnflags” AC_SUBST(cppflags)dnl AC_SUBST(cflags, [“${orig_cflags:+$orig_cflags }”'${optflags} ${debugflags} ${warnflags}'])dnl AC_SUBST(cxxflags, [“${orig_cxxflags:+$orig_cxxflags }”'${optflags} ${debugflags} ${warnflags}'])dnl AC_SUBST(optflags)dnl AC_SUBST(debugflags)dnl AC_SUBST(warnflags)dnl AC_SUBST(strict_warnflags)dnl AC_SUBST(XCFLAGS)dnl AC_SUBST(XLDFLAGS)dnl AC_SUBST(EXTLDFLAGS)dnl AC_SUBST(EXTDLDFLAGS)dnl AC_SUBST(LIBRUBY_LDSHARED) AC_SUBST(LIBRUBY_DLDFLAGS) AC_SUBST(RUBY_INSTALL_NAME) AC_SUBST(rubyw_install_name) AC_SUBST(RUBYW_INSTALL_NAME) AC_SUBST(RUBY_SO_NAME) AC_SUBST(LIBRUBY_A) AC_SUBST(LIBRUBY_SO) AC_SUBST(LIBRUBY_SONAME) AC_SUBST(LIBRUBY_ALIASES) AC_SUBST(LIBRUBY) AC_SUBST(LIBRUBYARG) AC_SUBST(LIBRUBYARG_STATIC) AC_SUBST(LIBRUBYARG_SHARED) AC_SUBST(SOLIBS) AC_SUBST(DLDLIBS) AC_SUBST(ENABLE_SHARED) AC_SUBST(MAINLIBS) AC_SUBST(COMMON_LIBS) AC_SUBST(COMMON_MACROS) AC_SUBST(COMMON_HEADERS) AC_SUBST(EXPORT_PREFIX) AC_SUBST(SYMBOL_PREFIX) AC_SUBST(MINIOBJS) AC_SUBST(THREAD_MODEL) AC_SUBST(PLATFORM_DIR)
firstmf=`echo $FIRSTMAKEFILE | sed 's/:.*//'` firsttmpl=`echo $FIRSTMAKEFILE | sed 's/.*://'` MAKEFILES=“Makefile $firstmf” MAKEFILES=“`echo $MAKEFILES`” AC_SUBST(MAKEFILES)
ri_prefix= test “$program_prefix” != NONE &&
ri_prefix=$program_prefix
ri_suffix= test “$program_suffix” != NONE &&
ri_suffix=$program_suffix
RUBY_INSTALL_NAME=“${ri_prefix}”'$(RUBY_BASE_NAME)'“${ri_suffix}” AS_CASE(,
[cygwin*|mingw*], [ RUBYW_INSTALL_NAME="${ri_prefix}"'$(RUBYW_BASE_NAME)'"${ri_suffix}" rubyw_install_name='$(RUBYW_INSTALL_NAME)' ])
rubylibdir='${rubylibprefix}/${ruby_version}' rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'} AC_ARG_WITH(rubyarchprefix,
AS_HELP_STRING([--with-rubyarchprefix=DIR], [prefix for architecture dependent ruby libraries [[RUBYLIBPREFIX/ARCH]]]), [rubyarchprefix="$withval"])
AC_SUBST(rubyarchprefix)
rubysitearchprefix=${multiarch+'${sitearchlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${sitearch}'} AC_ARG_WITH(rubysitearchprefix,
AS_HELP_STRING([--with-rubysitearchprefix=DIR], [prefix for architecture dependent site libraries [[RUBYLIBPREFIX/SITEARCH]]]), [rubysitearchprefix="$withval"])
AC_SUBST(rubysitearchprefix)
RI_BASE_NAME=`echo ${RUBY_BASE_NAME} | sed 's/ruby/ri/'` ridir='${datarootdir}/${RI_BASE_NAME}' AC_ARG_WITH(ridir,
AS_HELP_STRING([--with-ridir=DIR], [ri documentation [[DATAROOTDIR/ri]]]), [ridir=$withval])
AC_SUBST(ridir) AC_SUBST(RI_BASE_NAME)
AC_ARG_WITH(ruby-version,
AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|minor|STR)]), [ruby_version=$withval], [ruby_version=full])
unset RUBY_LIB_VERSION unset RUBY_LIB_VERSION_STYLE AS_CASE(,
[full], [RUBY_LIB_VERSION_STYLE='3 /* full */'], [minor], [RUBY_LIB_VERSION_STYLE='2 /* minor */'])
AS_IF([test ${RUBY_LIB_VERSION_STYLE+set}], [
{ echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE" echo '#define STRINGIZE(x) x' test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0' echo '#include "version.h"' echo 'ruby_version=RUBY_LIB_VERSION' } > conftest.c ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`" eval $ruby_version
], [test -z “${ruby_version}”], [
AC_MSG_ERROR([No ruby version, No place for bundled libraries])
], [
RUBY_LIB_VERSION="${ruby_version}"
]) AC_SUBST(RUBY_LIB_VERSION_STYLE) AC_SUBST(RUBY_LIB_VERSION)
AC_ARG_WITH(sitedir,
AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]), [sitedir=$withval], [sitedir='${rubylibprefix}/site_ruby'])
sitelibdir='${sitedir}/${ruby_version}'
AC_ARG_WITH(sitearchdir,
AS_HELP_STRING([--with-sitearchdir=DIR], [architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]), [sitearchdir=$withval], [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby/${ruby_version}'}${multiarch-'${sitelibdir}/${sitearch}'}])
AC_ARG_WITH(vendordir,
AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]), [vendordir=$withval], [vendordir='${rubylibprefix}/vendor_ruby'])
vendorlibdir='${vendordir}/${ruby_version}'
AC_ARG_WITH(vendorarchdir,
AS_HELP_STRING([--with-vendorarchdir=DIR], [architecture dependent vendor libraries in DIR [[VENDORDIR/SITEARCH]], "no" to disable vendor directory]), [vendorarchdir=$withval], [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
AS_IF([test “${LOAD_RELATIVE+set}”], [
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) RUBY_EXEC_PREFIX=''
])
AC_SUBST(RUBY_EXEC_PREFIX)
AC_SUBST(libdirname, ${multiarch+arch}libdir) AC_SUBST(archlibdir)dnl AC_SUBST(sitearchlibdir)dnl AC_SUBST(archincludedir)dnl AC_SUBST(sitearchincludedir)dnl AC_SUBST(arch)dnl AC_SUBST(sitearch)dnl AC_SUBST(ruby_version)dnl AC_SUBST(rubylibdir)dnl AC_SUBST(rubyarchdir)dnl AC_SUBST(sitedir)dnl AC_SUBST(sitelibdir)dnl AC_SUBST(sitearchdir)dnl AC_SUBST(vendordir)dnl AC_SUBST(vendorlibdir)dnl AC_SUBST(vendorarchdir)dnl
AC_SUBST(CONFIGURE, “`echo $0 | sed 's|.*/||'`”)dnl AC_SUBST(configure_args, “`echo ”${ac_configure_args}“ | sed 's/\$/$$/g'`”)dnl
AS_IF([test “${universal_binary-no}” = yes ], [
arch="universal-${target_os}" AS_IF([test "${rb_cv_architecture_available}" = yes], [ AC_DEFINE_UNQUOTED(RUBY_PLATFORM_CPU, __ARCHITECTURE__) ], [ for archs in ${universal_archnames}; do cpu=`echo $archs | sed 's/.*=//'` archs=`echo $archs | sed 's/=.*//'` RUBY_DEFINE_IF([defined __${archs}__], RUBY_PLATFORM_CPU, ["${cpu}"]) done ]) ints='long int short' test "$ac_cv_type_long_long" = yes && ints="'long long' $ints" AC_SUBST(UNIVERSAL_ARCHNAMES, "${universal_archnames}") AC_SUBST(UNIVERSAL_INTS, "${ints}") AC_DEFINE_UNQUOTED(RUBY_PLATFORM_OS, "${target_os}") AC_DEFINE_UNQUOTED(RUBY_ARCH, "universal-"RUBY_PLATFORM_OS) AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS)
], [
arch="${target_cpu}-${target_os}" AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "$arch")
])
unset sitearch AS_CASE(,[mingw*],) : ${sitearch='${arch}'}
AC_ARG_WITH(search-path,
AS_HELP_STRING([--with-search-path=DIR], [specify the additional search path]), [search_path=$withval])
AS_IF([test “$search_path” != “”], [
AC_SUBST(RUBY_SEARCH_PATH, $search_path)
])
AC_ARG_WITH(rubyhdrdir,
AS_HELP_STRING([--with-rubyhdrdir=DIR], [core headers in DIR [[INCLUDEDIR/RUBY_BASE_NAME-RUBY_VERSION]]]), [rubyhdrdir=$withval], [rubyhdrdir='${includedir}/${RUBY_VERSION_NAME}'])
AC_ARG_WITH(rubyarchhdrdir,
AS_HELP_STRING([--with-rubyarchhdrdir=DIR], [architecture dependent core headers in DIR [[$(rubyhdrdir)/$(arch)]]]), [rubyarchhdrdir=$withval], [rubyarchhdrdir=${multiarch+'${archincludedir}/${RUBY_VERSION_NAME}'}${multiarch-'${rubyhdrdir}/${arch}'}])
AC_ARG_WITH(sitehdrdir,
AS_HELP_STRING([--with-sitehdrdir=DIR], [core site headers in DIR [[RUBYHDRDIR/site_ruby]]]), [sitehdrdir=$withval], [sitehdrdir='${rubyhdrdir}/site_ruby'])
AC_ARG_WITH(sitearchhdrdir,
AS_HELP_STRING([--with-sitearchhdrdir=DIR], [architecture dependent core site headers in DIR [[RUBYHDRDIR/site_ruby]]]), [sitearchhdrdir=$withval], [sitearchhdrdir=${multiarch+'${sitearchincludedir}/${RUBY_VERSION_NAME}/site_ruby'}${multiarch-'${sitehdrdir}/${sitearch}'}])
AC_ARG_WITH(vendorhdrdir,
AS_HELP_STRING([--with-vendorhdrdir=DIR], [core vendor headers in DIR [[RUBYHDRDIR/vendor_ruby]]]), [vendorhdrdir=$withval], [vendorhdrdir='${rubyhdrdir}/vendor_ruby'])
AC_ARG_WITH(vendorarchhdrdir,
AS_HELP_STRING([--with-vendorarchhdrdir=DIR], [architecture dependent core vendor headers in DIR [[RUBYHDRDIR/vendor_ruby]]]), [vendorarchhdrdir=$withval], [vendorarchhdrdir=${multiarch+'${sitearchincludedir}/${RUBY_VERSION_NAME}/vendor_ruby'}${multiarch-'${vendorhdrdir}/${sitearch}'}])
AC_SUBST(rubyhdrdir)dnl AC_SUBST(sitehdrdir)dnl AC_SUBST(vendorhdrdir)dnl AC_SUBST(rubyarchhdrdir)dnl AC_SUBST(sitearchhdrdir)dnl AC_SUBST(vendorarchhdrdir)dnl
AC_ARG_WITH(mantype,
AS_HELP_STRING([--with-mantype=TYPE], [specify man page type; TYPE is one of man and doc]), [ AS_CASE(["$withval"], [man|man.gz|man.bz2|doc|doc.gz|doc.bz2], [MANTYPE=$withval], [AC_MSG_ERROR(invalid man type: $withval)]) ])
AS_IF([test -z “$MANTYPE”], [
dnl Looks for nroff with -mdoc support. AC_CACHE_VAL([ac_cv_path_NROFF], [ AC_PATH_PROGS_FEATURE_CHECK([NROFF], [nroff awf mandoc], [$ac_path_NROFF -mdoc ${srcdir}/man/ruby.1 \ >/dev/null 2>&1 && ac_cv_path_NROFF=$ac_path_NROFF \ ac_path_NROFF_found=:], [], ["/usr/bin:/usr/ucb"] ) ]) AS_IF([test -n "$ac_cv_path_NROFF"], [ MANTYPE=doc ], [ MANTYPE=man ])
]) AC_SUBST(MANTYPE)
AC_ARG_ENABLE(rubygems,
AS_HELP_STRING([--disable-rubygems], [disable rubygems by default]), [enable_rubygems="$enableval"], [enable_rubygems=yes])
AS_IF([test x“$enable_rubygems” = xno], [
AC_DEFINE(DISABLE_RUBYGEMS, 1) USE_RUBYGEMS=NO
], [
USE_RUBYGEMS=YES
]) AC_SUBST(USE_RUBYGEMS)
arch_hdrdir=“${EXTOUT}/include/${arch}/ruby” AS_MKDIR_P(“${arch_hdrdir}”) config_h=“${arch_hdrdir}/config.h” guard=INCLUDE_RUBY_CONFIG_H {
echo "#ifndef $guard" echo "#define $guard 1" grep -v "^#define PACKAGE_" confdefs.h echo "#endif /* $guard */"
} | tr -d '015' | (
AS_IF([test "x$CONFIGURE_TTY" = xyes], [color=--color], [color=]) exec ${srcdir}/tool/ifchange $color "${config_h}" -
) || AC_MSG_ERROR([failed to create ${config_h}]) tr -d '015' < largefile.h > confdefs.h rm largefile.h
BUILTIN_ENCS=[“`sed -n -e '/^BUILTIN_ENCS[ ]*=/{' \
-e s/// -e :l -e '/\\\\$/N' -e 's/\\\\\\n/ /' -e 't l' -e p \ -e '}' "${srcdir}/enc/Makefile.in"`"]
BUILTIN_ENCOBJS= for e in $BUILTIN_ENCS; do BUILTIN_ENCOBJS=“$BUILTIN_ENCOBJS ”`echo $e | sed 's/.c$/.$(OBJEXT)/'`; done AC_SUBST(BUILTIN_ENCOBJS)
BUILTIN_TRANSES=[“`sed -n -e '/^BUILTIN_TRANSES[ ]*=/{' \
-e s/// -e :l -e '/\\\\$/N' -e 's/\\\\\\n/ /' -e 't l' -e p \ -e '}' "${srcdir}/enc/Makefile.in"`"]
BUILTIN_TRANSSRCS= BUILTIN_TRANSOBJS= for e in $BUILTIN_TRANSES; do
BUILTIN_TRANSSRCS="$BUILTIN_TRANSSRCS "`echo $e | sed 's/\.trans$/.c/'` BUILTIN_TRANSOBJS="$BUILTIN_TRANSOBJS "`echo $e | sed 's/\.trans$/.$(OBJEXT)/'`
done AC_SUBST(BUILTIN_TRANSSRCS) AC_SUBST(BUILTIN_TRANSOBJS)
PACKAGE=$RUBY_BASE_NAME AC_SUBST(PACKAGE) AS_MESSAGE([$PACKAGE library version = $ruby_version])
AS_CASE([“ $CPP ”], [*“ $CC ”*], [CPP=`echo “ $CPP ” | sed “s| $CC |”' $(CC) |;s/^ *//;s/ *$//'`])
AS_IF([test x“$firstmf” != x], [
AC_CONFIG_FILES($firstmf:$firsttmpl, [], [firstmf="$firstmf" firsttmpl="$firsttmpl"])
]) AC_CONFIG_FILES(Makefile, [
tmpmk=confmk$$.tmp { AS_IF([test ${VCS+set}], [ : ], [svn info "$srcdir" > /dev/null 2>&1], [ VCS='svn' ], [git_dir=`$GIT --work-tree="$srcdir" --git-dir="$srcdir/.git" rev-parse --git-dir 2>/dev/null`], [ AS_IF([test -d "$git_dir/svn"], [ VCS='$(GIT) svn' ], [ VCS='$(GIT)' ]) ], [ VCS='echo cannot' ]) AS_CASE("$VCS", [svn], [VCSUP='$(VCS) up $(SVNUPOPTIONS)'], ['$(GIT) svn'], [VCSUP='$(VCS) rebase $(GITSVNREBASEOPTIONS)'], ['$(GIT)'|git], [VCSUP='$(VCS) pull $(GITPULLOPTIONS)'], [VCSUP='$(VCS)']) sed -n \ -e '[/^@%:@define \(RUBY_RELEASE_[A-Z]*\) \([0-9][0-9]*\)/]{' \ -e 's//\1 = \2/' \ -e '[s/ \([0-9]\)$/ 0\1/]' \ -e p \ -e '}' "$srcdir/version.h" sed '/^MISSING/s/\$U\././g;/^VCS *=/s#@VCS@#'"$VCS"'#;/^VCSUP *=/s#@VCSUP@#'"$VCSUP"'#' Makefile echo; test x"$EXEEXT" = x || echo 'miniruby: miniruby$(EXEEXT)' AS_IF([test "$gnumake" != yes], [ echo ['$(MKFILES): $(srcdir)/common.mk'] sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk ], [ echo 'distclean-local::; @$(RM) GNUmakefile uncommon.mk' ]) } > $tmpmk && AS_IF([! grep '^ruby:' $tmpmk > /dev/null], [ AS_IF([test "${gnumake}" = yes], [ tmpgmk=confgmk$$.tmp { echo "include $tmpmk" echo "-include uncommon.mk" } > $tmpgmk ], [ tmpgmk=$tmpmk ]) && test -z "`${MAKE-make} -f $tmpgmk info-program | grep '^PROGRAM=ruby$'`" && echo 'ruby: $(PROGRAM);' >> $tmpmk test "$tmpmk" = "$tmpgmk" || rm -f "$tmpgmk" ]) && mv -f $tmpmk Makefile],
[EXEEXT='$EXEEXT' gnumake='$gnumake' GIT='$GIT'])
AC_HELP_STRING([--with-ruby-pc=FILENAME], [pc file basename]), [ruby_pc="$withval"], [ruby_pc="${RUBY_BASE_NAME}-${MAJOR}.${MINOR}.pc"])
AC_SUBST(ruby_pc) AC_SUBST(exec, [exec])
AC_ARG_WITH(destdir,
AS_HELP_STRING([--with-destdir=DESTDIR], [specify default directory to install]), [DESTDIR="$withval"])
AC_SUBST(DESTDIR)
AC_CONFIG_FILES($ruby_pc:template/ruby.pc.in,
[ AS_IF([sed ['s/\$(\([A-Za-z_][A-Za-z0-9_]*\))/${\1}/g;s/@[A-Za-z_][A-Za-z0-9_]*@//'] $ruby_pc > ruby.tmp.pc && { test -z "$PKG_CONFIG" || PKG_CONFIG_PATH=. $PKG_CONFIG --print-errors ruby.tmp }], [ mv -f ruby.tmp.pc $ruby_pc ], [ exit 1 ]) ], [ruby_pc='$ruby_pc' PKG_CONFIG='$PKG_CONFIG'])
AC_OUTPUT } }
AS_IF([${FOLD+:} false], [], [ AS_IF([test “`echo abcdefg hijklmno | fold -s -w10 | sed 1d`” = hijklmno], [FOLD=“fold”], [FOLD=]) ]) AS_REQUIRE_SHELL_FN(,
[AS_FUNCTION_DESCRIBE([config_summary], [NAME, VAL], [configuration summary])], [AS_IF([test -z "$2"], [], [ AS_ECHO_N([" * $1: "]) | dd bs=1 count=26 2>/dev/null AS_IF([test "$FOLD"], [ echo "$2" | fold -s -w50 | sed '1!s/^/ /;$!s/$/\\/' ], [echo "$2"]) ])]
)
echo “—” echo “Configuration summary for $RUBY_BASE_NAME version $RUBY_PROGRAM_VERSION” echo “” config_summary “Installation prefix” “$prefix” config_summary “exec prefix” “$exec_prefix” config_summary “arch” “$arch” config_summary “site arch” “$sitearch” config_summary “RUBY_BASE_NAME” “$RUBY_BASE_NAME” config_summary “enable shared” “$enable_shared” config_summary “ruby lib prefix” “$rubylibprefix” config_summary “site libraries path” “$rubysitearchprefix” config_summary “vendor path” “$vendordir” config_summary “target OS” “$target_os” config_summary “compiler” “$CC” config_summary “with pthread” “$enable_pthread” config_summary “enable shared libs” “$ENABLE_SHARED” config_summary “dynamic library ext” “$DLEXT” config_summary “CFLAGS” “$cflags” config_summary “CPPFLAGS” “$cppflags” config_summary “LDFLAGS” “$LDFLAGS” config_summary “optflags” “$optflags” config_summary “debugflags” “$debugflags” config_summary “warnflags” “$warnflags” config_summary “strip command” “$STRIP” config_summary “install doc” “$install_doc” config_summary “man page type” “$MANTYPE” config_summary “search path” “$search_path” config_summary “static-linked-ext” ${EXTSTATIC:+“yes”} echo “” echo “—”