ruby/configure.in

3130 строки
96 KiB
Plaintext
Исходник Обычный вид История

dnl Process this file with autoconf to produce a configure script.
dnl {
AC_INIT()
AC_CONFIG_AUX_DIR(tool)
AC_PREREQ(2.60)
AC_DEFUN([RUBY_PREREQ_AC],
[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), [-1],
AC_MSG_ERROR([Autoconf version ]$1[ or higher is required]$2))])
dnl environment section {
AC_ARG_WITH(baseruby,
AS_HELP_STRING([--with-baseruby=RUBY], [use RUBY as baseruby; RUBY is the pathname of ruby]),
[
AS_CASE(["$withval"],[*ruby*],[BASERUBY=$withval],[AC_MSG_ERROR(need ruby)])
],
[
BASERUBY="ruby"
])
test "`RUBYOPT=- $BASERUBY -e 'p 42' 2>/dev/null`" = 42 ||
BASERUBY="echo executable host ruby is required. use --with-baseruby option.; false"
AC_SUBST(BASERUBY)
AC_DEFUN([RUBY_MINGW32],
[AS_CASE(["$host_os"],
[cygwin*], [
AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32,
[AC_TRY_CPP([
#ifndef __MINGW32__
# error
#endif
], rb_cv_mingw32=yes,rb_cv_mingw32=no)
rm -f conftest*])
if test "$rb_cv_mingw32" = yes; then
target_os="mingw32"
: ${ac_tool_prefix:="`expr "$CC" : ['\(.*-\)g\?cc[^/]*$']`"}
fi
])
AS_CASE(["$target_os"], [mingw*msvc], [
target_os="`echo ${target_os} | sed 's/msvc$//'`"
])
AS_CASE(["$target_cpu-$target_os"], [x86_64-mingw*], [
target_cpu=x64
])
])
AC_DEFUN([RUBY_CPPOUTFILE],
[AC_CACHE_CHECK(whether ${CPP} accepts -o, rb_cv_cppoutfile,
[cppflags=$CPPFLAGS
CPPFLAGS='-o conftest.i'
AC_TRY_CPP([], rb_cv_cppoutfile=yes, rb_cv_cppoutfile=no)
CPPFLAGS=$cppflags
rm -f conftest*])
if test "$rb_cv_cppoutfile" = yes; then
CPPOUTFILE='-o conftest.i'
elif test "$rb_cv_cppoutfile" = no; then
CPPOUTFILE='> conftest.i'
elif test -n "$rb_cv_cppoutfile"; then
CPPOUTFILE="$rb_cv_cppoutfile"
fi
AC_SUBST(CPPOUTFILE)])
AC_DEFUN([RUBY_PROG_GNU_LD],
[AC_CACHE_CHECK(whether the linker is GNU ld, rb_cv_prog_gnu_ld,
[if `$CC $CFLAGS $CPPFLAGS $LDFLAGS --print-prog-name=ld 2>&1` -v 2>&1 | grep "GNU ld" > /dev/null; then
rb_cv_prog_gnu_ld=yes
else
rb_cv_prog_gnu_ld=no
fi
])
GNU_LD=$rb_cv_prog_gnu_ld
AC_SUBST(GNU_LD)])
eval `sed -n 's/^#define RUBY_API_VERSION_\([A-Z][A-Z_0-9]*\) \([0-9][0-9]*\)/\1=\2/p' $srcdir/include/ruby/version.h`
for v in MAJOR MINOR TEENY; do
if eval "test \"\$$v\" = ''"; then
AC_MSG_ERROR(could not determine $v number from version.h)
fi
done
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(TEENY)
RUBY_PROGRAM_VERSION=`sed -n 's/^#define RUBY_VERSION "\(.*\)"/\1/p' $srcdir/version.h`
AC_SUBST(RUBY_PROGRAM_VERSION)
RUBY_RELEASE_DATE=`sed -n 's/^#define RUBY_RELEASE_DATE "\(.*\)"/\1/p' $srcdir/version.h`
AC_SUBST(RUBY_RELEASE_DATE)
AC_DEFINE(CANONICALIZATION_FOR_MATHN)
dnl checks for alternative programs
AC_CANONICAL_BUILD
AC_ARG_WITH(gcc,
AS_HELP_STRING([--without-gcc], [never use gcc]),
[
AS_CASE([$withval],
[no], [: ${CC=cc}],
[yes], [: ${CC=gcc}],
[CC=$withval])])
dnl If the user switches compilers, we can't believe the cache
if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
then
AC_MSG_ERROR(cached CC is different -- throw away $cache_file
(it is also a good idea to do 'make clean' before compiling))
fi
AS_CASE(["$build_os"],
[darwin11.*], [
AS_CASE(["x$CC"],
[xgcc-4.2|x/usr/bin/gcc-4.2], [: ${CXX=g++-4.2}],
[xgcc|x/usr/bin/gcc], [: ${CXX=g++}],
[xcc|x/usr/bin/cc], [: ${CXX=c++}],
[xclang|x/usr/bin/clang], [: ${CXX=clang++}])
])
test -z "$CC" || ac_cv_prog_CC="$CC"
if test "$program_prefix" = NONE; then
program_prefix=
fi
RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"`
RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
AC_SUBST(RUBY_BASE_NAME)
AC_SUBST(RUBYW_BASE_NAME)
AC_CANONICAL_TARGET
target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
ac_install_sh='' # unusable for extension libraries.
AC_DEFUN([RUBY_APPEND_OPTION],
[# RUBY_APPEND_OPTION($1, $2)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="[$]$1 $2"])])
AC_DEFUN([RUBY_APPEND_OPTIONS],
[{ for rb_opt in $2; do # RUBY_APPEND_OPTIONS($1, $2)
AS_CASE([" [$]{$1-} "],
[*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ $1="[$]$1 [$]{rb_opt}"])
done; }])
AC_DEFUN([RUBY_PREPEND_OPTION],
[# RUBY_PREPEND_OPTION($1, $2)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="$2 [$]$1"])])
AC_DEFUN([RUBY_PREPEND_OPTIONS],
[{ unset rb_opts; for rb_opt in $2; do # RUBY_PREPEND_OPTIONS($1, $2)
AS_CASE([" [$]{rb_opts} [$]{$1-} "],
[*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ rb_opts="[$]{rb_opts}[$]{rb_opt} "])
done
$1="[$]{rb_opts}[$]$1"; }])
AC_ARG_WITH(arch,
AS_HELP_STRING([--with-arch=ARCHS],
[build an Apple/NeXT Multi Architecture Binary (MAB);
* gc.c (Init_stack): stack region is far smaller than usual if pthread is used. * marshal.c (w_extended): singleton methods should not be checked when dumping via marshal_dump() or _dump(). [ruby-talk:85909] * file.c (getcwdofdrv): avoid using getcwd() directly, use my_getcwd() instead. * merged NeXT, OpenStep, Rhapsody ports patch from Eric Sunshine <sunshine@sunshineco.com>. [ruby-core:01596] * marshal.c (w_object): LINK check earlier than anything else, i.e. do not dump TYPE_IVAR for already dumped objects. (ruby-bugs PR#1220) * eval.c (rb_eval): call "inherited" only when a new class is generated; not on reopening. * eval.c (eval): prepend error position in evaluating string to * configure.in: revived NextStep, OpenStep, and Rhapsody ports which had become unbuildable; enhanced --enable-fat-binary option so that it accepts a list of desired architectures (rather than assuming a fixed list), or defaults to a platform-appropriate list if user does not provide an explicit list; made the default list of architectures for MAB (fat binary) more comprehensive; now uses -fno-common even when building the interpreter (in addition to using it for extensions), thus allowing the interpreter to be embedded into a plugin module of an external project (in addition to allowing embedding directly into an application); added checks for <netinet/in_systm.h> (needed by `socket' extension) and getcwd(); now ensures that -I/usr/local/include is employed when extensions' extconf.rb scripts invoke have_header() since extension checks on NextStep and OpenStep will fail without it if the desired resource resides in the /usr/local tree; fixed formatting of --help message. * Makefile.in: $(LIBRUBY_A) rule now deletes the archive before invoking $(AR) since `ar' on Apple/NeXT can not "update" MAB archives (see configure's --enable-fat-binary option); added rule for new missing/getcwd.c. * defines.h: fixed endian handling during MAB build (see configure's --enable-fat-binary option) to ensure that all portions of the project see the correct WORDS_BIGENDIAN value (some extension modules were getting the wrong endian setting); added missing constants GETPGRP_VOID, WNOHANG, WUNTRACED, X_OK, and type pid_t for NextStep and OpenStep; removed unnecessary and problematic HAVE_SYS_WAIT_H define in NeXT section. * dir.c: do not allow NAMLEN() macro to trust dirent::d_namlen on NextStep since, on some installations, this value always resolves uselessly to zero. * dln.c: added error reporting to NextStep extension loader since the previous behavior of failing silently was not useful; now ensures that NSLINKMODULE_OPTION_BINDNOW compatibility constant is defined for OpenStep and Rhapsody; no longer includes <mach-o/dyld.h> twice on Rhapsody since this header lacks multiple-include protection, which resulted in "redefinition" compilation errors. * main.c: also create hard reference to objc_msgSend() on NeXT platforms (in addition to Apple platforms). * lib/mkmf.rb: now exports XCFLAGS from configure script to extension makefiles so that extensions can be built MAB (see configure's --enable-fat-binary option); also utilize XCFLAGS in cc_command() (but not cpp_command() because MAB flags are incompatible with direct invocation of `cpp'). * ext/curses/extconf.rb: now additionally checks for presence of these curses functions which are not present on NextStep or Openstep: bkgd(), bkgdset(), color(), curs(), getbkgd(), init(), scrl(), set(), setscrreg(), wattroff(), wattron(), wattrset(), wbkgd(), wbkgdset(), wscrl(), wsetscrreg() * ext/curses/curses.c: added appropriate #ifdef's for additional set of curses functions now checked by extconf.rb; fixed curses_bkgd() and window_bkgd() to correctly return boolean result rather than numeric result; fixed window_getbkgd() to correctly signal an error by returning nil rather than -1. * ext/etc/etc.c: setup_passwd() and setup_group() now check for null pointers before invoking rb_tainted_str_new2() upon fields extracted from `struct passwd' and `struct group' since null pointers in some fields are common on NextStep/OpenStep (especially so for the `pw_comment' field) and rb_tainted_str_new2() throws an exception when it receives a null pointer. * ext/pty/pty.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(). * ext/socket/getaddrinfo.c: cast first argument of getservbyname(), gethostbyaddr(), and gethostbyname() from (const char*) to non-const (char*) for older platforms such as NextStep and OpenStep. * ext/socket/socket.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(); include <netinet/in_systm.h> if present for NextStep and OpenStep; cast first argument of gethostbyaddr() and getservbyname() from (const char*) to non-const (char*) for older platforms. * ext/syslog/syslog.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-22 07:00:03 +03:00
ARCHS is a comma-delimited list of architectures for
which to build; if this option is disabled or omitted
entirely, then the package will be built only for the
target platform]),
[target_archs="$withval"], [unset target_archs])
AC_DEFUN([RUBY_DEFAULT_ARCH], [
AC_MSG_CHECKING([arch option])
AS_CASE([$1],
[*64], [ARCH_FLAG=-m64],
[[i[3-6]86]], [ARCH_FLAG=-m32],
[AC_MSG_ERROR(unknown target architecture: $target_archs)]
)
AC_MSG_RESULT([$ARCH_FLAG])
])
AC_DEFUN([RUBY_UNIVERSAL_ARCH], [
# RUBY_UNIVERSAL_ARCH begin
ARCH_FLAG=`expr " $CFLAGS " : ['.* \(-m[0-9][0-9]*\) ']`
test ${CFLAGS+set} && CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g'`
test ${LDFLAGS+set} && LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g'`
unset universal_binary universal_archnames
if test ${target_archs+set}; then
* gc.c (Init_stack): stack region is far smaller than usual if pthread is used. * marshal.c (w_extended): singleton methods should not be checked when dumping via marshal_dump() or _dump(). [ruby-talk:85909] * file.c (getcwdofdrv): avoid using getcwd() directly, use my_getcwd() instead. * merged NeXT, OpenStep, Rhapsody ports patch from Eric Sunshine <sunshine@sunshineco.com>. [ruby-core:01596] * marshal.c (w_object): LINK check earlier than anything else, i.e. do not dump TYPE_IVAR for already dumped objects. (ruby-bugs PR#1220) * eval.c (rb_eval): call "inherited" only when a new class is generated; not on reopening. * eval.c (eval): prepend error position in evaluating string to * configure.in: revived NextStep, OpenStep, and Rhapsody ports which had become unbuildable; enhanced --enable-fat-binary option so that it accepts a list of desired architectures (rather than assuming a fixed list), or defaults to a platform-appropriate list if user does not provide an explicit list; made the default list of architectures for MAB (fat binary) more comprehensive; now uses -fno-common even when building the interpreter (in addition to using it for extensions), thus allowing the interpreter to be embedded into a plugin module of an external project (in addition to allowing embedding directly into an application); added checks for <netinet/in_systm.h> (needed by `socket' extension) and getcwd(); now ensures that -I/usr/local/include is employed when extensions' extconf.rb scripts invoke have_header() since extension checks on NextStep and OpenStep will fail without it if the desired resource resides in the /usr/local tree; fixed formatting of --help message. * Makefile.in: $(LIBRUBY_A) rule now deletes the archive before invoking $(AR) since `ar' on Apple/NeXT can not "update" MAB archives (see configure's --enable-fat-binary option); added rule for new missing/getcwd.c. * defines.h: fixed endian handling during MAB build (see configure's --enable-fat-binary option) to ensure that all portions of the project see the correct WORDS_BIGENDIAN value (some extension modules were getting the wrong endian setting); added missing constants GETPGRP_VOID, WNOHANG, WUNTRACED, X_OK, and type pid_t for NextStep and OpenStep; removed unnecessary and problematic HAVE_SYS_WAIT_H define in NeXT section. * dir.c: do not allow NAMLEN() macro to trust dirent::d_namlen on NextStep since, on some installations, this value always resolves uselessly to zero. * dln.c: added error reporting to NextStep extension loader since the previous behavior of failing silently was not useful; now ensures that NSLINKMODULE_OPTION_BINDNOW compatibility constant is defined for OpenStep and Rhapsody; no longer includes <mach-o/dyld.h> twice on Rhapsody since this header lacks multiple-include protection, which resulted in "redefinition" compilation errors. * main.c: also create hard reference to objc_msgSend() on NeXT platforms (in addition to Apple platforms). * lib/mkmf.rb: now exports XCFLAGS from configure script to extension makefiles so that extensions can be built MAB (see configure's --enable-fat-binary option); also utilize XCFLAGS in cc_command() (but not cpp_command() because MAB flags are incompatible with direct invocation of `cpp'). * ext/curses/extconf.rb: now additionally checks for presence of these curses functions which are not present on NextStep or Openstep: bkgd(), bkgdset(), color(), curs(), getbkgd(), init(), scrl(), set(), setscrreg(), wattroff(), wattron(), wattrset(), wbkgd(), wbkgdset(), wscrl(), wsetscrreg() * ext/curses/curses.c: added appropriate #ifdef's for additional set of curses functions now checked by extconf.rb; fixed curses_bkgd() and window_bkgd() to correctly return boolean result rather than numeric result; fixed window_getbkgd() to correctly signal an error by returning nil rather than -1. * ext/etc/etc.c: setup_passwd() and setup_group() now check for null pointers before invoking rb_tainted_str_new2() upon fields extracted from `struct passwd' and `struct group' since null pointers in some fields are common on NextStep/OpenStep (especially so for the `pw_comment' field) and rb_tainted_str_new2() throws an exception when it receives a null pointer. * ext/pty/pty.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(). * ext/socket/getaddrinfo.c: cast first argument of getservbyname(), gethostbyaddr(), and gethostbyname() from (const char*) to non-const (char*) for older platforms such as NextStep and OpenStep. * ext/socket/socket.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(); include <netinet/in_systm.h> if present for NextStep and OpenStep; cast first argument of gethostbyaddr() and getservbyname() from (const char*) to non-const (char*) for older platforms. * ext/syslog/syslog.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-22 07:00:03 +03:00
AC_MSG_CHECKING([target architectures])
target_archs=`echo $target_archs | tr , ' '`
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
for archs in $target_archs
do
AS_CASE([",$universal_binary,"],[*",$archs,"*], [],[
cpu=`$SHELL "$ac_aux_dir/config.sub" "${archs}-${target_os}" 2>&1` || {
AC_MSG_RESULT([failed])
AC_MSG_ERROR([$cpu])
}
cpu=`echo $cpu | sed 's/-.*-.*//'`
universal_binary="${universal_binary+$universal_binary,}$cpu"
universal_archnames="${universal_archnames} ${archs}=${cpu}"
ARCH_FLAG="${ARCH_FLAG+$ARCH_FLAG }-arch $archs"
])
done
target_archs="$universal_binary"
unset universal_binary
AS_CASE(["$target_archs"],
[*,*], [universal_binary=yes],
[unset universal_archnames])
AC_MSG_RESULT([$target_archs])
target=`echo $target | sed "s/^$target_cpu-/-/"`
target_alias=`echo $target_alias | sed "s/^$target_cpu-/-/"`
if test "${universal_binary-no}" = yes; then
RUBY_PREREQ_AC(2.63, [ to compile universal binary])
AC_SUBST(try_header,try_compile)
target_cpu=universal
real_cross_compiling=$cross_compiling
else
if test x"$target_cpu" != x"${target_archs}"; then
echo 'int main(){return 0;}' > conftest.c
if $CC $CFLAGS $ARCH_FLAG -o conftest conftest.c > /dev/null 2>&1; then
rm -fr conftest.*
else
RUBY_DEFAULT_ARCH("$target_archs")
fi
fi
target_cpu=${target_archs}
fi
AS_CASE(["$target"], [-*], [ target="$target_cpu${target}"])
AS_CASE(["$target_alias"], [-*], [ target_alias="$target_cpu${target_alias}"])
else
if test x"$target_alias" = x; then
AS_CASE(["$target_os"],
[darwin*], [
AC_MSG_CHECKING([for real target cpu])
target=`echo $target | sed "s/^$target_cpu-/-/"`
target_cpu=`$CC -E - 2>/dev/null <<EOF |
#ifdef __x86_64__
"processor-name=x86_64"
#endif
#ifdef __i386__
"processor-name=i386"
#endif
#ifdef __ppc__
"processor-name=powerpc"
#endif
#ifdef __ppc64__
"processor-name=powerpc64"
#endif
EOF
sed -n 's/^"processor-name=\(.*\)"/\1/p'`
target="$target_cpu${target}"
AC_MSG_RESULT([$target_cpu])
])
fi
target_archs="$target_cpu"
fi
if test "${target_archs}" != "${rb_cv_target_archs-${target_archs}}"; then
AC_MSG_ERROR([target arch(s) has changed from ${rb_cv_target_archs-nothing} to ${target_archs}])
else
rb_cv_target_archs=${target_archs}
fi
if test "x${ARCH_FLAG}" != x; then
CFLAGS="$CFLAGS ${ARCH_FLAG}"
LDFLAGS="${LDFLAGS+$LDFLAGS }${ARCH_FLAG}"
fi
# RUBY_UNIVERSAL_ARCH end
])
AC_ARG_ENABLE(load-relative,
AS_HELP_STRING([--enable-load-relative], [resolve load paths at run time]),
[load_relative=$enableval])
AC_ARG_PROGRAM
dnl Checks for programs.
cflagspat=
test -z "$optflags" ||
cflagspat="$cflagspat;s|"`eval echo '"'"${optflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/ *$/ /'`'| |g'
test -z "$debugflags" ||
cflagspat="$cflagspat;s|"`eval echo '"'"${debugflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/ *$/ /'`'| |g'
test -z "warnflags" ||
cflagspat="$cflagspat;s|"`eval echo '"'"${warnflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/ *$/ /'`'| |g'
if test -z "${CFLAGS+set}"; then
cflags=`echo " $cflags " | sed "$cflagspat;s/^ *//;s/ *$//"`
orig_cflags="$cflags"
cflags="$cflags "'${optflags} ${debugflags} ${warnflags}'
fi
if test -z "${CXXFLAGS+set}"; then
cxxflags=`echo " $cxxflags " | sed "$cflagspat;s/^ *//;s/ *$//"`
orig_cxxflags="$cxxflags"
cxxflags="$cxxflags "'${optflags} ${debugflags} ${warnflags}'
fi
if test x"${build}" != x"${host}"; then
AC_CHECK_TOOL(CC, gcc)
fi
RUBY_MINGW32
AC_PROG_CC
AC_PROG_CXX
AC_PROG_GCC_TRADITIONAL
AC_SUBST(GCC)
if test "$GCC" = yes; then
linker_flag=-Wl,
: ${optflags=-O3}
RUBY_APPEND_OPTIONS(XCFLAGS, ["-include ruby/config.h" "-include ruby/missing.h"])
else
linker_flag=
fi
RUBY_PROG_GNU_LD
RUBY_CPPOUTFILE
: ${OUTFLAG='-o '}
: ${COUTFLAG=${OUTFLAG}}
AC_SUBST(OUTFLAG)
AC_SUBST(COUTFLAG)
RUBY_UNIVERSAL_ARCH
if test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "$cross_compiling" = no -a "$universal_binary" = no; then
RUBY_DEFAULT_ARCH("$target_cpu")
fi
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(AR, ar)
if test -z "$AR"; then
AC_CHECK_PROGS(AR, aal, ar)
fi
AC_CHECK_TOOL(AS, as)
ASFLAGS=$ASFLAGS
AC_SUBST(ASFLAGS)
AS_CASE(["$target_os"],[cygwin*|mingw*], [ac_cv_prog_ac_ct_OBJCOPY=":"])
# BSD's ports and MacPorts prefix GNU binutils with 'g'
AC_CHECK_TOOLS(OBJDUMP, [objdump gobjdump])
AC_CHECK_TOOLS(OBJCOPY, [objcopy gobjcopy])
AS_CASE(["$target_os"],
[cygwin*|mingw*], [
AC_CHECK_TOOL(WINDRES, windres)
AC_CHECK_TOOL(DLLWRAP, dllwrap)
target=`echo $target | sed "s/^$target_cpu-/-/"`
target_alias=`echo $target_alias | sed "s/^$target_cpu-/-/"`
target_cpu=`echo $target_cpu | sed s/i.86/i386/`
AS_CASE(["$target"], [-*], [ target="$target_cpu${target}"])
AS_CASE(["$target_alias"], [-*], [ target_alias="$target_cpu${target_alias}"])
AS_CASE(["$target_os"],
[mingw*], [
test "$rb_cv_msvcrt" = "" && unset rb_cv_msvcrt
AC_CACHE_CHECK(for mingw32 runtime DLL, rb_cv_msvcrt, [
AC_TRY_LINK([@%:@include <stdio.h>],
[FILE* volatile f = stdin; return 0;],
[rb_cv_msvcrt=`$OBJDUMP -p conftest$ac_exeext |
tr A-Z a-z |
sed -n '/^[[ ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`],
[rb_cv_msvcrt=msvcrt])
test "$rb_cv_msvcrt" = "" && rb_cv_msvcrt=msvcrt])
RT_VER=`echo "$rb_cv_msvcrt" | tr -cd [0-9]`
test "$RT_VER" = "" && RT_VER=60
AC_DEFINE_UNQUOTED(RUBY_MSVCRT_VERSION, $RT_VER)
])
: ${enable_shared=yes}
],
[aix*], [AC_CHECK_TOOL(NM, nm, /usr/ccs/bin/nm, /usr/ccs/bin:$PATH)],
[hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)]) # by TOYODA Eizi <toyoda@npd.kishou.go.jp>
AC_CHECK_TOOL(NM, nm)
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_MKDIR_P
if test "x$MKDIR_P" = "x -d"; then
if test x"$as_mkdir_p" != xfalse; then
MKDIR_P='mkdir -p'
echo "use 'mkdir -p' as MKDIR_P"
else
AC_MSG_ERROR([mkdir -p is required])
fi
fi
MAKEDIRS="$MKDIR_P"
AC_SUBST(MAKEDIRS)
AC_CHECK_PROG(DOT, dot)
AC_CHECK_PROG(DOXYGEN, doxygen)
AC_CHECK_PROG(PKG_CONFIG, pkg-config, [], [], [],
[`$as_dir/$ac_word$ac_exec_ext --print-errors --version > /dev/null 2>&1 || continue`])
# checks for UNIX variants that set C preprocessor variables
AC_USE_SYSTEM_EXTENSIONS
AC_SUBST(RM, ['rm -f'])
AC_SUBST(CP, ['cp'])
RMDIRS='$(top_srcdir)/tool/rmdirs'
RMDIR=rmdir
mkdir "rmdirs_$$_test" "rmdirs_$$_test/a"
rmdir --ignore-fail-on-non-empty "rmdirs_$$_test" 2>/dev/null &&
RMDIR='rmdir --ignore-fail-on-non-empty'
$RMDIR -p "rmdirs_$$_test/a" 2>/dev/null &&
{ test -d "rmdirs_$$_test" || RMDIRS="$RMDIR -p"; }
rmdir "rmdirs_$$_test/a" "rmdirs_$$_test" 2>/dev/null
AC_SUBST(RMDIR)
AC_SUBST(RMDIRS)
AC_SUBST(RMALL, ['rm -fr'])
AC_MSG_CHECKING([for cd using physical directory])
rm -fr conf$$.dir
mkdir conf$$.dir &&
(cd conf$$.dir && mkdir src build && cd src &&
$as_ln_s ../build . > /dev/null 2>&1 && cd build &&
for chdir in 'cd -P' 'PWD= cd'; do
/bin/sh -c "$chdir ../src && echo '$chdir' > cdcmd" 2> /dev/null && break
done)
if test -f conf$$.dir/src/cdcmd; then
read CHDIR < conf$$.dir/src/cdcmd 2> /dev/null
else
CHDIR=cd
fi
rm -fr conf$$.dir
AC_MSG_RESULT([$CHDIR])
AC_SUBST(CHDIR)
dnl }
dnl compiler section {
AC_DEFUN([RUBY_WERROR_FLAG], [dnl
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $rb_cv_warnflags"
if test "${ac_c_werror_flag+set}"; then
rb_c_werror_flag="$ac_c_werror_flag"
else
unset rb_c_werror_flag
fi
ac_c_werror_flag=yes
$1
CFLAGS="$save_CFLAGS"
save_CFLAGS=
if test "${rb_c_werror_flag+set}"; then
ac_c_werror_flag="$rb_c_werror_flag"
else
unset ac_c_werror_flag
fi])
AC_DEFUN(RUBY_TRY_CFLAGS, [
AC_MSG_CHECKING([whether ]$1[ is accepted as CFLAGS])
RUBY_WERROR_FLAG([
CFLAGS="[$]CFLAGS $1"
AC_TRY_COMPILE([$4], [$5],
[$2
AC_MSG_RESULT(yes)],
[$3
AC_MSG_RESULT(no)])
])
])
AC_DEFUN(RUBY_TRY_LDFLAGS, [
save_LDFLAGS="$LDFLAGS"
LDFLAGS="[$]LDFLAGS $1"
AC_MSG_CHECKING([whether $1 is accepted as LDFLAGS])
RUBY_WERROR_FLAG([
AC_TRY_LINK([$4], [$5],
[$2
AC_MSG_RESULT(yes)],
[$3
AC_MSG_RESULT(no)])
])
LDFLAGS="$save_LDFLAGS"
save_LDFLAGS=
])
rb_cv_warnflags="$warnflags"
if test "$GCC:${warnflags+set}:no" = yes::no; then
particular_werror_flags=yes
for wflag in -Wno-unused-parameter -Wno-parentheses -Wno-long-long \
-Wno-missing-field-initializers \
-Wunused-variable \
-Werror=pointer-arith \
-Werror=write-strings \
-Werror=declaration-after-statement \
-Werror=shorten-64-to-32 \
-Werror-implicit-function-declaration \
; do
if test "$particular_werror_flags" = yes; then
wflag=`echo x$wflag | sed 's/^x-Werror-/-Werror=/;s/^x//'`
else
wflag=`echo x$wflag | sed 's/^x-Werror=/-W/;s/^x//'`
fi
ok=no
RUBY_TRY_CFLAGS($wflag, [warnflags="${warnflags+$warnflags }$wflag" ok=yes])
AS_CASE([$ok:$wflag], [no:-Werror=*], [
wflag=`echo x$wflag | sed 's/^x-Werror=/-W/'`
RUBY_TRY_CFLAGS($wflag, [
warnflags="${warnflags+$warnflags }$wflag"
particular_werror_flags=no
])
])
done
AS_CASE([" $warnflags "],[*" -Wno-missing-field-initializers "*], [wflag="-Wall -Wextra"],
[wflag=-Wall])
RUBY_TRY_CFLAGS($wflag, [warnflags="$wflag${warnflags+ $warnflags}"])
# Disable warnflags while conftest. -Werror=* flags might make bad OS capability guess.
rb_cv_warnflags="$warnflags"
warnflags=
fi
if test "$GCC" = yes; then
test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb, [debugflags=-ggdb])}
test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-g3, [debugflags=-g3])}
# -D_FORTIFY_SOURCE
RUBY_TRY_CFLAGS(-D_FORTIFY_SOURCE=2, [RUBY_APPEND_OPTION(XCFLAGS, -D_FORTIFY_SOURCE=2)])
# -fstack-protector
AS_CASE(["$target_os"],
[mingw*], [
stack_protector=no
],
[
RUBY_TRY_CFLAGS(-fstack-protector, [stack_protector=yes], [stack_protector=no])
if test "x$stack_protector" = xyes; then
RUBY_TRY_LDFLAGS(-fstack-protector, [], [stack_protector=broken])
fi
])
if test "x$stack_protector" = xyes; then
RUBY_APPEND_OPTION(XCFLAGS, -fstack-protector)
RUBY_APPEND_OPTION(XLDFLAGS, -fstack-protector)
RUBY_APPEND_OPTION(LDFLAGS, -fstack-protector)
fi
# suppress annoying -Wstrict-overflow warnings
RUBY_TRY_CFLAGS(-fno-strict-overflow, [RUBY_APPEND_OPTION(XCFLAGS, -fno-strict-overflow)])
fi
test $ac_cv_prog_cc_g = yes && : ${debugflags=-g}
if test "$GCC" = ""; then
AS_CASE(["$target_os"],[aix*],[warnflags="-qinfo=por"])
fi
if test "$GCC" = yes; then
RUBY_TRY_CFLAGS(-fvisibility=hidden, [RUBY_APPEND_OPTION(XCFLAGS, -fvisibility=hidden)])
AC_SUBST(WERRORFLAG, "-Werror")
if test "$visibility_option" = yes; then
RUBY_APPEND_OPTION(XCFLAGS, -fvisibility=hidden)
else
RUBY_TRY_LDFLAGS([-Wl,-unexported_symbol,_Init_*], [visibility_option=ld], [visibility_option=no])
fi
test "$visibility_option" = no || OBJCOPY=:
fi
if test "$GCC" = yes; then
AS_CASE(["$target_os"], [mingw*], [
RUBY_TRY_CFLAGS(-fno-omit-frame-pointer, [optflags="${optflags+$optflags }-fno-omit-frame-pointer"])
])
fi
test -z "${ac_env_CFLAGS_set}" -a -n "${cflags+set}" && eval CFLAGS="\"$cflags $ARCH_FLAG\""
test -z "${ac_env_CXXFLAGS_set}" -a -n "${cxxflags+set}" && eval CXXFLAGS="\"$cxxflags $ARCH_FLAG\""
dnl check for large file stuff
mv confdefs.h confdefs1.h
: > confdefs.h
AC_SYS_LARGEFILE
mv confdefs.h largefile.h
mv confdefs1.h confdefs.h
cat largefile.h >> confdefs.h
AS_CASE(["$target_os"],[mingw*], [ac_cv_type_off_t=yes;ac_cv_sizeof_off_t=8])
AC_C_BIGENDIAN
AC_C_CONST
AC_C_CHAR_UNSIGNED
AC_C_INLINE
AC_C_VOLATILE
AS_CASE(":$ac_cv_c_const:$ac_cv_c_volatile:",
[*:no:*], [AC_MSG_ERROR(ANSI C-conforming const and volatile are mandatory)])
AC_CHECK_TYPES([long long, off_t])
AC_CACHE_CHECK([char bit], [rb_cv_char_bit],
[test "$universal_binary" = yes && cross_compiling=yes
AC_COMPUTE_INT([rb_cv_char_bit], [CHAR_BIT],
[AC_INCLUDES_DEFAULT([@%:@include <limits.h>])], [rb_cv_char_bit=8])
test "$universal_binary" = yes && cross_compiling=$real_cross_compiling])
dnl RUBY_CHECK_SIZEOF [typename], [maybe same size types], [macros], [include]
AC_DEFUN([RUBY_CHECK_SIZEOF],
[m4_bmatch([$1], [\.], [], [if test "$universal_binary" = yes; then])
AC_CACHE_CHECK([size of $1], [AS_TR_SH([ac_cv_sizeof_$1])], [
unset AS_TR_SH(ac_cv_sizeof_$1)
rbcv_var="
typedef m4_bpatsubst([$1], [\..*]) ac__type_sizeof_;
static ac__type_sizeof_ *rbcv_ptr;
@%:@define AS_TR_CPP(SIZEOF_$1) sizeof((*rbcv_ptr)[]m4_bmatch([$1], [\.], .m4_bpatsubst([$1], [^[^.]*\.])))
"
m4_ifval([$2], [test -z "${AS_TR_SH(ac_cv_sizeof_$1)+set}" && {
for t in $2; do
AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY(AC_INCLUDES_DEFAULT([$4]
[$rbcv_var]),
[AS_TR_CPP(SIZEOF_$1) == sizeof($t)])], [
AS_TR_SH(ac_cv_sizeof_$1)=AS_TR_CPP([SIZEOF_]$t)
break])
done
}])
unset cond
m4_ifval([$3], [test -z "${AS_TR_SH(ac_cv_sizeof_$1)+set}" && {
for s in 32 64 128; do
for t in $3; do
cond="${cond}
@%:@${cond+el}if defined(__${t}${s}__) || defined(__${t}${s}) || defined(_${t}${s}) || defined(${t}${s})"
hdr="AC_INCLUDES_DEFAULT([$4
@%:@if defined(__${t}${s}__) || defined(__${t}${s}) || defined(_${t}${s}) || defined(${t}${s})
@%:@ define AS_TR_CPP(HAVE_$1) 1
@%:@else
@%:@ define AS_TR_CPP(HAVE_$1) 0
@%:@endif])"
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$hdr], [!AS_TR_CPP(HAVE_$1)])], [continue])
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$hdr]
[$rbcv_var],
[AS_TR_CPP(HAVE_$1) == (AS_TR_CPP(SIZEOF_$1) == ([$[s / rb_cv_char_bit]]))])],
[AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}${s}"])
done
done
}])
m4_ifval([$2][$3], [case "${AS_TR_SH(ac_cv_sizeof_$1)}" in
#(
[SIZEOF_*]);;
#(
*)])
test "$universal_binary" = yes && cross_compiling=yes
AC_COMPUTE_INT([t], AS_TR_CPP(SIZEOF_$1), [AC_INCLUDES_DEFAULT([$4])]
[${cond+$cond
@%:@else}
$rbcv_var
${cond+@%:@endif}
@%:@ifndef AS_TR_CPP(SIZEOF_$1)
@%:@define AS_TR_CPP(SIZEOF_$1) 0
@%:@endif], [t=0])
test "$universal_binary" = yes && cross_compiling=$real_cross_compiling
if test ${t-0} != 0; then
AS_TR_SH(ac_cv_sizeof_$1)="${AS_TR_SH(ac_cv_sizeof_$1)+${AS_TR_SH(ac_cv_sizeof_$1)-} }${t}"
fi
m4_ifval([$2][$3], [;; esac])
: ${AS_TR_SH(ac_cv_sizeof_$1)=0}
])
{
unset cond
for t in ${AS_TR_SH(ac_cv_sizeof_$1)-}; do
AS_CASE(["$t"],
[[[0-9]*|SIZEOF_*]], [
${cond+echo "@%:@else"}
echo "[@%:@define ]AS_TR_CPP(SIZEOF_$1) [$t]"
break
],
[
s=`expr $t : ['.*[^0-9]\([0-9][0-9]*\)$']`
echo "@%:@${cond+el}if defined(__${t}__) || defined(__${t}) || defined(_${t}) || defined($t)"
echo "@%:@define AS_TR_CPP(SIZEOF_$1) [$[s / rb_cv_char_bit]]"
cond=1
])
done
${cond+echo "@%:@endif"}
} >> confdefs.h
m4_bmatch([$1], [\.], [], [else
AC_CHECK_SIZEOF([$1], 0, [$4])
fi])
])
RUBY_CHECK_SIZEOF(int, [], [ILP])
RUBY_CHECK_SIZEOF(short)
RUBY_CHECK_SIZEOF(long, [int], [ILP LP])
RUBY_CHECK_SIZEOF(long long)
RUBY_CHECK_SIZEOF(__int64)
RUBY_CHECK_SIZEOF(off_t)
RUBY_CHECK_SIZEOF(void*, [int long "long long"], [ILP LP LLP])
RUBY_CHECK_SIZEOF(float)
RUBY_CHECK_SIZEOF(double)
RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>])
AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[
[rb_cv_pri_prefix_]AS_TR_SH($1)=[NONE]
RUBY_WERROR_FLAG(for pri in $2; do
AC_TRY_COMPILE(
[@%:@include <stdio.h>
@%:@include <stddef.h>
@%:@ifdef __GNUC__
@%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
decl __attribute__((format(printf, string_index, first_to_check)))
@%:@else
@%:@define PRINTF_ARGS(decl, string_index, first_to_check) decl
@%:@endif
PRINTF_ARGS(void test_sprintf(const char*, ...), 1, 2);],
[printf("%]${pri}[d", (]$1[)42);
test_sprintf("%]${pri}[d", (]$1[)42);],
[rb_cv_pri_prefix_]AS_TR_SH($1)[=[$pri]; break])
done)])
if test "[$rb_cv_pri_prefix_]AS_TR_SH($1)" != NONE; then
AC_DEFINE_UNQUOTED([PRI_]m4_ifval($3,$3,AS_TR_CPP(m4_bpatsubst([$1],[_t$])))[_PREFIX],
"[$rb_cv_pri_prefix_]AS_TR_SH($1)")
fi
])
if test "x$ac_cv_type_long_long" = xyes; then
RUBY_CHECK_PRINTF_PREFIX(long long, ll I64, LL)
elif test "x$ac_cv_type___int64" = xyes; then
RUBY_CHECK_PRINTF_PREFIX(__int64, ll I64, LL)
fi
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
AC_CHECK_TYPE([$1],
[n="patsubst([$1],["],[\\"])"],
[n="patsubst([$2],["],[\\"])"],
[$4])
AC_CACHE_CHECK([for convertible type of [$1]], rb_cv_[$1]_convertible, [
u= t=
AS_CASE(["$n "],
[*" signed "*], [ ],
[*" unsigned "*], [
u=U],
[
AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])], [($n)-1 > 0])],
[u=U])])
if test x"$t" = x; then
for t in "long long" long int short; do
test -n "$u" && t="unsigned $t"
AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])]
[typedef $n rbcv_conftest_target_type;
typedef $t rbcv_conftest_replace_type;
extern rbcv_conftest_target_type rbcv_conftest_var;
extern rbcv_conftest_replace_type rbcv_conftest_var;
extern rbcv_conftest_target_type rbcv_conftest_func(void);
extern rbcv_conftest_replace_type rbcv_conftest_func(void);
], [sizeof(rbcv_conftest_target_type) == sizeof(rbcv_conftest_replace_type)])],
[n="$t"; break])
done
fi
AS_CASE([" $n "],
[*" long long "*], [
t=LL],
[*" long "*], [
t=LONG],
[
t=INT])
rb_cv_[$1]_convertible=${u}${t}])
test "${AS_TR_SH(ac_cv_type_[$1])}" = "yes" && n="$1"
AC_DEFINE_UNQUOTED(rb_[$1], $n)
AC_DEFINE_UNQUOTED([$3]2NUM[(v)], [${rb_cv_[$1]_convertible}2NUM(v)])
AC_DEFINE_UNQUOTED(NUM2[$3][(v)], [NUM2${rb_cv_[$1]_convertible}(v)])
AC_DEFINE_UNQUOTED(PRI_[$3]_PREFIX,
[PRI_`echo ${rb_cv_[$1]_convertible} | sed ['s/^U//']`_PREFIX])
])
RUBY_REPLACE_TYPE(pid_t, int, PIDT)
RUBY_REPLACE_TYPE(uid_t, int, UIDT)
RUBY_REPLACE_TYPE(gid_t, int, GIDT)
RUBY_REPLACE_TYPE(time_t, [], TIMET, [@%:@include <time.h>])
RUBY_REPLACE_TYPE(dev_t, [int long "long long"], DEVT)
RUBY_REPLACE_TYPE(mode_t, ["unsigned int" long], MODET, [@%:@include <sys/stat.h>])
RUBY_REPLACE_TYPE(rlim_t, [int long "long long"], RLIM, [@%:@include <sys/resource.h>])
AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
[AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
rb_cv_have_prototypes=yes,
rb_cv_have_prototypes=no)])
if test "$rb_cv_have_prototypes" = yes; then
AC_DEFINE(HAVE_PROTOTYPES)
fi
AC_CACHE_CHECK(token paste string, rb_cv_tokenpaste,
[AC_TRY_COMPILE([#define paste(a,b) a##b],
[int xy = 1; return paste(x,y);],
rb_cv_tokenpaste=ansi,
rb_cv_tokenpaste=knr)])
if test "$rb_cv_tokenpaste" = ansi; then
AC_DEFINE(TOKEN_PASTE(x,y),[x##y])
else
AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
fi
AC_CACHE_CHECK(stringization, rb_cv_stringization, [
rb_cv_stringization=no
for string in "#expr" '"expr"'; do
AC_COMPILE_IFELSE([
AC_LANG_BOOL_COMPILE_TRY([
#define STRINGIZE0(expr) $string
#define STRINGIZE(expr) STRINGIZE0(expr)
#undef real_test_for_stringization
#define test_for_stringization -.real_test_for_stringization.-
const char stringized[[]] = STRINGIZE(test_for_stringization);
], [sizeof(stringized) == 32])],
[rb_cv_stringization="$string"; break],
[rb_cv_stringization=no])
done]
)
AC_DEFINE(STRINGIZE(expr),STRINGIZE0(expr))
if test x"$rb_cv_stringization" != xno -a "$rb_cv_stringization" != "#expr"; then
AC_DEFINE_UNQUOTED(STRINGIZE0(expr),$rb_cv_stringization)
AC_DEFINE(OLD_FASHIONED_STRINGIZATION,1)
fi
AC_CACHE_CHECK([string literal concatenation],
rb_cv_string_literal_concatenation, [
AC_COMPILE_IFELSE([
AC_LANG_BOOL_COMPILE_TRY([
const char concatenated_literal[[]] = "literals" "to"
"be" "concatenated.";
], [sizeof(concatenated_literal) == 26])],
[rb_cv_string_literal_concatenation=yes],
[rb_cv_string_literal_concatenation=no])]
)
if test "$rb_cv_string_literal_concatenation" = no; then
AC_DEFINE(NO_STRING_LITERAL_CONCATENATION,1)
fi
AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg,
[AC_TRY_COMPILE([
#include <stdarg.h>
int foo(int x, ...) {
va_list va;
va_start(va, x);
va_arg(va, int);
va_arg(va, char *);
va_arg(va, double);
return 0;
}
], [return foo(10, "", 3.14);],
rb_cv_stdarg=yes,
rb_cv_stdarg=no)])
if test "$rb_cv_stdarg" = yes; then
AC_DEFINE(HAVE_STDARG_PROTOTYPES)
fi
AC_CACHE_CHECK(for variable length macro, rb_cv_va_args_macro,
[AC_TRY_COMPILE([
int foo(int x, ...);
@%:@define FOO(a, ...) foo(a, @%:@@%:@__VA_ARGS__)
], [FOO(1);FOO(1,2);FOO(1,2,3);],
rb_cv_va_args_macro=yes,
rb_cv_va_args_macro=no)])
if test "$rb_cv_va_args_macro" = yes; then
AC_DEFINE(HAVE_VA_ARGS_MACRO)
fi
AC_DEFUN([RUBY_DEFINE_IF], [dnl
m4_ifval([$1], [AS_LITERAL_IF([$1], [], [test "X$1" = X || ])cat <<EOH >> confdefs.h
@%:@if $1
EOH
])dnl
AC_DEFINE_UNQUOTED($2, $3)dnl
m4_ifval([$1], [AS_LITERAL_IF([$1], [], [test "X$1" = X || ])cat <<EOH >> confdefs.h
@%:@endif /* $1 */
EOH
])dnl
])dnl
dnl RUBY_FUNC_ATTRIBUTE(attrib, macroname, cachevar, condition)
AC_DEFUN([RUBY_FUNC_ATTRIBUTE], [dnl
m4_ifval([$2], dnl
[AS_VAR_PUSHDEF([attrib],[$2])], dnl
[AS_VAR_PUSHDEF([attrib],[FUNC_]AS_TR_CPP($1))] dnl
)dnl
m4_ifval([$3], dnl
[AS_VAR_PUSHDEF([rbcv],[$3])], dnl
[AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
)dnl
m4_ifval([$4], [rbcv_cond=["$4"]; test "$rbcv_cond" || unset rbcv_cond])
AC_CACHE_CHECK(for [$1] function attribute, rbcv,
[rbcv=x
RUBY_WERROR_FLAG([
for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do
m4_ifval([$4],mac="$mac"${rbcv_cond+" /* only if $rbcv_cond */"})
AC_TRY_COMPILE(
m4_ifval([$4],${rbcv_cond+[@%:@if ]$rbcv_cond})
[@%:@define ]attrib[(x) $mac]
m4_ifval([$4],${rbcv_cond+[@%:@else]}
${rbcv_cond+[@%:@define ]attrib[(x) x]}
${rbcv_cond+[@%:@endif]})
attrib[(void conftest_attribute_check(void));], [],
[rbcv="$mac"; break])
done
])])
if test "$rbcv" != x; then
RUBY_DEFINE_IF(m4_ifval([$4],[${rbcv_cond}]), attrib[(x)], $rbcv)
fi
m4_ifval([$4], [unset rbcv_cond])dnl
AS_VAR_POPDEF([attrib])dnl
AS_VAR_POPDEF([rbcv])dnl
])
RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
RUBY_FUNC_ATTRIBUTE(deprecated, DEPRECATED)
RUBY_FUNC_ATTRIBUTE(noinline, NOINLINE)
if_i386=${universal_binary+[defined __i386__]}
RUBY_FUNC_ATTRIBUTE(stdcall, [], [], ${if_i386})
RUBY_FUNC_ATTRIBUTE(cdecl, [], [], ${if_i386})
RUBY_FUNC_ATTRIBUTE(fastcall, [], [], ${if_i386})
if test "$GCC" = yes; then
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])
if test "$rb_cv_gcc_function_alias" != no; then
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)])
fi
AC_CACHE_CHECK([for atomic builtins], [rb_cv_gcc_atomic_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);
],
[rb_cv_gcc_atomic_builtins=yes],
[rb_cv_gcc_atomic_builtins=no])])
if test "$rb_cv_gcc_atomic_builtins" = yes; then
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS)
fi
AC_CACHE_CHECK(for __builtin_unreachable, rb_cv_func___builtin_unreachable,
[RUBY_WERROR_FLAG(
[AC_TRY_LINK([@%:@include <stdlib.h>],
[exit(0); __builtin_unreachable();],
[rb_cv_func___builtin_unreachable=yes],
[rb_cv_func___builtin_unreachable=no])
])
])
if test "$rb_cv_func___builtin_unreachable" = yes; then
AC_DEFINE_UNQUOTED(UNREACHABLE, [__builtin_unreachable()])
fi
fi
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
])])
if test "$rb_cv_func_exported" != no; then
AC_DEFINE_UNQUOTED(RUBY_FUNC_EXPORTED, [$rb_cv_func_exported extern])
fi
RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT)
dnl }
dnl header and library section {
dnl Check whether we need to define sys_nerr locally
AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
#include <errno.h>])
AC_ARG_ENABLE(win95,
AS_HELP_STRING([--enable-win95], [enable Windows 95 series support]),
[AS_CASE(["$enableval"],[yes|no],[enable_win95=$enableval],[unset enable_win95])])
AC_ARG_WITH(winnt-ver,
AS_HELP_STRING([--with-winnt-ver=0xXXXX], [target Windows NT version (default to 0x0501)]),
[with_winnt_ver="$withval"], [with_winnt_ver="0x0501"])
AS_CASE(["$target_os"],
[mingw*], [
RUBY_APPEND_OPTION(CPPFLAGS, -D_WIN32_WINNT=$with_winnt_ver)
])
AS_CASE(["$target_os"],
[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
])
AC_ARG_ENABLE(pthread,
AS_HELP_STRING([--enable-pthread], [obsolete, and ignored]))
dnl Checks for libraries.
AS_CASE(["$target_os"],[*bsd*|dragonfly*],[],[ac_cv_func_daemon=no])
AS_CASE(["$target_os"],
[nextstep*], [ ],
[openstep*], [ ],
[rhapsody*], [ ],
[darwin*], [ RUBY_PREPEND_OPTION(LIBS, -lobjc)
RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT)
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)
if test $macosx_10_5 = yes; then
ac_cv_header_ucontext_h=no
else
AC_DEFINE(BROKEN_SETREUID, 1)
AC_DEFINE(BROKEN_SETREGID, 1)
fi
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_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt,
[AC_TRY_RUN([
#include <stdio.h>
#include <unistd.h>
#include <string.h>
int
main()
{
int i;
for (i = 0; i < 128*128; i++) {
char salt[2], buf[256], *s;
salt[0] = 0x80 | (i & 0x7f);
salt[1] = 0x80 | (i >> 7);
strcpy(buf, crypt("", salt));
if (strcmp(buf, s = crypt("", salt))) {
#if 0
printf("%.2x%.2x: %s -> %s\n", (unsigned char)salt[0], (unsigned char)salt[1],
buf+2, s+2);
#endif
return 1;
}
}
return 0;
}
],
rb_cv_broken_crypt=no,
rb_cv_broken_crypt=yes,
rb_cv_broken_crypt=yes)])
if test "$rb_cv_broken_crypt" = yes; then
AC_DEFINE(BROKEN_CRYPT, 1)
fi
],
[hpux*], [ LIBS="-lm $LIBS"
ac_cv_c_inline=no],
[beos*|haiku*], [
ac_cv_func_link=no
ac_cv_func_sched_yield=no
ac_cv_func_pthread_attr_setinheritsched=no
AS_CASE(["$target_os"],
[beos*], [ ac_cv_header_net_socket_h=yes],
[haiku*], [ ac_cv_func_shutdown=no])
LIBS="$LIBS" # m lib is include in root under BeOS/Haiku
],
[cygwin*], [ ac_cv_header_langinfo_h=yes
AC_CHECK_FUNCS(cygwin_conv_path)
AC_LIBOBJ([langinfo])
],
[mingw*], [ LIBS="-lshell32 -lws2_32 -limagehlp $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_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_link=yes
ac_cv_func_fseeko=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_LIBOBJ([langinfo])
: ${enable_win95=maybe}
],
[os2-emx*], [ LIBS="-lm $LIBS"
ac_cv_lib_dir_opendir=no],
[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
],
[dragonfly*], [ LIBS="-lm $LIBS"
],
[bow], [ ac_cv_func_setitimer=no
],
[superux*], [ ac_cv_func_setitimer=no
],
[ LIBS="-lm $LIBS"])
AC_CHECK_LIB(crypt, crypt)
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, socketpair) # SunOS/Solaris
AC_CHECK_LIB(rt, clock_gettime) # GNU/Linux
if test "${enable_win95}" = maybe; then
AC_HAVE_LIBRARY(unicows, [enable_win95=yes], [enable_win95=no])
fi
if test "${enable_win95}" = yes; then
AC_DEFINE(WIN95)
LIBS="-lunicows $LIBS"
fi
AS_CASE(["$target_cpu"],
[alpha*|sh4|sh4el|sh4eb], [AS_CASE(["$target_os"::"$GCC"],
[*::yes], # gcc
[CFLAGS="-mieee $CFLAGS"],
[osf*], # ccc
[CFLAGS="-ieee $CFLAGS"],
)],
[sparc*], [AC_LIBOBJ([sparc])])
ac_cv_header_net_socket_h=${ac_cv_header_net_socket_h=no}
if test "$ac_cv_header_net_socket_h" = yes; then
ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h=no}
else
ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h=yes}
fi
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(limits.h sys/file.h sys/ioctl.h sys/syscall.h\
fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
syscall.h pwd.h grp.h a.out.h utime.h direct.h sys/resource.h \
sys/mkdev.h sys/utime.h xti.h netinet/in_systm.h float.h ieeefp.h \
ucontext.h intrinsics.h langinfo.h locale.h sys/sendfile.h time.h \
net/socket.h sys/socket.h process.h sys/prctl.h)
AC_TYPE_SIZE_T
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], [int long "long long"], [], [@%:@include <sys/stat.h>])
if test "$ac_cv_member_struct_stat_st_blocks" = yes; then
RUBY_CHECK_SIZEOF([struct stat.st_blocks], [int long "long long"], [], [@%:@include <sys/stat.h>])
fi
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_TYPES([struct timespec], [], [], [@%:@ifdef HAVE_TIME_H
@%:@include <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([clockid_t], [], [], [@%:@ifdef HAVE_TIME_H
@%:@ include <time.h>
@%:@endif
@%:@ifdef HAVE_SYS_TIME_H
@%:@ include <sys/time.h>
@%:@endif])
AC_CACHE_VAL([rb_cv_large_fd_select],
[AC_CHECK_TYPE(fd_mask, [rb_cv_large_fd_select=yes], [rb_cv_large_fd_select=no])])
if test "$rb_cv_large_fd_select" = yes; then
AC_DEFINE(HAVE_RB_FD_INIT, 1)
fi
dnl RUBY_DEFINT TYPENAME, SIZE, [SIGNED-OR-UNSIGNED], [INCLUDES = DEFAULT-INCLUDES]
AC_DEFUN([RUBY_DEFINT], [dnl
AC_CACHE_CHECK([for $1], [rb_cv_type_$1],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])
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"],
[ rb_cv_type_$1=no])])])
if test "${rb_cv_type_$1}" != no; then
AC_DEFINE([HAVE_]AS_TR_CPP($1), 1)
if test "${rb_cv_type_$1}" = yes; then
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])])])
else
AC_DEFINE_UNQUOTED($1, [$rb_cv_type_$1])
AC_DEFINE_UNQUOTED([SIZEOF_]AS_TR_CPP($1), [SIZEOF_]AS_TR_CPP([$rb_cv_type_$1]))
fi
fi
])
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
for addr in __libc_stack_end _SEND; do
AC_TRY_LINK(
[extern void *$addr;],
[if (!$addr) return 1;],
[rb_cv_stack_end_address="$addr"; break])
done])
if test $rb_cv_stack_end_address != no; then
AC_DEFINE_UNQUOTED(STACK_END_ADDRESS, $rb_cv_stack_end_address)
fi
AC_CACHE_CHECK(for gc_mark and gc_children stack frame approximate size(word), rb_cv_gc_mark_stackframe_word,
[save_CFLAGS="$CFLAGS"
CFLAGS="-O0"
AC_TRY_RUN([
int word;
char *stack_start;
void
set_stackframe_word()
{
int dumy = 42;
int diff;
if (stack_start < (char *)&dumy) {
diff = (int)((char *)&dumy - stack_start);
}
else {
diff = (int)(stack_start - (char *)&dumy);
}
word = (diff/sizeof(void *));
if ((diff % sizeof(void *)) != 0) {
word++;
}
}
void
gc_mark_children(void *p1, void *p2, int lev)
{
void *obj = p2;
set_stackframe_word(p1,p2,lev);
}
void
gc_mark(void *p1, void *p2, int lev)
{
void *obj = p2;
gc_mark_children(p1,p2,lev++);
}
int
main() {
int dumy = 42;
stack_start = (char *)&dumy;
gc_mark(0, 0, 255);
return word;
}
],
[rb_cv_gc_mark_stackframe_word="$?"],
[rb_cv_gc_mark_stackframe_word="$?"],
[rb_cv_gc_mark_stackframe_word="30"])
CFLAGS="$save_CFLAGS"])
AC_DEFINE_UNQUOTED(GC_MARK_STACKFRAME_WORD, $rb_cv_gc_mark_stackframe_word)
AS_CASE(["$target_os"],
[openbsd*], [
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])
if test $rb_cv_page_size_log != no; then
AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, $rb_cv_page_size_log)
else
AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, 12)
fi
])
dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_TYPE_SIGNAL
AS_CASE(["${target_cpu}-${target_os}:${target_archs}"],
[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
])
if test "x$ALLOCA" = "x"; then
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])
if test "x$rb_cv_dynamic_alloca" = "x__chkstk"; then
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}])
],)
fi
fi
AC_FUNC_MEMCMP
# http://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([$rb_cv_broken_glibc_ia64_erfc],[yes],[ac_cv_func_erf=no])
AS_CASE(["$target_os"],[freebsd*],[
AC_DEFINE(BROKEN_CLOSE)
AC_REPLACE_FUNCS(close)
])
AC_REPLACE_FUNCS(dup2 memmove strerror\
strchr strstr crypt flock\
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt \
strlcpy strlcat ffs setproctitle)
# for missing/setproctitle.c
AS_CASE(["$target_os"],
[aix* | k*bsd*-gnu | kopensolaris*-gnu | linux* | darwin*], [AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)],
[hpux*], [AC_DEFINE(SPT_TYPE,SPT_PSTAT) ],
[])
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)])
if test "$rb_cv_have_signbit" = yes; then
AC_DEFINE(HAVE_SIGNBIT)
else
AC_LIBOBJ([signbit])
fi
AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall __syscall chroot getcwd eaccess\
truncate ftruncate ftello chsize times utimes utimensat fcntl lockf lstat\
truncate64 ftruncate64 ftello64 fseeko fseeko64 \
link symlink readlink readdir_r fsync fdatasync fchown posix_fadvise\
setitimer setruid seteuid setreuid setresuid socketpair\
setrgid setegid setregid setresgid issetugid pause lchown lchmod\
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
getpriority getrlimit setrlimit sysconf close getpwnam_r getgrnam_r\
dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp\
setsid telldir seekdir fchmod cosh sinh tanh log2 round\
setuid setgid daemon select_large_fdset setenv unsetenv\
mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\
pread sendfile shutdown sigaltstack dl_iterate_phdr\
dup3 pipe2 posix_memalign memalign)
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)])
if test "$rb_cv_unsetenv_return_value" = no; then
AC_DEFINE(VOID_UNSETENV)
fi
AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
[AC_TRY_LINK([@%:@include <setjmp.h>
jmp_buf jb; void t(v) int v; {__builtin_longjmp(jb, v);}],
[__builtin_setjmp(jb);],
[ac_cv_func___builtin_setjmp=yes],
[ac_cv_func___builtin_setjmp=no])
])
test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
AC_MSG_CHECKING(for setjmp type)
AC_ARG_WITH(setjmp-type,
AS_HELP_STRING([--with-setjmp-type], [select setjmp type]),
[
AS_CASE([$withval],
[__builtin_setjmp], [ setjmp_prefix=__builtin_],
[_setjmp], [ setjmp_prefix=_],
[sigsetjmp], [ setjmp_prefix=sig],
[setjmp], [ setjmp_prefix=],
[''], [ unset setjmp_prefix],
[ AC_MSG_ERROR(invalid setjmp type: $withval)])], [unset setjmp_prefix])
if test ${setjmp_prefix+set}; then
if test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp = no; then
AC_MSG_ERROR(${setjmp_prefix}setjmp is not available)
fi
elif test "$ac_cv_func___builtin_setjmp" = yes; then
setjmp_prefix=__builtin_
elif test "$ac_cv_func__setjmp" = yes; then
setjmp_prefix=_
elif test "$ac_cv_func_sigsetjmp" = yes; then
AS_CASE([$target_os],[solaris*|cygwin*],[setjmp_prefix=],[setjmp_prefix=sig])
else
setjmp_prefix=
fi
if test x$setjmp_prefix = xsig; then
setjmp_sigmask=yes
else
unset setjmp_sigmask
fi
AC_MSG_RESULT(${setjmp_prefix}setjmp)
AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp(env${setjmp_sigmask+,0})])
AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
AC_ARG_ENABLE(setreuid,
AS_HELP_STRING([--enable-setreuid], [use setreuid()/setregid() according to need even if obsolete]),
[use_setreuid=$enableval])
if test "$use_setreuid" = yes; then
AC_DEFINE(USE_SETREUID)
AC_DEFINE(USE_SETREGID)
fi
AC_STRUCT_TIMEZONE
AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
[AC_TRY_COMPILE([#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])])
if test "$rb_cv_member_struct_tm_tm_gmtoff" = yes; then
AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF)
fi
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)])
if test "$rb_cv_have_daylight" = yes; then
AC_DEFINE(HAVE_DAYLIGHT)
fi
AC_DEFUN([RUBY_CHECK_VARTYPE], [dnl
AC_CACHE_CHECK([for external $1], AS_TR_SH(rb_cv_var_$1),
[AS_TR_SH(rb_cv_var_$1)=no
AC_TRY_COMPILE([
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 1
#endif
$2
;
const volatile void *volatile t;],
[t = &(&$1)[0];],
[for t in $3; do
AC_TRY_COMPILE([
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 1
#endif
$2
;
extern $t $1;
const volatile void *volatile t;],
[t = &(&$1)[0];],
[AS_TR_SH(rb_cv_var_$1)=$t; break])
done])])
if test "${AS_TR_SH(rb_cv_var_$1)}" != no; then
AC_DEFINE(AS_TR_CPP(HAVE_VAR_$1))
AC_DEFINE_UNQUOTED(AS_TR_CPP(TYPEOF_VAR_$1), ${AS_TR_SH(rb_cv_var_$1)})
fi])
RUBY_CHECK_VARTYPE(timezone, [@%:@include <time.h>], [long int])
RUBY_CHECK_VARTYPE(altzone, [@%:@include <time.h>], [long int])
AC_CHECK_FUNCS(timezone)
if test "$ac_cv_func_timezone" = yes; then
AC_CACHE_CHECK([whether timezone requires zero arguments], rb_cv_func_timezone_void,
[AC_TRY_COMPILE([@%:@include <time.h>],
[(void)timezone(0, 0);],
[rb_cv_func_timezone_void=no],
[rb_cv_func_timezone_void=yes])]
)
if test $rb_cv_func_timezone_void = yes; then
AC_DEFINE(TIMEZONE_VOID)
fi
fi
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)])
if test "$rb_cv_negative_time_t" = yes; then
AC_DEFINE(NEGATIVE_TIME_T)
fi
# [ruby-dev:40910] overflow of time on FreeBSD
# http://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=yes)])
if test "$rb_cv_localtime_overflow" = no; then
AC_DEFINE(LOCALTIME_OVERFLOW_PROBLEM)
fi
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
AC_DEFINE(POSIX_SIGNAL)
else
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)])
if test "$rb_cv_bsd_signal" = yes; then
AC_DEFINE(BSD_SIGNAL)
fi
fi
if test "$ac_cv_func_getpgid" = no; then
AC_FUNC_GETPGRP
fi
if test "$ac_cv_func_setpgid:$ac_cv_func_setpgrp" = no:yes; then
AC_FUNC_SETPGRP
fi
if test x"$target_cpu" = xia64; then
* configure.in: define IA64 for portability. (HP aC++/ANSI C doesn't define __ia64__.) don't check libunwind stuff. check __libc_ia64_register_backing_store_base. * defines.h: declare rb_ia64_bsp and rb_ia64_flushrs. (flush_register_windows): call rb_ia64_flushrs on IA64. * ia64.s: new file for IA64. it is separated from C program files because Intel C++ Compiler for IA64 doesn't support inline assembly. * common.mk (ia64.$(OBJEXT)): new target. * ruby.h (RUBY_INIT_STACK): defined. (ruby_init_stack): declared for RUBY_INIT_STACK. * main.c (main): precedes RUBY_INIT_STACK before ruby_init. * gc.c (rb_gc_register_stack_start): new global variable on IA64. (garbage_collect): simplify register stack marking code. don't use libunwind. (Init_stack): initialize rb_gc_register_stack_start. (ruby_init_stack): new function for RUBY_INIT_STACK. * eval.c (struct thread): add bstr_pos member for original position of register stack. (rb_thread_save_context): simplify register stack saving code. don't use libunwind. (rb_thread_restore_context_0): new function. moved from rb_thread_restore_context except the stack position checking code. don't use libunwind for IA64 register stack. (register_stack_extend): new function. (stack_extend): make it self-recursive with the stack position checking code in old rb_thread_restore_context. (rb_thread_restore_context): just call stack_extend. (flush_register_windows): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-27 08:40:04 +03:00
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
* configure.in: define IA64 for portability. (HP aC++/ANSI C doesn't define __ia64__.) don't check libunwind stuff. check __libc_ia64_register_backing_store_base. * defines.h: declare rb_ia64_bsp and rb_ia64_flushrs. (flush_register_windows): call rb_ia64_flushrs on IA64. * ia64.s: new file for IA64. it is separated from C program files because Intel C++ Compiler for IA64 doesn't support inline assembly. * common.mk (ia64.$(OBJEXT)): new target. * ruby.h (RUBY_INIT_STACK): defined. (ruby_init_stack): declared for RUBY_INIT_STACK. * main.c (main): precedes RUBY_INIT_STACK before ruby_init. * gc.c (rb_gc_register_stack_start): new global variable on IA64. (garbage_collect): simplify register stack marking code. don't use libunwind. (Init_stack): initialize rb_gc_register_stack_start. (ruby_init_stack): new function for RUBY_INIT_STACK. * eval.c (struct thread): add bstr_pos member for original position of register stack. (rb_thread_save_context): simplify register stack saving code. don't use libunwind. (rb_thread_restore_context_0): new function. moved from rb_thread_restore_context except the stack position checking code. don't use libunwind for IA64 register stack. (register_stack_extend): new function. (stack_extend): make it self-recursive with the stack position checking code in old rb_thread_restore_context. (rb_thread_restore_context): just call stack_extend. (flush_register_windows): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-27 08:40:04 +03:00
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])])
* configure.in: define IA64 for portability. (HP aC++/ANSI C doesn't define __ia64__.) don't check libunwind stuff. check __libc_ia64_register_backing_store_base. * defines.h: declare rb_ia64_bsp and rb_ia64_flushrs. (flush_register_windows): call rb_ia64_flushrs on IA64. * ia64.s: new file for IA64. it is separated from C program files because Intel C++ Compiler for IA64 doesn't support inline assembly. * common.mk (ia64.$(OBJEXT)): new target. * ruby.h (RUBY_INIT_STACK): defined. (ruby_init_stack): declared for RUBY_INIT_STACK. * main.c (main): precedes RUBY_INIT_STACK before ruby_init. * gc.c (rb_gc_register_stack_start): new global variable on IA64. (garbage_collect): simplify register stack marking code. don't use libunwind. (Init_stack): initialize rb_gc_register_stack_start. (ruby_init_stack): new function for RUBY_INIT_STACK. * eval.c (struct thread): add bstr_pos member for original position of register stack. (rb_thread_save_context): simplify register stack saving code. don't use libunwind. (rb_thread_restore_context_0): new function. moved from rb_thread_restore_context except the stack position checking code. don't use libunwind for IA64 register stack. (register_stack_extend): new function. (stack_extend): make it self-recursive with the stack position checking code in old rb_thread_restore_context. (rb_thread_restore_context): just call stack_extend. (flush_register_windows): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-27 08:40:04 +03:00
if test $rb_cv___libc_ia64_register_backing_store_base = yes; then
AC_DEFINE(HAVE___LIBC_IA64_REGISTER_BACKING_STORE_BASE)
fi
fi
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)])
if test "$rb_cv_rshift_sign" = yes; then
AC_DEFINE(RSHIFT(x,y), ((x)>>(int)(y)))
else
AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>(int)(y)) : (x)>>(int)(y)))
fi
# win32.c still use this. Don't remove it.
test "$rb_cv_fcnt" = "not found" && rb_cv_fcnt="not found (OK if using GNU libc)"
AC_CACHE_CHECK([read count field in FILE structures], rb_cv_fcnt,
[rb_cv_fcnt="not found (OK if using GNU libc)"
for fcnt in dnl
_cnt dnl
__cnt dnl
_r dnl
readCount dnl
_rcount dnl for emx0.9c
; do
AC_TRY_COMPILE([#include <stdio.h>
],
[FILE *f = stdin; f->$fcnt = 0;],
[rb_cv_fcnt="$fcnt"; break])
done])
AS_CASE("$rb_cv_fcnt",
["not found"*], [rb_cv_fcnt="not found"],
[AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt)])
# win32.c still use this. Don't remove it.
AC_CACHE_CHECK([read buffer ptr field in FILE structures], rb_cv_frptr,
[for frptr in dnl
_IO_read_ptr dnl
_ptr dnl
__ptr dnl
bufpos dnl
_p dnl
__bufpos dnl
; do
AC_TRY_COMPILE([#include <stdio.h>
],
[FILE *f = stdin; char buf[256]; f->$frptr = buf;],
rb_cv_frptr="$frptr"; break,
rb_cv_frptr="not found")
done])
if test "$rb_cv_frptr" != "not found"; then
AC_DEFINE_UNQUOTED(FILE_READPTR, $rb_cv_frptr)
if test "$rb_cv_fcnt" = "not found"; then
AC_CACHE_CHECK([read buffer end field in FILE structures], rb_cv_frend,
[for frend in dnl
_IO_read_end dnl
bufread dnl
__bufread dnl
; do
AC_TRY_COMPILE([#include <stdio.h>
],
[FILE *f = stdin; char buf[256]; f->$frend = buf;],
rb_cv_frend="$frend"; break,
rb_cv_frend="not found")
done])
if test "$rb_cv_frend" != "not found"; then
AC_DEFINE_UNQUOTED(FILE_READEND, $rb_cv_frend)
fi
fi
fi
RUBY_CHECK_SIZEOF([struct stat.st_ino], [long "long long"], [], [@%:@include <sys/stat.h>])
AC_CACHE_CHECK([whether struct dirent.d_name is too small], rb_cv_sizeof_struct_dirent_too_small,
[AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([
@%:@if defined _WIN32
@%:@ error <<<struct direct in win32/dir.h has variable length d_name>>>
@%:@elif defined HAVE_DIRENT_H
@%:@ include <dirent.h>
@%:@elif defined HAVE_DIRECT_H
@%:@ include <direct.h>
@%:@else
@%:@ define dirent direct
@%:@ if HAVE_SYS_NDIR_H
@%:@ include <sys/ndir.h>
@%:@ endif
@%:@ if HAVE_SYS_DIR_H
@%:@ include <sys/dir.h>
@%:@ endif
@%:@ if HAVE_NDIR_H
@%:@ include <ndir.h>
@%:@ endif
@%:@endif
@%:@include <stddef.h>
@%:@define numberof(array) [(int)(sizeof(array) / sizeof((array)[0]))]
struct dirent d;
])],
[offsetof(struct dirent, [d_name[numberof(d.d_name)]]) - offsetof(struct dirent, d_name) < 256])],
[rb_cv_sizeof_struct_dirent_too_small=yes],
[rb_cv_sizeof_struct_dirent_too_small=no])])
if test "$rb_cv_sizeof_struct_dirent_too_small" = yes; then
AC_DEFINE(SIZEOF_STRUCT_DIRENT_TOO_SMALL, 1)
fi
if test "$ac_cv_func_sysconf" = yes; then
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)
])
if test "$rb_cv_have_sc_[]m4_tolower($1)" = yes; then
AC_DEFINE(HAVE__SC_$1)
fi
])
RUBY_CHECK_SYSCONF(CLK_TCK)
fi
AC_DEFUN(RUBY_STACK_GROW_DIRECTION, [
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(["$1"],
[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([stack_grow_dir])])
if test "${universal_binary-no}" = yes ; then
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)
if test x$stack_dir = x; then
stack_dir=$dir
elif test x$stack_dir != x$dir; then
stack_dir=no
fi
done
CFLAGS="$save_CFLAGS" LDFLAGS="$save_LDFLAGS"
if test x$stack_dir = xno; then
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
else
AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $stack_dir)
fi
else
RUBY_STACK_GROW_DIRECTION($target_cpu, dir)
AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $dir)
fi
if test x"$enable_pthread" = xyes; then
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)
if test "$rb_with_pthread" = "yes"; then break; fi
done
if test x"$rb_with_pthread" = xyes; then
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*], [LIBS="-pthread $LIBS"],
[LIBS="-l$pthread_lib $LIBS"])])
else
AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
fi
AC_CHECK_FUNCS(sched_yield pthread_attr_setinheritsched \
pthread_getattr_np pthread_attr_get_np pthread_attr_getstack\
pthread_get_stackaddr_np pthread_get_stacksize_np \
thr_stksegment pthread_stackseg_np pthread_getthrds_np \
pthread_condattr_setclock pthread_sigmask)
fi
if test x"$ac_cv_header_ucontext_h" = xyes; then
if test x"$rb_with_pthread" = xyes; then
AC_CHECK_FUNCS(getcontext setcontext)
fi
fi
if test "$ac_cv_func_fork" = "yes" -a "$rb_with_pthread" = "yes"; then
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)
fi
AS_CASE(["$target_os"],
[freebsd*], [
AC_CHECK_HEADERS([/usr/local/include/execinfo.h])
if test "x$ac_cv_header__usr_local_include_execinfo_h" = xyes; then :
RUBY_APPEND_OPTION(CPPFLAGS, -I/usr/local/include)
LDFLAGS="${LDFLAGS:+$LDFLAGS }-L/usr/local/lib"
DLDFLAGS="${DLDFLAGS:+$DLDFLAGS }-L/usr/local/lib"
AC_CHECK_LIB([execinfo], [backtrace])
fi])
AC_CHECK_FUNCS(backtrace)
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)])
dnl }
dnl 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], [
if test "$enable_shared" = yes; then
AC_MSG_ERROR(dln_a_out can not make shared library)
fi
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 | cat -e`"],
['^?ELF'*], [rb_cv_binary_elf=yes], [rb_cv_binary_elf=no])],
rb_cv_binary_elf=no)])
if test "$rb_cv_binary_elf" = yes; then
AC_DEFINE(USE_ELF)
if test "$with_dln_a_out" = yes; then
AC_MSG_ERROR(dln_a_out does not work with ELF)
fi
AC_LIBOBJ([addr2line])
fi
AS_CASE(["$target_os"],
[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu], [
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
if test "$rb_cv_binary_elf" = no; then
with_dln_a_out=yes
else
LDFLAGS="$LDFLAGS -rdynamic"
fi])
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
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
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
AC_SUBST(LIBEXT)dnl
STATIC=
: ${PATHFLAG=''}
if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=unknown
AC_MSG_CHECKING(whether OS depend dynamic link works)
if test "$GCC" = yes; then
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*|beos*|haiku*|cygwin*|mingw*|aix*|interix*], [ ],
[
RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)])
else
AS_CASE(["$target_os"],
[hpux*], [CCDLFLAGS="$CCDLFLAGS +Z"],
[solaris*|irix*], [CCDLFLAGS="$CCDLFLAGS -KPIC"],
[sunos*], [CCDLFLAGS="$CCDLFLAGS -PIC"],
[esix*|uxpds*], [CCDLFLAGS="$CCDLFLAGS -KPIC"],
[: ${CCDLFLAGS=""}])
fi
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"])
if test "$enable_rpath" = yes; then
RPATHFLAG=" ${linker_flag}-R%1\$-s"
fi
AS_CASE(["$target_os"],
[hpux*], [ DLDFLAGS="$DLDFLAGS -E"
: ${LDSHARED='ld -b'}
XLDFLAGS="$XLDFLAGS -Wl,-E"
: ${LIBPATHENV=SHLIB_PATH}
if test "$rb_cv_prog_gnu_ld" = no; then
RPATHFLAG=' +b %1$-s'
fi
rb_cv_dlopen=yes],
[solaris*], [ if test "$GCC" = yes; then
: ${LDSHARED='$(CC) -shared'}
if test "$rb_cv_prog_gnu_ld" = yes; then
LDFLAGS="$LDFLAGS -Wl,-E"
fi
else
: ${LDSHARED='$(CC) -G'}
fi
if test "$ac_cv_sizeof_voidp" = 8; then
: ${LIBPATHENV=LD_LIBRARY_PATH_64}
fi
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], [
: ${LDSHARED='$(CC) -shared'}
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
fi
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'}
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="$LDFLAGS -rdynamic"
DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
else
test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED="ld -Bshareable"
fi
rb_cv_dlopen=yes],
[openbsd*], [ : ${LDSHARED='$(CC) -shared ${CCDLFLAGS}'}
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="$LDFLAGS -Wl,-E"
fi
rb_cv_dlopen=yes],
[darwin*], [ : ${LDSHARED='$(CC) -dynamic -bundle'}
: ${DLDFLAGS="${linker_flag}-undefined${linker_flag:+,}dynamic_lookup ${linker_flag}-multiply_defined${linker_flag:+,}suppress ${linker_flag}-flat_namespace"}
: ${LDFLAGS=""}
: ${LIBPATHENV=DYLD_LIBRARY_PATH}
# /usr/local/include is always searched for
# some reason, but /usr/local/lib is not.
hdr=`find /usr/local/include -name \*.h -type f | sed 's:^/usr/local/include/::;q'`
if test -n "$hdr" && $CC -E -include "$hdr" -xc /dev/null 2>/dev/null | fgrep -q "$hdr"; then
$CC -print-search-dirs | grep -q '^libraries:.*:/usr/local/lib/*' ||
echo " $LDFLAGS " | grep -q ' -L */usr/local/lib/* ' ||
LDFLAGS="${LDFLAGS:+$LDFLAGS }-L/usr/local/lib"
fi
rb_cv_dlopen=yes],
[aix*], [ : ${LDSHARED='$(CC)'}
LDSHARED="$LDSHARED ${linker_flag}-G"
DLDFLAGS='-eInit_$(TARGET)'
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=SHLIB_PATH}
RPATHFLAG=" ${linker_flag}-blibpath:%1\$-s:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}"
rb_cv_dlopen=yes],
[beos*], [ AS_CASE(["$target_cpu"],
[powerpc*], [
: ${LDSHARED="ld -xms"}
DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
LDFLAGS="$LDFLAGS -L/boot/home/config/lib -lbe -lroot"
],
[i586*], [
: ${LDSHARED="ld -shared"}
DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -L/boot/home/config/lib \$(topdir)/_APP_ -lbe -lroot"
LDFLAGS="$LDFLAGS -L/boot/develop/lib/x86 -L/boot/home/config/lib -lbe -lroot"
])
: ${LIBPATHENV=LIBRARY_PATH}
rb_cv_dlopen=yes],
[haiku*], [ AS_CASE(["$target_cpu"],
[powerpc*], [
: ${LDSHARED="ld -xms"}
DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
],
[i586*], [
: ${LDSHARED="ld -shared"}
DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -lbe -lroot"
])
: ${LIBPATHENV=LIBRARY_PATH}
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 $(if $(filter-out -g -g0,$(debugflags)),,-s)'}
XLDFLAGS="$XLDFLAGS -Wl,--stack,0x00200000,--enable-auto-import"
DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import"
: ${LIBPATHENV=""}
rb_cv_dlopen=yes],
[hiuxmpp], [ : ${LDSHARED='ld -r'}],
[atheos*], [ : ${LDSHARED='$(CC) -shared'}
rb_cv_dlopen=yes],
[os2-emx*], [ LDFLAGS="$LDFLAGS -Zomf"
],
[ : ${LDSHARED='ld'}])
AC_MSG_RESULT($rb_cv_dlopen)
fi
if test "${LDSHAREDXX}" = ""; then
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" "*], [
])
fi
AS_CASE([${RPATHFLAG}],[*'%1$'*],[: ${LIBPATHFLAG=' -L%1$-s'}],[: ${LIBPATHFLAG=' -L%s'}])
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
AC_SUBST(LINK_SO)
AC_SUBST(LIBPATHFLAG)
AC_SUBST(RPATHFLAG)
AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}")
AC_SUBST(TRY_LINK)
dln_a_out_works=no
if test "$ac_cv_header_a_out_h" = yes; then
if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then
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)])
if test "$rb_cv_dln_a_out" = yes; then
dln_a_out_works=yes
AC_DEFINE(USE_DLN_A_OUT)
fi
fi
fi
if test "$dln_a_out_works" = yes; then
if test "$GCC" = yes; then
STATIC=-static
else
STATIC=-Bstatic
fi
DLEXT=so
CCDLFLAGS=
else
AS_CASE(["$target_os"],
[hpux*], [
DLEXT=sl],
[darwin*], [
RUBY_APPEND_OPTION(XLDFLAGS, [-Wl,-u,_objc_msgSend])
DLEXT=bundle],
[os2-emx*], [
LOAD_RELATIVE=1
DLEXT=dll],
[cygwin*|mingw*|*djgpp*], [
LOAD_RELATIVE=1
DLEXT=so],
[
DLEXT=so])
fi
if test "$rb_cv_dlopen:$load_relative" = yes:yes; then
AC_CHECK_FUNCS(dladdr)
if test "$ac_cv_func_dladdr" = yes; then
LOAD_RELATIVE=1
else
unset load_relative
fi
fi
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)
if test "$with_dln_a_out" = yes; then
STRIP=true
else
AC_CHECK_TOOL(STRIP, strip, :)dnl
fi
AS_CASE(["$target_os"],
[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])])
AS_CASE(["$target_os"],
dnl OS/2 environment w/ Autoconf 2.1x for EMX
[os2-emx], [
setup=Setup.emx
],
[*djgpp*], [
setup=Setup.dj
],
[
setup=Setup
])
AC_SUBST(setup)
if test "$prefix" = NONE; then
prefix=$ac_default_prefix
fi
if test x"$cross_compiling" = xyes; then
test x"$MINIRUBY" = x && MINIRUBY="${RUBY-$BASERUBY} -I`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='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
XRUBY='$(MINIRUBY)'
TEST_RUNNABLE=no
else
MINIRUBY='./miniruby$(EXEEXT) -I$(srcdir)/lib -I.'
MINIRUBY="$MINIRUBY"' -I$(EXTOUT)/common'
PREP='miniruby$(EXEEXT)'
RUNRUBY='$(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=$(EXTOUT)'
XRUBY='$(RUNRUBY)'
TEST_RUNNABLE=yes
fi
AC_SUBST(TEST_RUNNABLE)
AC_SUBST(MINIRUBY)
AC_SUBST(PREP)
AC_SUBST(RUNRUBY)
AC_SUBST(XRUBY)
AC_SUBST(EXTOUT, [${EXTOUT=.ext}])
FIRSTMAKEFILE=""
LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a'
LIBRUBY='$(LIBRUBY_A)'
LIBRUBYARG_STATIC='-l$(RUBY_SO_NAME)-static'
LIBRUBYARG='$(LIBRUBYARG_STATIC)'
SOLIBS=
AS_CASE(["$target_os"],
[cygwin*|mingw*|beos*|haiku*|darwin*|os2-emx*], [
: ${DLDLIBS=""}
],
[
DLDLIBS="$DLDLIBS -lc"
])
AC_ARG_WITH(soname,
AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]),
[RUBY_SO_NAME=$withval], [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
LIBRUBY_LDSHARED=$LDSHARED
LIBRUBY_DLDFLAGS=$DLDFLAGS
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY)'
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so'
ENABLE_SHARED=no
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared], [build a shared library for Ruby]),
[enable_shared=$enableval])
libprefix='$(libdir)'
LIBRUBY_RELATIVE=no
AS_CASE("$enable_shared", [yes], [
LIBRUBY='$(LIBRUBY_SO)'
LIBRUBYARG_SHARED='-l$(RUBY_SO_NAME)'
LIBRUBYARG='$(LIBRUBYARG_SHARED)'
test -z "$CCDLFLAGS" || CFLAGS="$CFLAGS $CCDLFLAGS"
ENABLE_SHARED=yes
if test "$rb_cv_binary_elf" = yes; then
SOLIBS='$(LIBS)'
fi
AS_CASE(["$target_os"],
[freebsd*|dragonfly*], [],
[
if test "$GCC" = yes; then
RUBY_TRY_LDFLAGS([${linker_flag}--no-undefined], [no_undefined=yes], [no_undefined=no])
if test "no_undefined" = yes; then
RUBY_APPEND_OPTION(EXTLDFLAGS, [${linker_flag}--no-undefined])
fi
fi
])
AS_CASE(["$target_os"],
[sunos4*], [
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
],
[linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu], [
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
if test "$load_relative" = yes; then
LIBRUBY_RPATHFLAGS="'-Wl,-rpath,\$\${ORIGIN}/../lib'"
LIBRUBY_RELATIVE=yes
fi
],
[freebsd*|dragonfly*], [
SOLIBS='$(LIBS)'
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'
if test "$rb_cv_binary_elf" != "yes" ; then
LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)"
LIBRUBY_ALIASES=''
fi
],
[netbsd*], [
SOLIBS='$(LIBS)'
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR).$(TEENY)'
LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'
if test "$rb_cv_binary_elf" = yes; then # ELF platforms
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_SO_NAME).so'
else # a.out platforms
LIBRUBY_ALIASES=""
fi
],
[openbsd*], [
SOLIBS='$(LIBS)'
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}`
],
[solaris*], [
SOLIBS='$(LIBS)'
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)'
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY) lib$(RUBY_SO_NAME).so'
if test "$GCC" = yes; then
LIBRUBY_DLDFLAGS="$DLDFLAGS "'-Wl,-h,$(@F)'
else
LIBRUBY_DLDFLAGS="$DLDFLAGS "'-h $(@F)'
fi
XLDFLAGS="$XLDFLAGS "'-R${libdir}'
],
[hpux*], [
XLDFLAGS="$XLDFLAGS "'-Wl,+s,+b,$(libdir)'
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
LIBRUBY_SO='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR).$(TEENY)'
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).sl'
],
[aix*], [
LIBRUBY_DLDFLAGS="${linker_flag}-bnoentry $XLDFLAGS"
LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}'
SOLIBS='-lm -lc'
],
[beos*], [
AS_CASE(["$target_cpu"],
[powerpc*], [
LIBRUBY_DLDFLAGS='-f ruby.exp -lnet -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
])
],
[darwin*], [
RUBY_SO_NAME="$RUBY_SO_NAME"'.$(MAJOR).$(MINOR).$(TEENY)'
LIBRUBY_LDSHARED='$(CC) -dynamiclib'
if test "$load_relative" = yes; then
libprefix='@executable_path/../lib'
LIBRUBY_RELATIVE=yes
fi
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-install_name '${libprefix}'/$(LIBRUBY_SO)'
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(MAJOR).$(MINOR).$(TEENY)'
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-compatibility_version $(ruby_version)'
if test "$visibility_option" = ld; then
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_Init_*'
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,*_threadptr_*'
fi
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "' $(XLDFLAGS)'
LIBRUBY_SO='lib$(RUBY_SO_NAME).dylib'
LIBRUBY_ALIASES='lib$(RUBY_BASE_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_INSTALL_NAME).dylib'
],
[interix*], [
LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)'
])
], [
LIBRUBYARG_SHARED=
# enable PIE if possible
if test "$GCC" = yes; then
RUBY_TRY_CFLAGS(-fPIE, [pie=yes], [pie=no])
if test "$pie" = yes; then
RUBY_APPEND_OPTION(XCFLAGS, -fPIE)
for pie in -pie -Wl,-pie; do
RUBY_TRY_LDFLAGS([$pie], [], [pie=])
if test "x$pie" != x; then
RUBY_APPEND_OPTION(XLDFLAGS, $pie)
break
fi
done
fi
fi
])
if test "$enable_rpath" = yes; then
test -z "$LIBRUBY_RPATHFLAGS" || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS "
LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${linker_flag}-R ${linker_flag}${libprefix} -L\$(libdir)"
LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED"
LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC"
fi
AC_SUBST(LIBRUBY_RELATIVE)
LDFLAGS="-L. $LDFLAGS"
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
AC_SUBST(ARCHFILE)
if test "$EXEEXT" = .exe; then
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)
fi
dnl }
dnl build section {
dnl build rdoc index if requested
RDOCTARGET=""
CAPITARGET=""
AC_ARG_ENABLE(install-doc,
AS_HELP_STRING([--disable-install-doc], [do not install neither rdoc indexes nor 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=yes])
if test "$install_doc" != no; then
if test "$install_rdoc" != no; then
RDOCTARGET="rdoc"
else
RDOCTARGET="nodoc"
fi
if test "$install_capi" != no -a -n "$DOXYGEN"; then
CAPITARGET="capi"
else
CAPITARGET="nodoc"
fi
else
RDOCTARGET="nodoc"
CAPITARGET="nodoc"
fi
AC_SUBST(RDOCTARGET)
AC_SUBST(CAPITARGET)
AS_CASE(["$RDOCTARGET:$CAPITARGET"],[nodoc:nodoc],[INSTALLDOC=nodoc],[INSTALLDOC=all])
AC_SUBST(INSTALLDOC)
if test "$rb_with_pthread" = "yes"; then
THREAD_MODEL=pthread
fi
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=''
MINIDLNOBJ=dmydln.o
AS_CASE(["$target_os"],
[linux*], [
],
[netbsd*], [
RUBY_APPEND_OPTION(CFLAGS, -pipe)
],
[darwin*], [
RUBY_APPEND_OPTION(CFLAGS, -pipe)
],
[os2-emx], [
AC_LIBOBJ([os2])
CFLAGS="$CFLAGS -DOS2"
LIBRUBY_A=`echo $LIBRUBY_A | sed 's/^lib//'`
LIBRUBY_SO=`echo $LIBRUBY_SO | sed 's/^lib//'`
LIBRUBY_ALIASES=`for i in $LIBRUBY_ALIASES; do echo "$i"; done | sed 's/^lib//'`
],
[osf*], [
if test "$GCC" != "yes" ; then
# 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"
fi
],
[beos*], [
AS_CASE(["$target_cpu"],[powerpc*], [CFLAGS="$CFLAGS -relax_pointers"])
CPPFLAGS="$CPPFLAGS -I/boot/home/config/include"
],
[cygwin*|mingw*], [
RUBY_SO_NAME="${RUBY_SO_NAME}${MAJOR}${MINOR}${TEENY}"
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
AS_CASE(["$target_os"],
[cygwin*], [
if test x"$enable_shared" = xyes; then
LIBRUBY_SO='cyg$(RUBY_SO_NAME)'.dll
LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
fi
],
[mingw*], [
RUBY_SO_NAME="${rb_cv_msvcrt}-${RUBY_SO_NAME}"
if test x"${target_cpu}" != xi386; then
RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
fi
if test x"$enable_shared" = xyes; then
LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
fi
EXPORT_PREFIX=' '
DLDFLAGS="${DLDFLAGS}"' $(DEFFILE)'
* Makefile.in (PLATFORM_DIR): add a variable for `win32` directory. * Makefile.in (clean-platform): add new target. It cleans `win32` directory. * common.mk (clean): add a dependency for `win32` directory. * common.mk (distclean): ditto. * common.mk (distclean-platform): add new target. It cleans `win32` directory. * common.mk ($(PLATFORM_D)): add new target to make `win32` directory. * common.mk (win32/win32.$(OBJEXT)): move win32.o into `win32` directory. * common.mk (win32/file.$(OBJEXT)): add new target for win32/file.c. * configure.in: move win32.o into `win32` directory and add win32/file.o to MISSING. * file.c (file_load_ok, rb_file_load_ok): replace static file_load_ok() with public rb_file_load_ok(). It's to link Windows implementation in win32/file.c. * file.c (rb_find_file_ext_safe): ditto. * file.c (rb_find_file_safe): ditto. * win32/file.c (rb_file_load_ok): new file. Add Windows specific optimized implementation of rb_file_load_ok(). We created a separated file to avoid too many #ifdef macro which is unreadable. * win32/Makefile.sub (PLATFORM_DIR): add a variable for `win32` directory. * win32/Makefile.sub (MISSING): move win32.obj into `win32` directory and add win32/file.obj to MISSING. * win32/Makefile.sub (MAKEDIRS): replace MINIRUBY with BASERUBY. It's because miniruby doesn't exist when making `win32` directory. * win32/Makefile.sub (clean-platform): add new target to clean `win32` directory. * win32/Makefile.sub ({$(srcdir)}.c{}.obj): make it not match win32/file.c to build properly. * win32/Makefile.sub (win32/win32.$(OBJEXT)): move win32.obj into `win32` directory. Patch created with Luis Lavena. [ruby-core:42480] [Feature #5999] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28 19:51:25 +04:00
AC_LIBOBJ([win32/win32])
AC_LIBOBJ([win32/file])
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
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)'
if test x"$enable_shared" = xyes; then
LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
else
LIBRUBY_SO=dummy
LIBRUBY='lib$(RUBY_SO_NAME).a'
LIBRUBYARG='-l$(RUBY_SO_NAME)'
fi
],
[hpux*], [
AS_CASE(["$YACC"],[*yacc*], [
XCFLAGS="$XCFLAGS -DYYMAXDEPTH=300"
YACC="$YACC -Nl40000 -Nm40000"
])])
MINIOBJS="$MINIDLNOBJ"
AS_CASE(["$THREAD_MODEL"],
[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_DEFINE(RUBY_DEBUG_ENV)])
AS_CASE(["$FIRSTMAKEFILE"], [*GNUmakefile:*], [gnumake=yes], [
AC_MSG_CHECKING([for 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*], [
echo "include Makefile" > GNUmakefile
echo "-include uncommon.mk" >> GNUmakefile
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
echo 'A=1' > conftest.dir/Makefile
echo 'B=$(A:1=@:)' >> conftest.dir/Makefile
echo 'all:; $B 1 2 3 4 5 6 7 8 9' >> conftest.dir/Makefile
if (cd conftest.dir; ${MAKE-make} >/dev/null 2>/dev/null); then
NULLCMD=:
else
echo 'A=1' > conftest.dir/Makefile
echo 'B=$(A:1=@true)' >> conftest.dir/Makefile
echo 'all:; $B 1 2 3 4 5 6 7 8 9' >> conftest.dir/Makefile
if (cd conftest.dir; ${MAKE-make} >/dev/null 2>/dev/null); then
NULLCMD=true
else
AC_MSG_ERROR(no candidate for safe null command)
fi
fi
rm -fr conftest.dir
AC_MSG_RESULT($NULLCMD)
])
AC_SUBST(NULLCMD)
if test "${universal_binary-no}" = yes ; then
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([yes])], [AC_MSG_RESULT([no])])
done
mv -f confdefs1.h confdefs.h
AC_MSG_ERROR([failed])
])])
fi
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
if test -n "${cflags+set}"; then
cflagspat=`eval echo '"'"${cflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/^ *$/ /'`
CFLAGS=`echo " $CFLAGS " | sed "s|$cflagspat"'|${cflags}|;s/^ *//;s/ *$//'`
fi
if test -n "${cxxflags+set}"; then
cxxflagspat=`eval echo '"'"${cxxflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/^ *$/ /'`
CXXFLAGS=`echo " $CXXFLAGS " | sed "s|$cxxflagspat"'|${cxxflags}|;s/^ *//;s/ *$//'`
fi
if test "${ARCH_FLAG}"; then
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"'||'`
fi
warnflags="$rb_cv_warnflags"
AC_SUBST(cppflags, [])dnl
AC_SUBST(cflags, ["$orig_cflags "'${optflags} ${debugflags} ${warnflags}'])dnl
AC_SUBST(cxxflags, ["$orig_cxxflags "'${optflags} ${debugflags} ${warnflags}'])dnl
AC_SUBST(optflags)dnl
AC_SUBST(debugflags)dnl
AC_SUBST(warnflags)dnl
* gc.c (Init_stack): stack region is far smaller than usual if pthread is used. * marshal.c (w_extended): singleton methods should not be checked when dumping via marshal_dump() or _dump(). [ruby-talk:85909] * file.c (getcwdofdrv): avoid using getcwd() directly, use my_getcwd() instead. * merged NeXT, OpenStep, Rhapsody ports patch from Eric Sunshine <sunshine@sunshineco.com>. [ruby-core:01596] * marshal.c (w_object): LINK check earlier than anything else, i.e. do not dump TYPE_IVAR for already dumped objects. (ruby-bugs PR#1220) * eval.c (rb_eval): call "inherited" only when a new class is generated; not on reopening. * eval.c (eval): prepend error position in evaluating string to * configure.in: revived NextStep, OpenStep, and Rhapsody ports which had become unbuildable; enhanced --enable-fat-binary option so that it accepts a list of desired architectures (rather than assuming a fixed list), or defaults to a platform-appropriate list if user does not provide an explicit list; made the default list of architectures for MAB (fat binary) more comprehensive; now uses -fno-common even when building the interpreter (in addition to using it for extensions), thus allowing the interpreter to be embedded into a plugin module of an external project (in addition to allowing embedding directly into an application); added checks for <netinet/in_systm.h> (needed by `socket' extension) and getcwd(); now ensures that -I/usr/local/include is employed when extensions' extconf.rb scripts invoke have_header() since extension checks on NextStep and OpenStep will fail without it if the desired resource resides in the /usr/local tree; fixed formatting of --help message. * Makefile.in: $(LIBRUBY_A) rule now deletes the archive before invoking $(AR) since `ar' on Apple/NeXT can not "update" MAB archives (see configure's --enable-fat-binary option); added rule for new missing/getcwd.c. * defines.h: fixed endian handling during MAB build (see configure's --enable-fat-binary option) to ensure that all portions of the project see the correct WORDS_BIGENDIAN value (some extension modules were getting the wrong endian setting); added missing constants GETPGRP_VOID, WNOHANG, WUNTRACED, X_OK, and type pid_t for NextStep and OpenStep; removed unnecessary and problematic HAVE_SYS_WAIT_H define in NeXT section. * dir.c: do not allow NAMLEN() macro to trust dirent::d_namlen on NextStep since, on some installations, this value always resolves uselessly to zero. * dln.c: added error reporting to NextStep extension loader since the previous behavior of failing silently was not useful; now ensures that NSLINKMODULE_OPTION_BINDNOW compatibility constant is defined for OpenStep and Rhapsody; no longer includes <mach-o/dyld.h> twice on Rhapsody since this header lacks multiple-include protection, which resulted in "redefinition" compilation errors. * main.c: also create hard reference to objc_msgSend() on NeXT platforms (in addition to Apple platforms). * lib/mkmf.rb: now exports XCFLAGS from configure script to extension makefiles so that extensions can be built MAB (see configure's --enable-fat-binary option); also utilize XCFLAGS in cc_command() (but not cpp_command() because MAB flags are incompatible with direct invocation of `cpp'). * ext/curses/extconf.rb: now additionally checks for presence of these curses functions which are not present on NextStep or Openstep: bkgd(), bkgdset(), color(), curs(), getbkgd(), init(), scrl(), set(), setscrreg(), wattroff(), wattron(), wattrset(), wbkgd(), wbkgdset(), wscrl(), wsetscrreg() * ext/curses/curses.c: added appropriate #ifdef's for additional set of curses functions now checked by extconf.rb; fixed curses_bkgd() and window_bkgd() to correctly return boolean result rather than numeric result; fixed window_getbkgd() to correctly signal an error by returning nil rather than -1. * ext/etc/etc.c: setup_passwd() and setup_group() now check for null pointers before invoking rb_tainted_str_new2() upon fields extracted from `struct passwd' and `struct group' since null pointers in some fields are common on NextStep/OpenStep (especially so for the `pw_comment' field) and rb_tainted_str_new2() throws an exception when it receives a null pointer. * ext/pty/pty.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(). * ext/socket/getaddrinfo.c: cast first argument of getservbyname(), gethostbyaddr(), and gethostbyname() from (const char*) to non-const (char*) for older platforms such as NextStep and OpenStep. * ext/socket/socket.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(); include <netinet/in_systm.h> if present for NextStep and OpenStep; cast first argument of gethostbyaddr() and getservbyname() from (const char*) to non-const (char*) for older platforms. * ext/syslog/syslog.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-22 07:00:03 +03:00
AC_SUBST(XCFLAGS)dnl
AC_SUBST(XLDFLAGS)dnl
AC_SUBST(EXTLDFLAGS)dnl
AC_SUBST(LIBRUBY_LDSHARED)
AC_SUBST(LIBRUBY_DLDFLAGS)
AC_SUBST(RUBY_INSTALL_NAME)
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
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_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)
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
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)
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
MAKEFILES="Makefile `echo $FIRSTMAKEFILE | sed 's/:.*//'`"
* configure.in (XCFLAGS): CFLAGS to comile ruby itself. * configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 18:17:44 +04:00
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(["$target_os"],
[cygwin*|mingw*], [
RUBYW_INSTALL_NAME="${ri_prefix}"'$(RUBYW_BASE_NAME)'"${ri_suffix}"
rubyw_install_name='$(RUBYW_INSTALL_NAME)'
])
rubylibprefix='${libdir}/${RUBY_BASE_NAME}'
AC_ARG_WITH(rubylibprefix,
AS_HELP_STRING([--with-rubylibprefix=DIR], [prefix for ruby libraries [[LIBDIR/RUBY_BASE_NAME]]]),
[if test "x$withval" = xno; then
AC_MSG_ERROR([No ruby, No libprefix])
fi
rubylibprefix="$withval"])
RUBY_LIB_PREFIX=`eval echo \\"${rubylibprefix}\\"`
AC_SUBST(rubylibprefix)
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])
RIDIR=`eval echo \\"${ridir}\\"`
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(["$ruby_version"],
[full], [RUBY_LIB_VERSION_STYLE='3 /* full */'],
[minor], [RUBY_LIB_VERSION_STYLE='2 /* minor */'])
if test ${RUBY_LIB_VERSION_STYLE+set}; then
{
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 "verconf.h"'
echo '#include "version.h"'
echo 'ruby_version=RUBY_LIB_VERSION'
} > conftest.c
test -f verconf.h || > verconf.h
ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
eval $ruby_version
else
RUBY_LIB_VERSION="\"${ruby_version}\""
fi
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'])
dir="${sitedir}"
until SITE_DIR=`eval echo \\"${dir}\\"`; test "x${dir}" = "x${SITE_DIR}"; do
dir="${SITE_DIR}"
done
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'])
dir="${vendordir}"
until VENDOR_DIR=`eval echo \\"${dir}\\"`; test "x${dir}" = "x${VENDOR_DIR}"; do
dir="${VENDOR_DIR}"
done
if test "${LOAD_RELATIVE+set}"; then
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
RUBY_EXEC_PREFIX=""
RUBY_LIB_PREFIX="`eval echo "$RUBY_LIB_PREFIX" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
RUBY_SITE_LIB_PATH="`eval echo "$SITE_DIR" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
RUBY_VENDOR_LIB_PATH="`eval echo "$VENDOR_DIR" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
else
RUBY_EXEC_PREFIX="`eval echo \\"$exec_prefix/\\" | sed 's|^NONE/|'"$prefix"'/|;s|/$||'`"
RUBY_LIB_PREFIX="`eval echo \\"$RUBY_LIB_PREFIX\\" | sed 's|^NONE/|'"$prefix"'/|'`"
RUBY_SITE_LIB_PATH="`eval echo \\"$SITE_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
RUBY_VENDOR_LIB_PATH="`eval echo \\"$VENDOR_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
fi
pat=`echo "$RUBY_LIB_PREFIX/" | tr -c '\012' .`'\(.*\)'
AS_CASE(["$RUBY_SITE_LIB_PATH"],
["$RUBY_LIB_PREFIX/"*], [
RUBY_SITE_LIB_PATH='RUBY_LIB_PREFIX"/'"`expr \"$RUBY_SITE_LIB_PATH\" : \"$pat\"`"'"'
],
[
RUBY_SITE_LIB_PATH="\"${RUBY_SITE_LIB_PATH}\""
])
AS_CASE(["$RUBY_VENDOR_LIB_PATH"],
["$RUBY_LIB_PREFIX/"*], [
RUBY_VENDOR_LIB_PATH='RUBY_LIB_PREFIX"/'"`expr \"$RUBY_VENDOR_LIB_PATH\" : \"$pat\"`"'"'
],
[
RUBY_VENDOR_LIB_PATH="\"${RUBY_VENDOR_LIB_PATH}\""
])
pat=`echo "$RUBY_EXEC_PREFIX/" | tr -c '\012' .`'\(.*\)'
AS_CASE(["$RUBY_LIB_PREFIX"],
["$RUBY_EXEC_PREFIX/"*], [
RUBY_LIB_PREFIX='RUBY_EXEC_PREFIX"/'"`expr \"$RUBY_LIB_PREFIX\" : \"$pat\"`"'"'
],
[
RUBY_LIB_PREFIX="\"${RUBY_LIB_PREFIX}\""
])
if test ${RUBY_LIB_VERSION_STYLE+set}; then
AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION_STYLE, $RUBY_LIB_VERSION_STYLE !<verconf>!)
else
AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION, [$RUBY_LIB_VERSION] !<verconf>!)
fi
AC_DEFINE_UNQUOTED(RUBY_EXEC_PREFIX, "${RUBY_EXEC_PREFIX}")
AC_DEFINE_UNQUOTED(RUBY_LIB_PREFIX, ${RUBY_LIB_PREFIX} !<verconf>!)
if test "x$SITE_DIR" = xno; then
AC_DEFINE(NO_RUBY_SITE_LIB, [] !<verconf>!)
else
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, ${RUBY_SITE_LIB_PATH} !<verconf>!)
fi
if test "x$VENDOR_DIR" = xno; then
AC_DEFINE(NO_RUBY_VENDOR_LIB, [] !<verconf>!)
else
AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, ${RUBY_VENDOR_LIB_PATH} !<verconf>!)
fi
AC_SUBST(arch)dnl
AC_SUBST(sitearch)dnl
AC_SUBST(ruby_version)dnl
AC_SUBST(sitedir)dnl
AC_SUBST(vendordir)dnl
configure_args=$ac_configure_args
AC_SUBST(configure_args)dnl
if test "${universal_binary-no}" = yes ; then
arch="universal-${target_os}"
AC_CACHE_CHECK(whether __ARCHITECTURE__ is available, rb_cv_architecture_available,
AC_TRY_COMPILE([const char arch[] = __ARCHITECTURE__;], [puts(arch);],
[rb_cv_architecture_available=yes], [rb_cv_architecture_available=no]))
if test "${rb_cv_architecture_available}" = yes; then
AC_DEFINE_UNQUOTED(RUBY_PLATFORM_CPU, __ARCHITECTURE__ !<verconf>!)
else
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
fi
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}" !<verconf>!)
AC_DEFINE_UNQUOTED(RUBY_ARCH, "universal-"RUBY_PLATFORM_OS !<verconf>!)
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS !<verconf>!)
else
arch="${target_cpu}-${target_os}"
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}" !<verconf>!)
fi
unset sitearch
AS_CASE(["$target_os"],[mingw*],[sitearch="$target_cpu-$rb_cv_msvcrt"])
test ${sitearch+set} && AC_DEFINE_UNQUOTED(RUBY_SITEARCH, "${sitearch}" !<verconf>!)
: ${sitearch='${arch}'}
AC_ARG_WITH(search-path,
AS_HELP_STRING([--with-search-path=DIR], [specify the additional search path]),
[search_path=$withval])
if test "$search_path" != ""; then
AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path" !<verconf>!)
fi
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_BASE_NAME}-${ruby_version}'])
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(vendorhdrdir,
AS_HELP_STRING([--with-vendorhdrdir=DIR], [core vendor headers in DIR [[RUBYHDRDIR/vendor_ruby]]]),
[vendorhdrdir=$withval],
[vendorhdrdir='${rubyhdrdir}/vendor_ruby'])
AC_SUBST(rubyhdrdir)dnl
AC_SUBST(sitehdrdir)dnl
AC_SUBST(vendorhdrdir)dnl
AC_ARG_WITH(opt-dir,
AS_HELP_STRING([--with-opt-dir=DIR], [add optional headers and libraries DIR]))
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|doc], [MANTYPE=$withval],
[AC_MSG_ERROR(invalid man type: $withval)])
])
if test -z "$MANTYPE"; then
AC_PATH_PROGS(NROFF, nroff awf, /bin/false, "/usr/bin:/usr/ucb")
if ${NROFF} -mdoc ${srcdir}/man/ruby.1 >/dev/null 2>&1; then
MANTYPE=doc
else
MANTYPE=man
fi
fi
AC_SUBST(MANTYPE)
AC_ARG_ENABLE(rubygems,
AS_HELP_STRING([--disable-rubygems], [disable rubygems by default]),
[enable_rubygems="$enableval"], [enable_rubygems=yes])
if test x"$enable_rubygems" = xno; then
AC_DEFINE(DISABLE_RUBYGEMS, 1)
USE_RUBYGEMS=NO
else
USE_RUBYGEMS=YES
fi
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 | grep -v ' !<verconf>!$'
echo "#endif /* $guard */"
} | tr -d '\015' |
${srcdir}/tool/ifchange "${config_h}" -
sed -n 's/ !<verconf>!$//p' confdefs.h | ${srcdir}/tool/ifchange verconf.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 `basename $e .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 `basename $e .trans`"'.c';
BUILTIN_TRANSOBJS="$BUILTIN_TRANSOBJS `basename $e .trans`"'.$(OBJEXT)';
done
AC_SUBST(BUILTIN_TRANSSRCS)
AC_SUBST(BUILTIN_TRANSOBJS)
PACKAGE=$RUBY_BASE_NAME
AC_SUBST(PACKAGE)
AC_MSG_RESULT($PACKAGE library version = $ruby_version)
AS_CASE([" $CPP "], [*" $CC "*], [CPP=`echo " $CPP " | sed "s| $CC |"' $(CC) |;s/^ *//;s/ *$//'`])
AC_CONFIG_FILES($FIRSTMAKEFILE)
AC_CONFIG_FILES(Makefile, [
tmpmk=confmk$$.tmp
{
if test ${VCS+set}; then
:
elif svn info "$srcdir" > /dev/null 2>&1; then
VCS='svn'
elif test -d "$srcdir/.git/svn"; then
VCS='git svn'
elif test -d "$srcdir/.git"; then
VCS='git'
else
VCS='echo cannot'
fi
AS_CASE("$VCS",
[svn], [VCSUP='$(VCS) up $(SVNUPOPTIONS)'],
["git svn"], [VCSUP='$(VCS) rebase $(GITSVNREBASEOPTIONS)'],
[git], [VCSUP='$(VCS) pull $(GITPULLOPTIONS)'],
[VCSUP='$(VCS)'])
sed '/^MISSING/s/\$U\././g;/^VCS *=/s#@VCS@#'"$VCS"'#;/^VCSUP *=/s#@VCSUP@#'"$VCSUP"'#' Makefile
echo; test x"$EXEEXT" = x || echo 'miniruby: miniruby$(EXEEXT)'
if test "$gnumake" != yes; then
echo ['$(MKFILES): $(srcdir)/common.mk']
sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk
else
echo 'distclean-local::; @$(RM) GNUmakefile uncommon.mk'
fi
} > $tmpmk && if ! grep '^ruby:' $tmpmk > /dev/null; then
if test "${gnumake}" = yes; then
tmpgmk=confgmk$$.tmp
{
echo "include $tmpmk"
echo "-include uncommon.mk"
} > $tmpgmk
else
tmpgmk=$tmpmk
fi &&
test -z "`${MAKE-make} -f $tmpgmk info-program | grep '^PROGRAM=ruby$'`" &&
echo 'ruby: $(PROGRAM);' >> $tmpmk
test "$tmpmk" = "$tmpgmk" || rm -f "$tmpgmk"
fi && mv -f $tmpmk Makefile],
[EXEEXT='$EXEEXT' gnumake='$gnumake'])
AC_ARG_WITH([ruby-pc],
AC_HELP_STRING([pc file basename]),
[ruby_pc="$withval"],
[ruby_pc="${RUBY_BASE_NAME}-${MAJOR}.${MINOR}.pc"])
AC_SUBST(ruby_pc)
AC_SUBST(exec, [exec])
AC_CONFIG_FILES($ruby_pc:template/ruby.pc.in,
[
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
}
then
mv -f ruby.tmp.pc $ruby_pc
else
exit 1
fi
],
[ruby_pc='$ruby_pc' PKG_CONFIG='$PKG_CONFIG'])
AC_OUTPUT
dnl }
dnl }