зеркало из https://github.com/github/ruby.git
2144 строки
59 KiB
Plaintext
2144 строки
59 KiB
Plaintext
dnl Process this file with autoconf to produce a configure script.
|
|
AC_INIT()
|
|
|
|
AC_PREREQ(2.60)
|
|
|
|
AC_ARG_WITH(baseruby,
|
|
[ --with-baseruby=RUBY use RUBY as baseruby; RUBY is the pathname of ruby],
|
|
[
|
|
case "$withval" in
|
|
*ruby*)
|
|
BASERUBY=$withval
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR(need ruby)
|
|
;;
|
|
esac
|
|
],
|
|
[
|
|
BASERUBY="ruby"
|
|
])
|
|
test "`$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],
|
|
[case "$host_os" in
|
|
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*])
|
|
test "$rb_cv_mingw32" = yes && target_os="mingw32"
|
|
;;
|
|
esac])
|
|
|
|
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)])
|
|
|
|
unset GREP_OPTIONS
|
|
rb_version=`grep RUBY_VERSION $srcdir/version.h`
|
|
MAJOR=`expr "$rb_version" : '#define RUBY_VERSION "\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*"'`
|
|
MINOR=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*"'`
|
|
TEENY=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)"'`
|
|
if test "$MAJOR" = ""; then
|
|
AC_MSG_ERROR(could not determine MAJOR number from version.h)
|
|
fi
|
|
if test "$MINOR" = ""; then
|
|
AC_MSG_ERROR(could not determine MINOR number from version.h)
|
|
fi
|
|
if test "$TEENY" = ""; then
|
|
AC_MSG_ERROR(could not determine TEENY number from version.h)
|
|
fi
|
|
AC_SUBST(MAJOR)
|
|
AC_SUBST(MINOR)
|
|
AC_SUBST(TEENY)
|
|
dnl checks for alternative programs
|
|
AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
|
|
case $withval in
|
|
no) : ${CC=cc}
|
|
;;
|
|
yes) : ${CC=gcc}
|
|
;;
|
|
*) CC=$withval
|
|
;;
|
|
esac])
|
|
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
|
|
|
|
if test "$program_prefix" = NONE; then
|
|
program_prefix=
|
|
fi
|
|
|
|
AC_CANONICAL_TARGET
|
|
target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
|
|
ac_install_sh='' # unusable for extension libraries.
|
|
|
|
ifelse(currently,disabled, [
|
|
dnl checks for fat-binary
|
|
AC_ARG_ENABLE(fat-binary,
|
|
[ --enable-fat-binary=ARCHS
|
|
build an Apple/NeXT Multi Architecture Binary (MAB);
|
|
ARCHS is a comma-delimited list of architectures for
|
|
which to build; if ARCHS is omitted, then the package
|
|
will be built for all architectures supported by the
|
|
platform ("ppc" for MacOS/X and Darwin; "ppc,i386"
|
|
for Rhapsody; "m68k,i386,sparc" for OpenStep;
|
|
"m68k,i386,sparc,hppa" for NextStep); if this option
|
|
is disabled or omitted entirely, then the package
|
|
will be built only for the target platform],
|
|
[fat_binary=$enableval], [fat_binary=no])
|
|
if test "$fat_binary" != no; then
|
|
|
|
AC_MSG_CHECKING([target architectures])
|
|
|
|
# Respect TARGET_ARCHS setting from environment if available.
|
|
if test -z "$TARGET_ARCHS"; then
|
|
# Respect ARCH given to --enable-fat-binary if present.
|
|
if test "$fat_binary" != yes; then
|
|
TARGET_ARCHS=`echo "$fat_binary" | tr ',' ' '`
|
|
else
|
|
# Choose a default set of architectures based upon platform.
|
|
case "$target_os" in
|
|
darwin*)
|
|
TARGET_ARCHS="ppc"
|
|
;;
|
|
rhapsody*)
|
|
TARGET_ARCHS="ppc i386"
|
|
;;
|
|
openstep*)
|
|
TARGET_ARCHS="m68k i386 sparc"
|
|
;;
|
|
nextstep*)
|
|
TARGET_ARCHS="m68k i386 sparc hppa"
|
|
;;
|
|
*)
|
|
TARGET_ARCHS=`arch`
|
|
esac
|
|
fi
|
|
fi
|
|
|
|
AC_MSG_RESULT([$TARGET_ARCHS])
|
|
|
|
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
|
|
ARCH_FLAG=
|
|
for archs in $TARGET_ARCHS
|
|
do
|
|
ARCH_FLAG="$ARCH_FLAG -arch $archs"
|
|
done
|
|
AC_DEFINE(NEXT_FAT_BINARY)
|
|
fi
|
|
], [fat_binary=no])
|
|
|
|
case $target_cpu in
|
|
i?86) frame_address=yes;;
|
|
*) frame_address=no;;
|
|
esac
|
|
AC_ARG_ENABLE(frame-address,
|
|
[ --enable-frame-address use GCC __builtin_frame_address(). ],
|
|
[frame_address=$enableval])
|
|
if test $frame_address = yes; then
|
|
AC_DEFINE(USE_BUILTIN_FRAME_ADDRESS)
|
|
fi
|
|
|
|
AC_ARG_PROGRAM
|
|
|
|
dnl Checks for programs.
|
|
|
|
: ${CFLAGS=} ${cflags='${optflags} ${debugflags} ${warnflags}'}
|
|
: ${CXXFLAGS=} ${cxxflags='${optflags} ${debugflags} ${warnflags}'}
|
|
if test x"${build}" != x"${host}"; then
|
|
AC_CHECK_TOOL(CC, gcc)
|
|
fi
|
|
AC_PROG_CC
|
|
AC_PROG_CXX
|
|
AC_PROG_GCC_TRADITIONAL
|
|
test $ac_cv_prog_cc_g = yes && : ${debugflags=-g}
|
|
if test "$GCC" = yes; then
|
|
linker_flag=-Wl,
|
|
: ${optflags=-O2} ${warnflags="-Wall -Wno-parentheses"}
|
|
else
|
|
linker_flag=
|
|
fi
|
|
CFLAGS="${CFLAGS} `eval echo $cflags`"
|
|
CXXFLAGS="${CXXFLAGS} `eval echo $cxxflags`"
|
|
|
|
RUBY_PROG_GNU_LD
|
|
RUBY_CPPOUTFILE
|
|
|
|
: ${OUTFLAG='-o '}
|
|
: ${COUTFLAG=${OUTFLAG}}
|
|
AC_SUBST(OUTFLAG)
|
|
AC_SUBST(COUTFLAG)
|
|
|
|
RUBY_MINGW32
|
|
|
|
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)
|
|
|
|
AC_CHECK_TOOL(OBJDUMP, objdump)
|
|
AC_CHECK_TOOL(OBJCOPY, objcopy)
|
|
|
|
case "$target_os" in
|
|
cygwin*|mingw*)
|
|
AC_CHECK_TOOL(NM, nm)
|
|
AC_CHECK_TOOL(WINDRES, windres)
|
|
AC_CHECK_TOOL(DLLWRAP, dllwrap)
|
|
target_cpu=`echo $target_cpu | sed s/i.86/i386/`
|
|
case "$target_os" in
|
|
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])
|
|
esac
|
|
: ${enable_shared=yes}
|
|
;;
|
|
aix*)
|
|
AC_CHECK_TOOL(NM, nm, /usr/ccs/bin/nm, /usr/ccs/bin:$PATH)
|
|
;;
|
|
hiuxmpp*)
|
|
# by TOYODA Eizi <toyoda@npd.kishou.go.jp>
|
|
AC_DEFINE(__HIUX_MPP__)
|
|
;;
|
|
esac
|
|
|
|
AC_PROG_LN_S
|
|
AC_PROG_MAKE_SET
|
|
AC_PROG_INSTALL
|
|
|
|
# checks for UNIX variants that set C preprocessor variables
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
AC_SUBST(RM, ['rm -f'])
|
|
AC_SUBST(CP, ['cp'])
|
|
if $as_mkdir_p; then
|
|
MAKEDIRS='mkdir -p'
|
|
else
|
|
MAKEDIRS='install -d'
|
|
fi
|
|
AC_SUBST(MAKEDIRS)
|
|
|
|
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
|
|
|
|
case "$target_os" in
|
|
mingw*)
|
|
ac_cv_type_off_t=yes
|
|
ac_cv_sizeof_off_t=8
|
|
;;
|
|
esac
|
|
|
|
AC_CHECK_TYPES([long long, off_t])
|
|
|
|
AC_CHECK_SIZEOF(int, 4)
|
|
AC_CHECK_SIZEOF(short, 2)
|
|
AC_CHECK_SIZEOF(long, 4)
|
|
AC_CHECK_SIZEOF(long long, 0)
|
|
AC_CHECK_SIZEOF(__int64, 0)
|
|
AC_CHECK_SIZEOF(off_t, 0)
|
|
AC_CHECK_SIZEOF(void*, 4)
|
|
AC_CHECK_SIZEOF(float, 4)
|
|
AC_CHECK_SIZEOF(double, 8)
|
|
AC_CHECK_SIZEOF(time_t, 0)
|
|
|
|
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
|
|
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
|
|
AC_CHECK_TYPE([$1],
|
|
[AC_DEFINE_UNQUOTED(rb_[$1], [$1])],
|
|
[AC_DEFINE_UNQUOTED(rb_[$1], [$2])],
|
|
[$4])
|
|
AC_CACHE_CHECK([for convertible type of [$1]], rb_cv_[$1]_convertible, [
|
|
u= t=
|
|
AC_COMPILE_IFELSE(
|
|
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT]
|
|
[$4], [(rb_[$1])-1 > 0])],
|
|
[u=U])
|
|
if test x"$t" = x; then
|
|
AC_COMPILE_IFELSE(
|
|
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT]
|
|
[$4], [sizeof(rb_[$1]) > sizeof(long)])],
|
|
[t=LL])
|
|
fi
|
|
if test x"$t" = x; then
|
|
AC_COMPILE_IFELSE(
|
|
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT]
|
|
[$4], [sizeof(rb_[$1]) == sizeof(long)])],
|
|
[t=LONG])
|
|
fi
|
|
if test x"$t" = x; then
|
|
t=INT
|
|
fi
|
|
rb_cv_[$1]_convertible=${u}${t}])
|
|
AC_DEFINE_UNQUOTED([$3]2NUM[(v)], [${rb_cv_[$1]_convertible}2NUM(v)])
|
|
AC_DEFINE_UNQUOTED(NUM2[$3][(v)], [NUM2${rb_cv_[$1]_convertible}(v)])
|
|
])
|
|
RUBY_REPLACE_TYPE(pid_t, int, PIDT)
|
|
RUBY_REPLACE_TYPE(uid_t, int, UIDT)
|
|
RUBY_REPLACE_TYPE(gid_t, int, GIDT)
|
|
|
|
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([@%:@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_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
|
|
AC_CACHE_CHECK(for [$1] function attribute, rbcv,
|
|
[rbcv=x
|
|
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
|
|
for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do
|
|
AC_TRY_COMPILE(
|
|
[#define ]attrib[(x) $mac
|
|
]attrib[(void conftest_attribute_check(void));], [],
|
|
[rbcv="$mac"; break])
|
|
done
|
|
if test "${rb_c_werror_flag+set}"; then
|
|
ac_c_werror_flag="$rb_c_werror_flag"
|
|
else
|
|
unset ac_c_werror_flag
|
|
fi
|
|
])
|
|
AC_DEFINE_UNQUOTED(attrib[(x)], $rbcv)
|
|
AS_VAR_POPDEF([attrib])
|
|
AS_VAR_POPDEF([rbcv])
|
|
])
|
|
|
|
RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
|
|
RUBY_FUNC_ATTRIBUTE(deprecated, DEPRECATED)
|
|
RUBY_FUNC_ATTRIBUTE(noinline, NOINLINE)
|
|
RUBY_FUNC_ATTRIBUTE(stdcall)
|
|
RUBY_FUNC_ATTRIBUTE(cdecl)
|
|
RUBY_FUNC_ATTRIBUTE(fastcall)
|
|
|
|
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([RUBY_ALIAS_FUNCTION(old_prot, new_name, args)],
|
|
[VALUE old_prot {return new_name args;}])
|
|
else
|
|
AC_DEFINE_UNQUOTED([RUBY_ALIAS_FUNCTION(old_prot, new_name, args)],
|
|
[VALUE old_prot __attribute__(($rb_cv_gcc_function_alias(@%:@new_name)));])
|
|
fi
|
|
fi
|
|
|
|
AC_CACHE_CHECK([for RUBY_EXTERN], rb_cv_ruby_extern,
|
|
[rb_cv_ruby_extern=no
|
|
for mac in "__attribute__((dllimport))" "__declspec(dllimport)"; do
|
|
AC_TRY_COMPILE(
|
|
[extern $mac void conftest(void);],
|
|
[rb_cv_ruby_extern="extern $mac"; break])
|
|
done])
|
|
test "x$rb_cv_ruby_extern" = xno || AC_DEFINE_UNQUOTED(RUBY_EXTERN, $rb_cv_ruby_extern)
|
|
|
|
XCFLAGS="$XCFLAGS -DRUBY_EXPORT"
|
|
|
|
dnl Check whether we need to define sys_nerr locally
|
|
AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
|
|
#include <errno.h>])
|
|
|
|
case "$target_os" in
|
|
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_default=$rb_cv_enable_pthread_default
|
|
;;
|
|
mingw*)
|
|
enable_pthread_default=no
|
|
;;
|
|
*)
|
|
enable_pthread_default=yes
|
|
;;
|
|
esac
|
|
|
|
AC_ARG_ENABLE(pthread,
|
|
[ --enable-pthread use pthread library.],
|
|
[enable_pthread=$enableval], [enable_pthread=$enable_pthread_default])
|
|
|
|
dnl Checks for libraries.
|
|
case "$target_os" in
|
|
nextstep*) ;;
|
|
openstep*) ;;
|
|
rhapsody*) ;;
|
|
darwin*) LIBS="-lobjc $LIBS"
|
|
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE"
|
|
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
|
|
],
|
|
[
|
|
test "x$target_cpu" = xpowerpc && ac_cv_header_ucontext_h=no
|
|
],
|
|
[
|
|
AC_DEFINE(BROKEN_SETREUID, 1)
|
|
AC_DEFINE(BROKEN_SETREGID, 1)
|
|
])
|
|
ac_cv_lib_crypt_crypt=no
|
|
AC_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt,
|
|
[AC_TRY_RUN([
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
int
|
|
main()
|
|
{
|
|
char buf[256];
|
|
strcpy(buf, crypt("", "\xE0\xA0"));
|
|
return strcmp(buf, crypt("", "\xE0\xA0"));
|
|
}
|
|
],
|
|
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;;
|
|
human*) ac_cv_func_getpgrp_void=yes
|
|
ac_cv_func_setitimer=no
|
|
;;
|
|
beos*|haiku*) ac_cv_func_link=no
|
|
ac_cv_func_sched_yield=no
|
|
ac_cv_func_pthread_attr_setinheritsched=no
|
|
case "$target_os" in
|
|
beos*) ac_cv_header_net_socket_h=yes;;
|
|
haiku*) ac_cv_func_shutdown=no;;
|
|
esac
|
|
LIBS="$LIBS" # m lib is include in root under BeOS/Haiku
|
|
;;
|
|
cygwin*) ;;
|
|
mingw*) LIBS="-lshell32 -lws2_32 $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_snprintf=yes
|
|
ac_cv_func_vsnprintf=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_truncate=yes
|
|
ac_cv_func_fseeko=yes
|
|
ac_cv_func_ftello=yes
|
|
ac_cv_lib_crypt_crypt=no
|
|
ac_cv_func_getpgrp_void=no
|
|
ac_cv_func_setpgrp_void=yes
|
|
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
|
|
;;
|
|
os2-emx*) LIBS="-lm $LIBS"
|
|
ac_cv_lib_dir_opendir=no;;
|
|
msdosdjgpp*) LIBS="-lm $LIBS"
|
|
ac_cv_func_getpgrp_void=yes
|
|
ac_cv_func_setitimer=no
|
|
ac_cv_sizeof_rlim_t=4
|
|
ac_cv_func_fork=no
|
|
ac_cv_func_setrlimit=no
|
|
ac_cv_header_sys_socket_h=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"
|
|
;;
|
|
dragonfly*) LIBS="-lm $LIBS"
|
|
;;
|
|
bow) ac_cv_func_setitimer=no
|
|
;;
|
|
superux*) ac_cv_func_setitimer=no
|
|
;;
|
|
*) LIBS="-lm $LIBS";;
|
|
esac
|
|
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
|
|
|
|
case "$target_cpu" in
|
|
alpha*) case "$target_os"::"$GCC" in
|
|
*::yes) CFLAGS="-mieee $CFLAGS" ;; # gcc
|
|
osf*) CFLAGS="-ieee $CFLAGS" ;; # ccc
|
|
esac ;;
|
|
esac
|
|
|
|
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
|
|
AC_HEADER_STDC
|
|
AC_HEADER_SYS_WAIT
|
|
AC_CHECK_HEADERS(stdlib.h string.h unistd.h 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 memory.h direct.h sys/resource.h \
|
|
sys/mkdev.h sys/utime.h xti.h netinet/in_systm.h float.h ieeefp.h pthread.h \
|
|
ucontext.h intrinsics.h langinfo.h locale.h sys/sendfile.h time.h \
|
|
net/socket.h sys/socket.h)
|
|
|
|
dnl Check additional types.
|
|
AC_CHECK_SIZEOF(rlim_t, 0, [
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
# include <sys/types.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_TIME_H
|
|
# include <sys/time.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
|
# include <sys/resource.h>
|
|
#endif
|
|
#ifdef HAVE_UNISTD_H
|
|
# include <unistd.h>
|
|
#endif
|
|
#include <stdio.h>
|
|
])
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
AC_TYPE_SIZE_T
|
|
AC_CHECK_SIZEOF(size_t, 0)
|
|
AC_CHECK_SIZEOF(ptrdiff_t, $ac_cv_sizeof_size_t)
|
|
AC_STRUCT_ST_BLKSIZE
|
|
AC_STRUCT_ST_BLOCKS
|
|
AC_STRUCT_ST_RDEV
|
|
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_TYPE(fd_mask, [AC_DEFINE(HAVE_RB_FD_INIT, 1)])
|
|
|
|
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],
|
|
[case m4_bmatch([$2], [^[1-9][0-9]*$], $2, [$ac_cv_sizeof_]AS_TR_SH($2)) in
|
|
"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;;
|
|
esac])])
|
|
if test "${rb_cv_type_$1}" != no; then
|
|
AC_DEFINE([HAVE_]AS_TR_CPP($1), 1)
|
|
test "${rb_cv_type_$1}" = yes || AC_DEFINE_UNQUOTED($1, [$rb_cv_type_$1])
|
|
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) 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
|
|
|
|
dnl Checks for library functions.
|
|
AC_TYPE_GETGROUPS
|
|
AC_TYPE_SIGNAL
|
|
case "${target_cpu}-${target_os}" in
|
|
powerpc-darwin*)
|
|
AC_LIBSOURCES(alloca.c)
|
|
AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.${ac_objext}])
|
|
AC_DEFINE(C_ALLOCA)
|
|
AC_DEFINE_UNQUOTED(alloca, alloca)
|
|
;;
|
|
*)
|
|
AC_FUNC_ALLOCA
|
|
;;
|
|
esac
|
|
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)])
|
|
case $rb_cv_broken_glibc_ia64_erfc in
|
|
yes) ac_cv_func_erf=no;;
|
|
esac
|
|
|
|
AC_REPLACE_FUNCS(dup2 memmove strerror\
|
|
strchr strstr crypt flock vsnprintf\
|
|
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt \
|
|
strlcpy strlcat)
|
|
AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot fsync getcwd eaccess\
|
|
truncate ftruncate chsize times utimes utimensat fcntl lockf lstat\
|
|
link symlink readlink\
|
|
setitimer setruid seteuid setreuid setresuid setproctitle socketpair\
|
|
setrgid setegid setregid setresgid issetugid pause lchown lchmod\
|
|
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
|
|
getpriority getrlimit setrlimit sysconf group_member\
|
|
dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp vsnprintf snprintf\
|
|
setsid telldir seekdir fchmod cosh sinh tanh log2 round signbit\
|
|
setuid setgid daemon select_large_fdset setenv unsetenv\
|
|
mktime timegm gmtime_r clock_gettime gettimeofday\
|
|
pread sendfile shutdown sigaltstack)
|
|
|
|
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,
|
|
[ --with-setjmp-type select setjmp type], [
|
|
case $withval in
|
|
__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);;
|
|
esac], [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
|
|
case $target_os in
|
|
solaris*|cygwin*)
|
|
setjmp_prefix=;;
|
|
*)
|
|
setjmp_prefix=sig;;
|
|
esac
|
|
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,
|
|
[ --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], rb_cv_var_$1,
|
|
[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];],
|
|
[rb_cv_var_$1=$t; break])
|
|
done])])
|
|
if test "[$rb_cv_var_]$1" != no; then
|
|
AC_DEFINE([HAVE_VAR_]m4_toupper($1))
|
|
AC_DEFINE_UNQUOTED([TYPEOF_VAR_]m4_toupper($1), $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 <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
|
|
|
|
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
|
|
|
|
AC_FUNC_GETPGRP
|
|
AC_FUNC_SETPGRP
|
|
|
|
AC_C_BIGENDIAN
|
|
AC_C_CONST
|
|
AC_C_CHAR_UNSIGNED
|
|
AC_C_INLINE
|
|
AC_C_VOLATILE
|
|
|
|
if test x"$target_cpu" = xia64; then
|
|
AC_LIBOBJ([ia64])
|
|
AC_CACHE_CHECK(for __libc_ia64_register_backing_store_base,
|
|
rb_cv___libc_ia64_register_backing_store_base,
|
|
[rb_cv___libc_ia64_register_backing_store_base=no
|
|
AC_TRY_LINK(
|
|
[extern unsigned long __libc_ia64_register_backing_store_base;],
|
|
[unsigned long p = __libc_ia64_register_backing_store_base;
|
|
printf("%ld\n", p);],
|
|
[rb_cv___libc_ia64_register_backing_store_base=yes])])
|
|
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))>>y) : (x)>>y))
|
|
fi
|
|
|
|
AC_MSG_CHECKING(read count field in FILE structures)
|
|
AC_CACHE_VAL(rb_cv_fcnt,
|
|
[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,
|
|
rb_cv_fcnt="not found")
|
|
done])
|
|
if test "$rb_cv_fcnt" = "not found"; then
|
|
AC_MSG_RESULT([not found(OK if using GNU libc)])
|
|
else
|
|
AC_MSG_RESULT($rb_cv_fcnt)
|
|
AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt)
|
|
fi
|
|
|
|
AC_MSG_CHECKING(read buffer ptr field in FILE structures)
|
|
AC_CACHE_VAL(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_MSG_RESULT([not found])
|
|
else
|
|
AC_MSG_RESULT($rb_cv_frptr)
|
|
AC_DEFINE_UNQUOTED(FILE_READPTR, $rb_cv_frptr)
|
|
|
|
if test "$rb_cv_fcnt" = "not found"; then
|
|
AC_MSG_CHECKING(read buffer end field in FILE structures)
|
|
AC_CACHE_VAL(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_MSG_RESULT([not found])
|
|
else
|
|
AC_MSG_RESULT($rb_cv_frend)
|
|
AC_DEFINE_UNQUOTED(FILE_READEND, $rb_cv_frend)
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
AC_CACHE_CHECK([whether st_ino is huge], rb_cv_huge_st_ino,
|
|
[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([
|
|
#include <sys/stat.h>
|
|
struct stat test_stat;
|
|
], [sizeof(test_stat.st_ino)>sizeof(long)])],
|
|
rb_cv_huge_st_ino=yes,
|
|
rb_cv_huge_st_ino=no)
|
|
])
|
|
if test $rb_cv_huge_st_ino = yes; then
|
|
AC_DEFINE(HUGE_ST_INO)
|
|
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
|
|
|
|
case "$target_cpu" in
|
|
m68*|i?86|ia64|sparc*|alpha*) rb_cv_stack_grow_dir=-1;;
|
|
hppa*) rb_cv_stack_grow_dir=+1;;
|
|
esac
|
|
AC_CACHE_CHECK(stack growing direction, rb_cv_stack_grow_dir,
|
|
[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);
|
|
}
|
|
], rb_cv_stack_grow_dir=-1, rb_cv_stack_grow_dir=+1, rb_cv_stack_grow_dir=0)])
|
|
AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $rb_cv_stack_grow_dir)
|
|
|
|
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)
|
|
case $pthread_lib in
|
|
c)
|
|
;;
|
|
root)
|
|
;;
|
|
c_r)
|
|
MAINLIBS="-pthread $MAINLIBS"
|
|
;;
|
|
*)
|
|
LIBS="-l$pthread_lib $LIBS"
|
|
;;
|
|
esac
|
|
else
|
|
AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
|
|
fi
|
|
AC_CHECK_FUNCS(nanosleep sched_yield pthread_attr_setinheritsched)
|
|
if test x"$ac_cv_func_nanosleep" = xno; then
|
|
AC_CHECK_LIB(rt, nanosleep)
|
|
if test x"$ac_cv_lib_rt_nanosleep" = xyes; then
|
|
AC_DEFINE(HAVE_NANOSLEEP)
|
|
fi
|
|
fi
|
|
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;
|
|
}
|
|
}
|
|
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
|
|
|
|
AC_CHECK_FUNCS(backtrace)
|
|
|
|
AC_ARG_WITH(valgrind,
|
|
[ --with-valgrind enable valgrind memcheck support.],
|
|
[AC_CHECK_HEADERS(valgrind/memcheck.h)])
|
|
|
|
dnl wheather use dln_a_out or not
|
|
AC_ARG_WITH(dln-a-out,
|
|
[ --with-dln-a-out use dln_a_out if possible], [
|
|
case $withval in
|
|
dnl (
|
|
yes)
|
|
if test "$enable_shared" = yes; then
|
|
AC_MSG_ERROR(dln_a_out can not make shared library)
|
|
fi
|
|
with_dln_a_out=yes;;
|
|
dnl (
|
|
*) with_dln_a_out=no;;
|
|
esac], [with_dln_a_out=no])
|
|
|
|
AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf,
|
|
[AC_TRY_LINK([],[], [
|
|
case "`head -1 conftest$EXEEXT | cat -e`" in
|
|
dnl (
|
|
'^?ELF'*)
|
|
rb_cv_binary_elf=yes;;
|
|
dnl (
|
|
*)
|
|
rb_cv_binary_elf=no;;
|
|
esac],
|
|
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
|
|
fi
|
|
|
|
case "$target_os" in
|
|
linux* | gnu* | k*bsd*-gnu | bsdi*)
|
|
if test "$rb_cv_binary_elf" = no; then
|
|
with_dln_a_out=yes
|
|
else
|
|
LDFLAGS="$LDFLAGS -rdynamic"
|
|
fi;;
|
|
esac
|
|
LIBEXT=a
|
|
|
|
AC_SUBST(DLDFLAGS)dnl
|
|
AC_SUBST(ARCH_FLAG)dnl
|
|
|
|
AC_SUBST(STATIC)dnl
|
|
AC_SUBST(CCDLFLAGS)dnl
|
|
AC_SUBST(LDSHARED)dnl
|
|
AC_SUBST(LDSHAREDXX)dnl
|
|
AC_SUBST(DLEXT)dnl
|
|
AC_SUBST(DLEXT2)dnl
|
|
AC_SUBST(LIBEXT)dnl
|
|
|
|
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
|
|
case "$target_os" in
|
|
nextstep*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
|
|
openstep*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
|
|
rhapsody*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
|
|
darwin*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
|
|
human*|bsdi*|beos*|haiku*|cygwin*|mingw*|aix*|interix*) ;;
|
|
*) CCDLFLAGS="$CCDLFLAGS -fPIC";;
|
|
esac
|
|
else
|
|
case "$target_os" in
|
|
hpux*) CCDLFLAGS="$CCDLFLAGS +Z";;
|
|
solaris*|irix*) CCDLFLAGS="$CCDLFLAGS -KPIC" ;;
|
|
sunos*) CCDLFLAGS="$CCDLFLAGS -PIC" ;;
|
|
esix*|uxpds*) CCDLFLAGS="$CCDLFLAGS -KPIC" ;;
|
|
*) : ${CCDLFLAGS=""} ;;
|
|
esac
|
|
fi
|
|
|
|
|
|
AC_ARG_ENABLE(rpath,
|
|
[ --disable-rpath embed run path into extension libraries.],
|
|
[enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
|
|
if test "$enable_rpath" = yes; then
|
|
RPATHFLAG=" ${linker_flag}-R%1\$-s"
|
|
fi
|
|
|
|
case "$target_os" in
|
|
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='ld -G'}
|
|
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="qcc -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*) case "$CC" in
|
|
*shlicc*) : ${LDSHARED="$CC -r"}
|
|
rb_cv_dlopen=yes ;;
|
|
esac ;;
|
|
linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi*)
|
|
: ${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 ;;
|
|
nextstep*) : ${LDSHARED='cc -r -nostdlib'}
|
|
LDFLAGS="$LDFLAGS -u libsys_s"
|
|
rb_cv_dlopen=yes ;;
|
|
openstep*) : ${LDSHARED='cc -dynamic -bundle -undefined suppress'}
|
|
: ${LDFLAGS=""}
|
|
rb_cv_dlopen=yes ;;
|
|
rhapsody*) : ${LDSHARED='cc -dynamic -bundle -undefined suppress'}
|
|
: ${LDFLAGS=""}
|
|
rb_cv_dlopen=yes ;;
|
|
darwin*) : ${LDSHARED='cc -dynamic -bundle -undefined suppress -flat_namespace'}
|
|
: ${LDFLAGS=""}
|
|
: ${LIBPATHENV=DYLD_LIBRARY_PATH}
|
|
rb_cv_dlopen=yes ;;
|
|
aix*) if test "$GCC" = yes; then
|
|
: ${LDSHARED='$(CC) -shared'}
|
|
else
|
|
: ${LDSHARED='$(CC)'}
|
|
fi
|
|
LDSHARED="$LDSHARED ${linker_flag}-G"
|
|
DLDFLAGS='-eInit_$(TARGET)'
|
|
XLDFLAGS="${linker_flag}-bE:ruby.imp ${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"
|
|
rb_cv_dlopen=yes ;;
|
|
human*) : ${DLDFLAGS=''}
|
|
: ${LDSHARED=''}
|
|
: ${LDFLAGS=''}
|
|
: ${LINK_SO='ar cru $@ $(OBJS)'}
|
|
rb_cv_dlopen=yes ;;
|
|
beos*) case "$target_cpu" in
|
|
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"
|
|
;;
|
|
esac
|
|
: ${LIBPATHENV=LIBRARY_PATH}
|
|
rb_cv_dlopen=yes ;;
|
|
haiku*) case "$target_cpu" in
|
|
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"
|
|
;;
|
|
esac
|
|
: ${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,--export-all"
|
|
: ${LIBPATHENV=""}
|
|
rb_cv_dlopen=yes ;;
|
|
hiuxmpp) : ${LDSHARED='ld -r'} ;;
|
|
atheos*) : ${LDSHARED="$CC -shared"}
|
|
rb_cv_dlopen=yes ;;
|
|
os2-emx*) LDFLAGS="$LDFLAGS -Zomf"
|
|
;;
|
|
*) : ${LDSHARED='ld'} ;;
|
|
esac
|
|
AC_MSG_RESULT($rb_cv_dlopen)
|
|
fi
|
|
if test "${LDSHAREDXX}" = ""; then
|
|
case "${LDSHARED}" in
|
|
*'$(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" "*)
|
|
;;
|
|
esac
|
|
fi
|
|
case ${RPATHFLAG} in
|
|
*'%1$'*)
|
|
: ${LIBPATHFLAG=' -L%1$-s'};;
|
|
*)
|
|
: ${LIBPATHFLAG=' -L%s'};;
|
|
esac
|
|
|
|
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
|
|
case "$target_os" in
|
|
hpux*) DLEXT=sl;;
|
|
nextstep*) DLEXT=bundle;;
|
|
openstep*) DLEXT=bundle;;
|
|
rhapsody*) DLEXT=bundle;;
|
|
darwin*) DLEXT=bundle;;
|
|
os2-emx*) DLEXT=dll;;
|
|
cygwin*|mingw*) DLEXT=so;;
|
|
*) DLEXT=so;;
|
|
esac
|
|
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)
|
|
|
|
AC_SUBST(STRIP)dnl
|
|
if test "$with_dln_a_out" = yes; then
|
|
STRIP=true
|
|
else
|
|
STRIP=strip
|
|
fi
|
|
|
|
case "$target_os" in
|
|
linux* | gnu* | k*bsd*-gnu)
|
|
STRIP='strip -S -x';;
|
|
nextstep*)
|
|
STRIP='strip -A -n';;
|
|
openstep*)
|
|
STRIP='strip -A -n';;
|
|
rhapsody*)
|
|
STRIP='strip -A -n';;
|
|
darwin*)
|
|
STRIP='strip -A -n';;
|
|
esac
|
|
|
|
EXTSTATIC=
|
|
AC_SUBST(EXTSTATIC)dnl
|
|
AC_ARG_WITH(static-linked-ext,
|
|
[ --with-static-linked-ext link external modules statically],
|
|
[case $withval in
|
|
yes) STATIC=
|
|
EXTSTATIC=static;;
|
|
*) ;;
|
|
esac])
|
|
|
|
case "$target_os" in
|
|
human*)
|
|
AC_CHECK_LIB(signal, _harderr)
|
|
AC_CHECK_LIB(hmem, hmemset)
|
|
AC_CHECK_FUNCS(select)
|
|
AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
|
|
rb_cv_missing__dtos18,
|
|
[AC_TRY_RUN(
|
|
changequote(<<, >>)dnl
|
|
<<
|
|
#include <stdio.h>
|
|
int
|
|
main()
|
|
{
|
|
char buf[256];
|
|
sprintf(buf, "%g", 1e+300);
|
|
return (strcmp (buf, "1e+300") ? 0 : 1);
|
|
}
|
|
>>,
|
|
changequote([, ])dnl
|
|
rb_cv_missing__dtos18=yes, rb_cv_missing__dtos18=no, rb_cv_missing__dtos18=no)])
|
|
if test "$rb_cv_missing__dtos18" = yes; then
|
|
AC_DEFINE(MISSING__DTOS18)
|
|
fi
|
|
AC_CACHE_CHECK(whether PD libc fconvert fail to round,
|
|
rb_cv_missing_fconvert,
|
|
[AC_TRY_RUN(
|
|
changequote(<<, >>)dnl
|
|
<<
|
|
#include <stdio.h>
|
|
#include <math.h>
|
|
int
|
|
main()
|
|
{
|
|
char buf[256];
|
|
sprintf(buf, "%f", log(exp(1.0)));
|
|
return (strcmp (buf, "1.000000") ? 0 : 1);
|
|
}
|
|
>>,
|
|
changequote([, ])dnl
|
|
rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no)])
|
|
if test "$rb_cv_missing_fconvert" = yes; then
|
|
AC_DEFINE(MISSING_FCONVERT)
|
|
fi
|
|
AC_LIBOBJ([x68.o])
|
|
CFLAGS="$CFLAGS -fansi-only"
|
|
XCFLAGS="$XCFLAGS -cc1-stack=262144 -cpp-stack=2694144"
|
|
EXEEXT=.x
|
|
OBJEXT=o
|
|
setup=Setup.x68
|
|
;;
|
|
dnl OS/2 environment w/ Autoconf 2.1x for EMX
|
|
os2-emx)
|
|
AC_LIBOBJ([os2])
|
|
setup=Setup.emx
|
|
;;
|
|
*djgpp*)
|
|
setup=Setup.dj
|
|
;;
|
|
*)
|
|
setup=Setup
|
|
;;
|
|
esac
|
|
|
|
AC_SUBST(setup)
|
|
|
|
if test "$prefix" = NONE; then
|
|
prefix=$ac_default_prefix
|
|
fi
|
|
|
|
#if test "$fat_binary" != no ; then
|
|
# CFLAGS="$CFLAGS $ARCH_FLAG"
|
|
#fi
|
|
|
|
if test x"$cross_compiling" = xyes; then
|
|
test x"$MINIRUBY" = x && MINIRUBY="${RUBY-ruby} -I`pwd` -rfake"
|
|
PREP=fake.rb
|
|
RUNRUBY='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
|
|
else
|
|
MINIRUBY='./miniruby$(EXEEXT) -I$(srcdir)/lib'
|
|
MINIRUBY="$MINIRUBY"' -I$(EXTOUT)/common -I./- -r$(srcdir)/ext/purelib.rb'
|
|
PREP='miniruby$(EXEEXT)'
|
|
RUNRUBY='$(MINIRUBY) $(srcdir)/runruby.rb --extout=$(EXTOUT)'
|
|
fi
|
|
AC_SUBST(MINIRUBY)
|
|
AC_SUBST(PREP)
|
|
AC_SUBST(RUNRUBY)
|
|
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=
|
|
|
|
case "$target_os" in
|
|
cygwin*|mingw*|beos*|haiku*|openstep*|nextstep*|rhapsody*|darwin*|os2-emx*)
|
|
: ${DLDLIBS=""}
|
|
;;
|
|
*)
|
|
DLDLIBS="$DLDLIBS -lc"
|
|
;;
|
|
esac
|
|
|
|
RUBY_SO_NAME='$(RUBY_INSTALL_NAME)'
|
|
LIBRUBY_LDSHARED=$LDSHARED
|
|
LIBRUBY_DLDFLAGS=$DLDFLAGS
|
|
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY)'
|
|
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so'
|
|
ENABLE_SHARED=no
|
|
|
|
AC_ARG_ENABLE(shared,
|
|
[ --enable-shared build a shared library for Ruby. ],
|
|
[enable_shared=$enableval])
|
|
LIBRUBYARG_SHARED='-l$(RUBY_SO_NAME)'
|
|
if test "$enable_shared" = 'yes'; then
|
|
LIBRUBY='$(LIBRUBY_SO)'
|
|
LIBRUBYARG='$(LIBRUBYARG_SHARED)'
|
|
CFLAGS="$CFLAGS $CCDLFLAGS"
|
|
ENABLE_SHARED=yes
|
|
if test "$rb_cv_binary_elf" = yes; then
|
|
SOLIBS='$(LIBS)'
|
|
fi
|
|
case "$target_os" in
|
|
sunos4*)
|
|
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
|
|
;;
|
|
linux* | gnu* | k*bsd*-gnu | atheos*)
|
|
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'
|
|
;;
|
|
freebsd*|dragonfly*)
|
|
SOLIBS='$(LIBS)'
|
|
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)'
|
|
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
|
|
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_INSTALL_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)'
|
|
fi
|
|
XLDFLAGS="$XLDFLAGS "'-R${libdir}'
|
|
;;
|
|
hpux*)
|
|
XLDFLAGS="$XLDFLAGS "'-Wl,+s,+b,$(libdir)'
|
|
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*)
|
|
case "$target_cpu" in
|
|
powerpc*)
|
|
LIBRUBY_DLDFLAGS='-f ruby.exp -lnet -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
|
|
;;
|
|
esac
|
|
;;
|
|
darwin*)
|
|
LIBRUBY_SO='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib'
|
|
LIBRUBY_LDSHARED='cc -dynamiclib -undefined suppress -flat_namespace'
|
|
LIBRUBY_DLDFLAGS='-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)'
|
|
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib'
|
|
;;
|
|
interix*)
|
|
LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)'
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
fi
|
|
if test "$enable_rpath" = yes; then
|
|
LIBRUBY_RPATHFLAGS="${linker_flag}-R ${linker_flag}\$(libdir) -L\$(libdir)"
|
|
LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED"
|
|
LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC"
|
|
fi
|
|
|
|
LDFLAGS="-L. $LDFLAGS"
|
|
AC_SUBST(ARCHFILE)
|
|
|
|
dnl build rdoc index if requested
|
|
RDOCTARGET=""
|
|
AC_ARG_ENABLE(install-doc,
|
|
[ --disable-install-doc do not install rdoc indexes during install ],
|
|
[install_doc=$enableval], [install_doc=yes])
|
|
if test "$install_doc" != no; then
|
|
RDOCTARGET="install-doc"
|
|
fi
|
|
AC_SUBST(RDOCTARGET)
|
|
|
|
if test "$rb_with_pthread" = "yes"; then
|
|
THREAD_MODEL=pthread
|
|
fi
|
|
MINIDLNOBJ=dln.o
|
|
case "$target_os" in
|
|
linux*)
|
|
;;
|
|
netbsd*)
|
|
CFLAGS="$CFLAGS -pipe"
|
|
;;
|
|
nextstep*|openstep*)
|
|
# 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.
|
|
CFLAGS="$CFLAGS -pipe -fno-common"
|
|
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
|
;;
|
|
rhapsody*)
|
|
CFLAGS="$CFLAGS -pipe -no-precomp -fno-common"
|
|
;;
|
|
darwin*)
|
|
CFLAGS="$CFLAGS -pipe -fno-common"
|
|
MINIDLNOBJ=dmydln.o
|
|
;;
|
|
os2-emx)
|
|
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'.
|
|
case "`cc -v -I. -c main.c -o /tmp/main.o 2>&1`" in
|
|
*/gemc_cc*) # we have the new DEC GEM CC
|
|
CFLAGS="$CFLAGS -oldc"
|
|
;;
|
|
*) # we have the old MIPS CC
|
|
;;
|
|
esac
|
|
# cleanup
|
|
rm -f /tmp/main.o
|
|
CFLAGS="$CFLAGS -std"
|
|
fi
|
|
;;
|
|
beos*)
|
|
case "$target_cpu" in
|
|
powerpc*)
|
|
CFLAGS="$CFLAGS -relax_pointers"
|
|
;;
|
|
esac
|
|
CPPFLAGS="$CPPFLAGS -I/boot/home/config/include"
|
|
;;
|
|
cygwin*|mingw*)
|
|
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
|
|
case "$target_os" in
|
|
cygwin*)
|
|
if test x"$enable_shared" = xyes; then
|
|
LIBRUBY_SO='cyg$(RUBY_SO_NAME)'${MAJOR}${MINOR}${TEENY}.dll
|
|
fi
|
|
;;
|
|
mingw*)
|
|
RUBY_SO_NAME=${rb_cv_msvcrt}-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}${TEENY}
|
|
if test x"$enable_shared" = xyes; then
|
|
LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
|
|
LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
|
|
fi
|
|
AC_LIBOBJ([win32])
|
|
COMMON_LIBS=m
|
|
# COMMON_MACROS="WIN32_LEAN_AND_MEAN="
|
|
COMMON_HEADERS="winsock2.h windows.h"
|
|
THREAD_MODEL=win32
|
|
;;
|
|
esac
|
|
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
|
|
MINIDLNOBJ=dmydln.o
|
|
;;
|
|
hpux*)
|
|
case "$YACC" in
|
|
*yacc*)
|
|
XCFLAGS="$XCFLAGS -DYYMAXDEPTH=300"
|
|
YACC="$YACC -Nl40000 -Nm40000"
|
|
;;
|
|
esac
|
|
MINIDLNOBJ=dmydln.o
|
|
;;
|
|
*msdosdjgpp*)
|
|
FIRSTMAKEFILE=GNUmakefile:djgpp/GNUmakefile.in
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
MINIOBJS="$MINIDLNOBJ"
|
|
|
|
case "$FIRSTMAKEFILE" in
|
|
dnl (
|
|
*GNUmakefile:*)
|
|
gnumake=yes
|
|
;;
|
|
dnl (
|
|
*)
|
|
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
|
|
case "$gnumake" in
|
|
dnl (
|
|
*yes*)
|
|
echo "include Makefile" > GNUmakefile
|
|
echo "-include uncommon.mk" >> GNUmakefile
|
|
gnumake=yes;;
|
|
dnl (
|
|
*)
|
|
gnumake=no;;
|
|
esac
|
|
AC_MSG_RESULT($gnumake)
|
|
;;
|
|
esac
|
|
|
|
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
|
|
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
|
|
cflagspat=`eval echo '"'"${cflags}"'"' | sed 's/[][|.*]/\\&/g'`
|
|
CFLAGS=`echo "$CFLAGS" | sed "s|$cflagspat"'|${cflags}|'`
|
|
cxxflagspat=`eval echo '"'"${cxxflags}"'"' | sed 's/[][|.*]/\\&/g'`
|
|
CXXFLAGS=`echo "$CXXFLAGS" | sed "s|$cxxflagspat"'|${cxxflags}|'`
|
|
AC_SUBST(cppflags, [])dnl
|
|
AC_SUBST(cflags, ['${optflags} ${debugflags} ${warnflags}'])dnl
|
|
AC_SUBST(optflags)dnl
|
|
AC_SUBST(debugflags)dnl
|
|
AC_SUBST(warnflags)dnl
|
|
AC_SUBST(XCFLAGS)dnl
|
|
AC_SUBST(XLDFLAGS)dnl
|
|
AC_SUBST(LIBRUBY_LDSHARED)
|
|
AC_SUBST(LIBRUBY_DLDFLAGS)
|
|
AC_SUBST(RUBY_INSTALL_NAME)
|
|
AC_SUBST(rubyw_install_name)
|
|
AC_SUBST(RUBYW_INSTALL_NAME)
|
|
AC_SUBST(RUBY_SO_NAME)
|
|
AC_SUBST(LIBRUBY_A)
|
|
AC_SUBST(LIBRUBY_SO)
|
|
AC_SUBST(LIBRUBY_ALIASES)
|
|
AC_SUBST(LIBRUBY)
|
|
AC_SUBST(LIBRUBYARG)
|
|
AC_SUBST(LIBRUBYARG_STATIC)
|
|
AC_SUBST(LIBRUBYARG_SHARED)
|
|
AC_SUBST(SOLIBS)
|
|
AC_SUBST(DLDLIBS)
|
|
AC_SUBST(ENABLE_SHARED)
|
|
AC_SUBST(MAINLIBS)
|
|
AC_SUBST(COMMON_LIBS)
|
|
AC_SUBST(COMMON_MACROS)
|
|
AC_SUBST(COMMON_HEADERS)
|
|
AC_SUBST(EXPORT_PREFIX)
|
|
AC_SUBST(MINIOBJS)
|
|
AC_SUBST(THREAD_MODEL)
|
|
|
|
MAKEFILES="Makefile `echo $FIRSTMAKEFILE | sed 's/:.*//'`"
|
|
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${ri_suffix}"
|
|
case "$target_os" in
|
|
cygwin*|mingw*)
|
|
RUBYW_INSTALL_NAME="${ri_prefix}rubyw${ri_suffix}"
|
|
rubyw_install_name="$RUBYW_INSTALL_NAME"
|
|
;;
|
|
esac
|
|
RUBY_LIB_PREFIX=`eval echo \\"${libdir}/${RUBY_INSTALL_NAME}\\"`
|
|
|
|
AC_ARG_WITH(ruby-version,
|
|
[ --with-ruby-version=STR ruby version string for version specific directories [[full]] (full|minor|STR)],
|
|
[ruby_version=$withval],
|
|
[ruby_version=full])
|
|
case "$ruby_version" in
|
|
full)
|
|
ruby_version="${MAJOR}.${MINOR}.${TEENY}"
|
|
;;
|
|
minor)
|
|
ruby_version="${MAJOR}.${MINOR}"
|
|
;;
|
|
esac
|
|
|
|
AC_ARG_WITH(sitedir,
|
|
[ --with-sitedir=DIR site libraries in DIR [[LIBDIR/ruby/site_ruby]]],
|
|
[sitedir=$withval],
|
|
[sitedir='${libdir}/${RUBY_INSTALL_NAME}/site_ruby'])
|
|
SITE_DIR=`eval echo \\"${sitedir}\\"`
|
|
|
|
AC_ARG_WITH(vendordir,
|
|
[ --with-vendordir=DIR vendor libraries in DIR [[LIBDIR/ruby/vendor_ruby]]],
|
|
[vendordir=$withval],
|
|
[vendordir='${libdir}/${RUBY_INSTALL_NAME}/vendor_ruby'])
|
|
VENDOR_DIR=`eval echo \\"${vendordir}\\"`
|
|
|
|
case "$target_os" in
|
|
cygwin*|mingw*|*djgpp*|os2-emx*)
|
|
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"'/|/|'`"
|
|
;;
|
|
*)
|
|
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"'/|'`"
|
|
;;
|
|
esac
|
|
RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${ruby_version}"
|
|
RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${ruby_version}"
|
|
RUBY_VENDOR_LIB_PATH2="${RUBY_VENDOR_LIB_PATH}/${ruby_version}"
|
|
|
|
AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
|
|
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
|
|
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
|
|
AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, "${RUBY_VENDOR_LIB_PATH}")
|
|
AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB2, "${RUBY_VENDOR_LIB_PATH2}")
|
|
|
|
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 "$fat_binary" != no ; then
|
|
arch="fat-${target_os}"
|
|
|
|
AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB,
|
|
"${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
|
|
|
|
AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
|
|
"${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
|
|
AC_DEFINE_UNQUOTED(RUBY_VENDOR_THIN_ARCHLIB,
|
|
"${RUBY_VENDOR_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
|
|
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
|
|
else
|
|
arch="${target_cpu}-${target_os}"
|
|
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
|
|
fi
|
|
|
|
case "$target_os" in
|
|
mingw*) sitearch="$target_cpu-$rb_cv_msvcrt" ;;
|
|
*) sitearch="${arch}" ;;
|
|
esac
|
|
|
|
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
|
|
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${sitearch}")
|
|
AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCHLIB, "${RUBY_VENDOR_LIB_PATH2}/${sitearch}")
|
|
|
|
AC_ARG_WITH(search-path,
|
|
[ --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")
|
|
fi
|
|
|
|
AC_ARG_WITH(rubyhdrdir,
|
|
[ --with-ruby-hdrdir=DIR core headers in DIR [INCLUDEDIR]],
|
|
[rubyhdrdir=$withval],
|
|
[rubyhdrdir='${includedir}/${RUBY_INSTALL_NAME}-${ruby_version}'])
|
|
|
|
AC_ARG_WITH(sitehdrdir,
|
|
[ --with-site-hdrdir=DIR core headers in DIR [INCLUDEDIR]],
|
|
[sitehdrdir=$withval],
|
|
[sitehdrdir='${rubyhdrdir}/site_ruby'])
|
|
|
|
AC_ARG_WITH(vendorhdrdir,
|
|
[ --with-vendor-hdrdir=DIR core headers in DIR [INCLUDEDIR]],
|
|
[vendorhdrdir=$withval],
|
|
[vendorhdrdir='${rubyhdrdir}/vendor_ruby'])
|
|
|
|
AC_SUBST(rubyhdrdir)dnl
|
|
AC_SUBST(sitehdrdir)dnl
|
|
AC_SUBST(vendorhdrdir)dnl
|
|
|
|
AC_ARG_WITH(mantype,
|
|
[ --with-mantype=TYPE specify man page type; TYPE is one of man and doc],
|
|
[
|
|
case "$withval" in
|
|
man|doc)
|
|
MANTYPE=$withval
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR(invalid man type: $withval)
|
|
;;
|
|
esac
|
|
])
|
|
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)
|
|
|
|
arch_hdrdir="${EXTOUT}/include/${arch}/ruby"
|
|
$MAKEDIRS "${arch_hdrdir}"
|
|
config_h="${arch_hdrdir}/config.h"
|
|
if test -f "${config_h}" && tr -d '\015' < confdefs.h | cmp -s "${config_h}" -; then
|
|
echo "config.h unchanged"
|
|
else
|
|
echo "creating config.h"
|
|
tr -d '\015' < confdefs.h > "${config_h}"
|
|
fi
|
|
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)
|
|
|
|
AC_CONFIG_FILES($FIRSTMAKEFILE)
|
|
AC_CONFIG_FILES(Makefile, [{
|
|
sed '/^MISSING/s/\$U\././g' Makefile
|
|
echo; test x"$EXEEXT" = x || echo 'miniruby: miniruby$(EXEEXT)'
|
|
test "$RUBY_INSTALL_NAME$EXEEXT" = ruby || echo 'ruby: $(PROGRAM);'
|
|
if test "$gnumake" != yes; then
|
|
echo ['$(MKFILES): $(srcdir)/common.mk']
|
|
sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk
|
|
fi
|
|
} >> confmk$$.tmp && mv -f confmk$$.tmp Makefile],
|
|
[RUBY_INSTALL_NAME=$RUBY_INSTALL_NAME EXEEXT=$EXEEXT gnumake=$gnumake])
|
|
AC_OUTPUT
|