зеркало из https://github.com/github/ruby.git
959 строки
24 KiB
Plaintext
959 строки
24 KiB
Plaintext
dnl Process this file with autoconf to produce a configure script.
|
|
AC_INIT(ruby.h)
|
|
|
|
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]*\)"'`
|
|
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
|
|
without_gcc=yes;;
|
|
yes) CC=gcc
|
|
without_gcc=no;;
|
|
*) CC=$withval
|
|
without_gcc=$withval;;
|
|
esac], [without_gcc=no])
|
|
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_ERROR(cached CC is different -- throw away $cache_file
|
|
(it is also a good idea to do 'make clean' before compiling))
|
|
fi
|
|
|
|
AC_CANONICAL_HOST
|
|
AC_CANONICAL_TARGET
|
|
AC_CANONICAL_BUILD
|
|
|
|
dnl checks for fat-binary
|
|
fat_binary=no
|
|
AC_ARG_ENABLE(fat-binary,
|
|
[--enable-fat-binary build a NeXT/Apple Multi Architecture Binary. ],
|
|
[fat_binary=$enableval])
|
|
if test "$fat_binary" = yes ; then
|
|
|
|
AC_MSG_CHECKING(target architecture)
|
|
|
|
case "$target_os" in
|
|
rhapsody*)
|
|
echo -n "MacOS X Server: "
|
|
if test "$TARGET_ARCHS" = "" ; then
|
|
TARGET_ARCHS="ppc i386"
|
|
fi
|
|
;;
|
|
nextstep*|openstep*)
|
|
echo -n "NeXTSTEP/OPENSTEP: "
|
|
if test "$TARGET_ARCHS" = "" ; then
|
|
if test `/usr/bin/arch` = "m68k" ; then
|
|
TARGET_ARCHS="m68k i486"
|
|
else # Black and Native one
|
|
TARGET_ARCHS="m68k `/usr/bin/arch`"
|
|
fi
|
|
fi
|
|
# to ensure AC_HEADER_SYS_WAIT works
|
|
AC_DEFINE(_POSIX_SOURCE)
|
|
;;
|
|
darwin*)
|
|
echo -n "MacOS X (Darwin): "
|
|
TARGET_ARCHS="ppc"
|
|
;;
|
|
esac
|
|
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
|
|
for archs in $TARGET_ARCHS
|
|
do
|
|
ARCH_FLAG="$ARCH_FLAG -arch $archs "
|
|
echo -n " $archs"
|
|
done
|
|
AC_DEFINE(NEXT_FAT_BINARY)
|
|
echo "."
|
|
fi
|
|
|
|
AC_ARG_PROGRAM
|
|
|
|
dnl Checks for programs.
|
|
|
|
if test x"${build}" != x"${host}"; then
|
|
AC_CHECK_TOOL(CC, gcc)
|
|
fi
|
|
AC_PROG_CC
|
|
AC_PROG_GCC_TRADITIONAL
|
|
|
|
AC_PROG_YACC
|
|
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
|
AC_CHECK_TOOL(AR, ar)
|
|
AC_CHECK_PROGS(AR, ar aal, ar)
|
|
|
|
case "$target_os" in
|
|
cygwin*|mingw*)
|
|
AC_CHECK_TOOL(NM, nm)
|
|
AC_CHECK_TOOL(DLLWRAP, dllwrap)
|
|
AC_CHECK_TOOL(AS, as)
|
|
AC_CHECK_TOOL(DLLTOOL, dlltool)
|
|
AC_CHECK_TOOL(WINDRES, windres)
|
|
;;
|
|
esac
|
|
|
|
AC_PROG_LN_S
|
|
AC_PROG_MAKE_SET
|
|
|
|
# checks for UNIX variants that set C preprocessor variables
|
|
AC_AIX
|
|
AC_MINIX
|
|
|
|
AC_EXEEXT
|
|
AC_OBJEXT
|
|
|
|
AC_CHECK_SIZEOF(int, 4)
|
|
AC_CHECK_SIZEOF(short, 2)
|
|
AC_CHECK_SIZEOF(long, 4)
|
|
AC_CHECK_SIZEOF(void*, 4)
|
|
AC_CHECK_SIZEOF(float, 4)
|
|
AC_CHECK_SIZEOF(double, 8)
|
|
|
|
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(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 gcc attribute noreturn, rb_cv_have_attr_noreturn,
|
|
[AC_TRY_COMPILE([void exit(int x) __attribute__ ((noreturn));], [],
|
|
rb_cv_have_attr_noreturn=yes,
|
|
rb_cv_have_attr_noreturn=no)])
|
|
if test "$rb_cv_have_attr_noreturn" = yes; then
|
|
AC_DEFINE(HAVE_ATTR_NORETURN)
|
|
fi
|
|
|
|
dnl Checks for libraries.
|
|
case "$target_os" in
|
|
nextstep*) ;;
|
|
openstep*) ;;
|
|
rhapsody*) ;;
|
|
darwin*) ;;
|
|
human*) ac_cv_func_getpgrp_void=yes;;
|
|
beos*) ;;
|
|
cygwin*) rb_cv_have_daylight=no;;
|
|
mingw*) LIBS="-lwsock32 -lmsvcrt $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_times_h=no
|
|
ac_cv_func_times=yes;;
|
|
os2_emx*) LIBS="-lm $LIBS"
|
|
ac_cv_lib_dir_opendir=no;;
|
|
freebsd*) LIBS="-lm $LIBS"
|
|
AC_CACHE_CHECK([whether -lxpg4 has to be linked],
|
|
rb_cv_lib_xpg4_needed,
|
|
[AC_TRY_CPP([
|
|
#include <osreldate.h>
|
|
#if __FreeBSD_version < 400020 || \
|
|
(__FreeBSD_version >= 500000 && __FreeBSD_version < 500005)
|
|
#error needs libxpg4
|
|
#endif
|
|
],
|
|
rb_cv_lib_xpg4_needed=no,
|
|
rb_cv_lib_xpg4_needed=yes,
|
|
rb_cv_lib_xpg4_needed=yes)])
|
|
if test "$rb_cv_lib_xpg4_needed" = yes; then
|
|
AC_CHECK_LIB(xpg4, setlocale)
|
|
fi
|
|
;;
|
|
*) 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
|
|
|
|
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\
|
|
fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
|
|
syscall.h pwd.h a.out.h utime.h memory.h direct.h sys/resource.h)
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
AC_TYPE_UID_T
|
|
AC_TYPE_SIZE_T
|
|
AC_STRUCT_ST_BLKSIZE
|
|
save_LIBOJBS="$LIBOBJS"
|
|
AC_STRUCT_ST_BLOCKS
|
|
LIBOBJS="$save_LIBOBJS"
|
|
AC_STRUCT_ST_RDEV
|
|
|
|
dnl Checks for library functions.
|
|
AC_TYPE_GETGROUPS
|
|
AC_TYPE_SIGNAL
|
|
AC_FUNC_ALLOCA
|
|
AC_FUNC_VFORK
|
|
AC_FUNC_MEMCMP
|
|
AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
|
|
strchr strstr strtoul crypt flock vsnprintf\
|
|
isinf isnan finite)
|
|
AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd chroot\
|
|
truncate chsize times utimes fcntl lockf lstat symlink readlink\
|
|
setitimer setruid seteuid setreuid setrgid setegid setregid pause\
|
|
getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\
|
|
dlopen sigprocmask sigaction _setjmp setsid telldir seekdir)
|
|
AC_STRUCT_TIMEZONE
|
|
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
|
|
|
|
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
|
|
AC_DEFINE(POSIX_SIGNAL)
|
|
else
|
|
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=no)])
|
|
if test "$rb_cv_bsd_signal" = yes; then
|
|
AC_DEFINE(BSD_SIGNAL)
|
|
fi
|
|
fi
|
|
|
|
AC_FUNC_GETPGRP
|
|
AC_FUNC_SETPGRP
|
|
|
|
AC_CACHE_CHECK(for working strtod, rb_cv_func_strtod,
|
|
[AC_TRY_RUN([
|
|
double strtod ();
|
|
int
|
|
main()
|
|
{
|
|
{
|
|
/* Some versions of Linux strtod mis-parse strings with leading '+'. */
|
|
char *string = " +69";
|
|
char *term;
|
|
double value;
|
|
value = strtod(string, &term);
|
|
if (value != 69 || term != (string + 4))
|
|
exit(1);
|
|
}
|
|
|
|
{
|
|
/* Under Solaris 2.4, strtod returns the wrong value for the
|
|
terminating character under some conditions. */
|
|
char *string = "NaN";
|
|
char *term;
|
|
strtod(string, &term);
|
|
if (term != string && *(term - 1) == 0)
|
|
exit(1);
|
|
}
|
|
exit(0);
|
|
}
|
|
], rb_cv_func_strtod=yes, rb_cv_func_strtod=no, rb_cv_func_strtod=no)])
|
|
test $rb_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
|
|
|
|
AC_C_BIGENDIAN
|
|
AC_C_CONST
|
|
AC_C_CHAR_UNSIGNED
|
|
|
|
AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
|
|
[AC_TRY_RUN([
|
|
int
|
|
main()
|
|
{
|
|
if (-1==(-1>>1))
|
|
return 0;
|
|
return 1;
|
|
}
|
|
],
|
|
rb_cv_rshift_sign=yes,
|
|
rb_cv_rshift_sign=no,
|
|
rb_cv_rshift_sign=yes)])
|
|
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(count field in FILE structures)
|
|
AC_CACHE_VAL(rb_cv_fcnt,
|
|
[AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->_cnt = 0;], rb_cv_fcnt="_cnt", )
|
|
if test "$rb_cv_fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->__cnt = 0;], rb_cv_fcnt="__cnt", )
|
|
fi
|
|
if test "$rb_cv_fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->_r = 0;], rb_cv_fcnt="_r", )
|
|
fi
|
|
if test "$rb_cv_fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->readCount = 0;],
|
|
rb_cv_fcnt="readCount", )
|
|
fi
|
|
dnl for emx0.9c
|
|
if test "$rb_cv_fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->_rcount = 0;],
|
|
rb_cv_fcnt="_rcount", rb_cv_fcnt="not found")
|
|
fi])
|
|
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
|
|
|
|
dnl default value for $KANJI
|
|
DEFAULT_KCODE="KCODE_NONE"
|
|
|
|
AC_ARG_WITH(default-kcode,
|
|
[--with-default-kcode=CODE specify default value for \$KCODE (utf8|euc|sjis|none)],
|
|
[case $withval in
|
|
utf8) DEFAULT_KCODE="KCODE_UTF8";;
|
|
euc) DEFAULT_KCODE="KCODE_EUC";;
|
|
sjis) DEFAULT_KCODE="KCODE_SJIS";;
|
|
none) DEFAULT_KCODE="KCODE_NONE";;
|
|
*) AC_MSG_WARN($withval is not valid kcode; ignored);;
|
|
esac])
|
|
AC_DEFINE_UNQUOTED(DEFAULT_KCODE, $DEFAULT_KCODE)
|
|
|
|
dnl wheather use dln_a_out ot not
|
|
AC_ARG_WITH(dln-a-out,
|
|
[--with-dln-a-out use dln_a_out if possible], [
|
|
case $withval in
|
|
yes) with_dln_a_out=yes;;
|
|
*) with_dln_a_out=no;;
|
|
esac], [with_dln_a_out=no])
|
|
|
|
AC_SUBST(XLDFLAGS)dnl
|
|
|
|
AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf,
|
|
[AC_TRY_RUN([
|
|
/* Test for whether ELF binaries are produced */
|
|
#include <fcntl.h>
|
|
#include <stdlib.h>
|
|
main() {
|
|
char buffer[4];
|
|
int i=open("conftest",O_RDONLY);
|
|
if(i==-1)
|
|
exit(1); /* fail */
|
|
if(read(i,&buffer[0],4)<4)
|
|
exit(1); /* fail */
|
|
if(buffer[0] != 127 || buffer[1] != 'E' ||
|
|
buffer[2] != 'L' || buffer[3] != 'F')
|
|
exit(1); /* fail */
|
|
exit(0); /* succeed (yes, it's ELF) */
|
|
}
|
|
],
|
|
rb_cv_binary_elf=yes,
|
|
rb_cv_binary_elf=no,
|
|
rb_cv_binary_elf=yes)])
|
|
|
|
if test "$rb_cv_binary_elf" = yes; then
|
|
AC_DEFINE(USE_ELF)
|
|
fi
|
|
|
|
case "$target_os" in
|
|
linux*)
|
|
if test "$rb_cv_binary_elf" = no; then
|
|
with_dln_a_out=yes
|
|
target_os=${target_os}-a_out
|
|
else
|
|
LDFLAGS="-rdynamic"
|
|
fi;;
|
|
netbsd*)
|
|
if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
|
|
then
|
|
netbsd_elf=yes
|
|
else
|
|
netbsd_elf=no
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
AC_SUBST(DLDFLAGS)dnl
|
|
|
|
AC_SUBST(STATIC)dnl
|
|
AC_SUBST(CCDLFLAGS)dnl
|
|
AC_SUBST(LDSHARED)dnl
|
|
AC_SUBST(DLEXT)dnl
|
|
AC_SUBST(DLEXT2)dnl
|
|
|
|
STATIC=
|
|
|
|
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*) ;;
|
|
openstep*) ;;
|
|
rhapsody*) ;;
|
|
darwin*) ;;
|
|
human*) ;;
|
|
bsdi*) ;;
|
|
beos*) ;;
|
|
cygwin*) ;;
|
|
mingw*) ;;
|
|
netbsd*) CCDLFLAGS=-fpic
|
|
case "$target_cpu" in
|
|
mips*) CCDLFLAGS=-fPIC ;;
|
|
sparc) CCDLFLAGS=-fPIC ;;
|
|
*) ;;
|
|
esac ;;
|
|
*) CCDLFLAGS=-fPIC;;
|
|
esac
|
|
else
|
|
case "$target_os" in
|
|
hpux*) CCDLFLAGS='+z';;
|
|
solaris*|irix*) CCDLFLAGS='-KPIC' ;;
|
|
sunos*) CCDLFLAGS='-PIC' ;;
|
|
esix*|uxpds*) CCDLFLAGS='-KPIC' ;;
|
|
*) CCDLFLAGS='' ;;
|
|
esac
|
|
fi
|
|
|
|
case "$target_os" in
|
|
hpux*) DLDFLAGS="-E"
|
|
LDSHARED='ld -b'
|
|
LDFLAGS="-Wl,-E"
|
|
rb_cv_dlopen=yes;;
|
|
solaris*) if test "$GCC" = yes; then
|
|
LDSHARED='$(CC) -Wl,-G'
|
|
`$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null && LDFLAGS="-Wl,-E"
|
|
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;;
|
|
esix*|uxpds*) LDSHARED="ld -G"
|
|
rb_cv_dlopen=yes ;;
|
|
osf*) LDSHARED="$CC -shared"
|
|
rb_cv_dlopen=yes ;;
|
|
linux*) LDSHARED="$CC -shared"
|
|
rb_cv_dlopen=yes ;;
|
|
freebsd*) LDSHARED="$CC -shared"
|
|
if test "$rb_cv_binary_elf" = yes; then
|
|
LDFLAGS="-rdynamic"
|
|
DLDFLAGS='-Wl,-soname,$(.TARGET)'
|
|
else
|
|
test "$GCC" = yes && `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null || LDSHARED="ld -Bshareable"
|
|
fi
|
|
rb_cv_dlopen=yes ;;
|
|
netbsd*) LDSHARED="ld -shared"
|
|
if test "$rb_cv_binary_elf" = yes; then
|
|
LDFLAGS="-export-dynamic"
|
|
fi
|
|
rb_cv_dlopen=yes ;;
|
|
openbsd*) LDSHARED="ld -Bforcearchive -Bshareable"
|
|
rb_cv_dlopen=yes ;;
|
|
bsdi3*) case "$CC" in
|
|
*shlicc*) LDSHARED="$CC -r"
|
|
rb_cv_dlopen=yes ;;
|
|
esac ;;
|
|
bsdi*) LDSHARED="ld -shared"
|
|
LDFLAGS='-rdynamic -Wl,-rpath,$(prefix)/lib/ruby/$(MAJOR).$(MINOR)/i386-bsdi4.0'
|
|
rb_cv_dlopen=yes ;;
|
|
nextstep*) LDSHARED='cc -r -nostdlib'
|
|
LDFLAGS="-u libsys_s"
|
|
DLDFLAGS="$ARCH_FLAG"
|
|
rb_cv_dlopen=yes ;;
|
|
openstep*) LDSHARED='cc -dynamic -bundle -undefined suppress'
|
|
LDFLAGS=""
|
|
DLDFLAGS="$ARCH_FLAG"
|
|
rb_cv_dlopen=yes ;;
|
|
rhapsody*) LDSHARED='cc -dynamic -bundle -undefined suppress'
|
|
LDFLAGS=""
|
|
DLDFLAGS="$ARCH_FLAG"
|
|
rb_cv_dlopen=yes ;;
|
|
darwin*) LDSHARED='cc -dynamic -bundle -undefined suppress'
|
|
LDFLAGS=""
|
|
DLDFLAGS="$ARCH_FLAG"
|
|
rb_cv_dlopen=yes ;;
|
|
aix*) LDSHARED='/usr/ccs/bin/ld'
|
|
XLDFLAGS='-Wl,-bE:ruby.imp'
|
|
DLDFLAGS='-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
|
|
LDFLAGS="-brtl"
|
|
rb_cv_dlopen=yes ;;
|
|
|
|
human*) DLDFLAGS=''
|
|
LDSHARED=''
|
|
LDFLAGS=''
|
|
rb_cv_dlopen=yes ;;
|
|
beos*) case "$target_cpu" in
|
|
powerpc*)
|
|
LDSHARED="ld -xms"
|
|
DLDFLAGS='-export Init_$(TARGET) -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
|
|
;;
|
|
i586*)
|
|
LDSHARED="ld -shared"
|
|
DLDFLAGS="-L/boot/develop/lib/x86 -lbe -lroot"
|
|
;;
|
|
esac
|
|
rb_cv_dlopen=yes ;;
|
|
cygwin*|mingw*) : ${LDSHARED="${DLLWRAP} --target=${target_os} --as=${AS} --dlltool-name=${DLLTOOL} --driver-name=${CC} --export-all -s"}
|
|
rb_cv_dlopen=yes ;;
|
|
*) LDSHARED='ld' ;;
|
|
esac
|
|
AC_MSG_RESULT($rb_cv_dlopen)
|
|
fi
|
|
|
|
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
|
|
AC_DEFINE(DLEXT, ".so")
|
|
CCDLFLAGS=
|
|
else
|
|
case "$target_os" in
|
|
hpux*) DLEXT=sl
|
|
AC_DEFINE(DLEXT, ".sl");;
|
|
nextstep*) DLEXT=bundle
|
|
AC_DEFINE(DLEXT, ".bundle");;
|
|
openstep*) DLEXT=bundle
|
|
AC_DEFINE(DLEXT, ".bundle");;
|
|
rhapsody*) DLEXT=bundle
|
|
AC_DEFINE(DLEXT, ".bundle");;
|
|
darwin*) DLEXT=bundle
|
|
AC_DEFINE(DLEXT, ".bundle");;
|
|
os2_emx*) DLEXT=dll
|
|
AC_DEFINE(DLEXT, ".dll");;
|
|
cygwin*|mingw*) DLEXT=so
|
|
AC_DEFINE(DLEXT, ".so")
|
|
DLEXT2=dll
|
|
AC_DEFINE(DLEXT2, ".dll");;
|
|
*) DLEXT=so
|
|
AC_DEFINE(DLEXT, ".so");;
|
|
esac
|
|
fi
|
|
|
|
AC_SUBST(STRIP)dnl
|
|
if test "$with_dln_a_out" = yes; then
|
|
STRIP=true
|
|
else
|
|
STRIP=strip
|
|
fi
|
|
|
|
case "$target_os" in
|
|
linux*)
|
|
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 gettimeofday)
|
|
AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
|
|
rb_cv_missing__dtos18,
|
|
[AC_TRY_RUN(
|
|
changequote(<<, >>)dnl
|
|
<<
|
|
#include <stdio.h>
|
|
main ()
|
|
{
|
|
char buf[256];
|
|
sprintf (buf, "%g", 1e+300);
|
|
exit (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>
|
|
main ()
|
|
{
|
|
char buf[256];
|
|
sprintf (buf, "%f", log(exp(1.0)));
|
|
exit (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
|
|
LIBOBJS="$LIBOBJS x68.o"
|
|
CFLAGS="$CFLAGS -fansi-only -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)
|
|
LIBOBJS="$LIBOBJS os2.$OBJEXT"
|
|
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" = yes ; then
|
|
CFLAGS="$CFLAGS $ARCH_FLAG"
|
|
fi
|
|
|
|
if test x"$cross_compiling" = xyes; then
|
|
MINIRUBY="ruby -I`pwd` -rfake"
|
|
PREP=fake.rb
|
|
else
|
|
MINIRUBY='./miniruby$(EXEEXT)'
|
|
PREP=''
|
|
fi
|
|
AC_SUBST(MINIRUBY)
|
|
AC_SUBST(PREP)
|
|
|
|
FIRSTMAKEFILE=""
|
|
LIBRUBY_A='lib$(RUBY_INSTALL_NAME).a'
|
|
LIBRUBY='$(LIBRUBY_A)'
|
|
LIBRUBYARG='$(LIBRUBY_A)'
|
|
SOLIBS=
|
|
|
|
case "$target_os" in
|
|
cygwin*|mingw*|beos*|openstep*|nextstep*|rhapsody*|os2_emx*)
|
|
DLDLIBS=""
|
|
;;
|
|
*)
|
|
DLDLIBS="-lc"
|
|
;;
|
|
esac
|
|
|
|
LIBRUBY_LDSHARED=$LDSHARED
|
|
LIBRUBY_DLDFLAGS=$DLDFLAGS
|
|
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR).$(TEENY)'
|
|
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so'
|
|
ENABLE_SHARED=no
|
|
|
|
AC_ARG_ENABLE(enable-shared,
|
|
[--enable-shared build a shared library for Ruby. ],
|
|
[enable_shared=$enableval])
|
|
if test "$enable_shared" = 'yes'; then
|
|
LIBRUBY='$(LIBRUBY_SO)'
|
|
LIBRUBYARG='-L. -l$(RUBY_INSTALL_NAME)'
|
|
CFLAGS="$CFLAGS $CCDLFLAGS"
|
|
ENABLE_SHARED=yes
|
|
case "$target_os" in
|
|
sunos4*)
|
|
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so'
|
|
;;
|
|
linux*)
|
|
LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)'
|
|
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so'
|
|
;;
|
|
freebsd*)
|
|
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR)'
|
|
if test "$rb_cv_binary_elf" != "yes" ; then
|
|
LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)"
|
|
LIBRUBY_ALIASES=''
|
|
fi
|
|
;;
|
|
netbsd*)
|
|
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)'
|
|
if test "$rb_cv_binary_elf" = yes; then # ELF platforms
|
|
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR) lib$(RUBY_INSTALL_NAME).so'
|
|
else
|
|
LIBRUBY_ALIASES= # a.out platforms
|
|
fi
|
|
;;
|
|
solaris*)
|
|
XLDFLAGS='-R${prefix}/lib'
|
|
;;
|
|
hpux*)
|
|
XLDFLAGS='-Wl,+s,+b,$(prefix)/lib'
|
|
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).sl.$(MAJOR).$(MINOR).$(TEENY)'
|
|
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).sl'
|
|
;;
|
|
aix*)
|
|
if test "$GCC" = yes; then
|
|
LIBRUBY_LDSHARED='$(CC) -shared'
|
|
LIBRUBY_DLDFLAGS='-Wl,-bE:ruby.imp'
|
|
else
|
|
LIBRUBY_LDSHARED='/usr/ccs/bin/ld'
|
|
LIBRUBY_DLDFLAGS='-bE:ruby.imp -bM:SRE -bnoentry'
|
|
fi
|
|
LIBRUBYARG='-L${prefix}/lib -Wl,lib$(RUBY_INSTALL_NAME).so'
|
|
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
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
case "$target_os" in
|
|
nextstep*)
|
|
CFLAGS="$CFLAGS -pipe"
|
|
;;
|
|
openstep*)
|
|
CFLAGS="$CFLAGS -pipe"
|
|
;;
|
|
rhapsody*)
|
|
CFLAGS="$CFLAGS -pipe -no-precomp"
|
|
;;
|
|
darwin*)
|
|
CFLAGS="$CFLAGS -pipe -no-precomp"
|
|
;;
|
|
os2_emx)
|
|
CFLAGS="$CFLAGS -DOS2"
|
|
;;
|
|
osf*)
|
|
if test "$without_gcc" = "no" ; then
|
|
CFLAGS="$CFLAGS -ansi"
|
|
else
|
|
# 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
|
|
;;
|
|
cygwin*|mingw*)
|
|
RUBY_SO_NAME=$target_os-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}
|
|
if test x"$enable_shared" = xyes; then
|
|
LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
|
|
LIBRUBY_DLDFLAGS='--dllname=$@ --output-lib=$(LIBRUBY) --add-stdcall-alias --def=$(RUBYDEF)'
|
|
else
|
|
LIBRUBY_SO=dummy
|
|
LIBRUBY_DLDFLAGS='--output-exp=$(RUBY_SO_NAME).exp --dllname=$(RUBY_SO_NAME)$(EXEEXT) --output-lib=$(LIBRUBY) --add-stdcall-alias --def=$(RUBYDEF)'
|
|
fi
|
|
LIBRUBY_ALIASES=''
|
|
LIBRUBY_A='lib$(RUBY_INSTALL_NAME)s.a'
|
|
LIBRUBY='lib$(RUBY_SO_NAME).a'
|
|
LIBRUBYARG='-L. -l$(RUBY_SO_NAME)'
|
|
FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
|
|
SOLIBS='$(LIBS)'
|
|
case "$target_os" in
|
|
cygwin*)
|
|
LIBOBJS="$LIBOBJS strftime.o"
|
|
CCDLFLAGS=-DUSEIMPORTLIB ;;
|
|
mingw*)
|
|
LIBOBJS="$LIBOBJS win32.o"
|
|
CFLAGS="-DNT -D__MSVCRT__ $CFLAGS"
|
|
CCDLFLAGS=-DIMPORT ;;
|
|
esac
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
|
|
AC_SUBST(LIBRUBY_LDSHARED)
|
|
AC_SUBST(LIBRUBY_DLDFLAGS)
|
|
AC_SUBST(RUBY_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(SOLIBS)
|
|
AC_SUBST(DLDLIBS)
|
|
AC_SUBST(ENABLE_SHARED)
|
|
|
|
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*|*djgpp*)
|
|
RUBY_LIB_PREFIX="/lib/ruby"
|
|
SITEDIR='/lib/ruby/site_ruby'
|
|
;;
|
|
*)
|
|
RUBY_LIB_PREFIX="${prefix}/lib/ruby"
|
|
SITEDIR='${prefix}/lib/ruby/site_ruby'
|
|
;;
|
|
esac
|
|
RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
|
|
sitedir='${prefix}/lib/ruby/site_ruby'
|
|
AC_ARG_WITH(sitedir,
|
|
[--with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]],
|
|
[sitedir=$withval],
|
|
[sitedir=`eval "echo ${SITEDIR}"`])
|
|
RUBY_SITE_LIB_PATH="${sitedir}"
|
|
RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"
|
|
|
|
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_SUBST(arch)dnl
|
|
AC_SUBST(sitedir)dnl
|
|
|
|
configure_args=$ac_configure_args
|
|
AC_SUBST(configure_args)dnl
|
|
|
|
if test "$fat_binary" = yes ; 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_PLATFORM, __ARCHITECTURE__ "-${target_os}")
|
|
else
|
|
arch="${target_cpu}-${target_os}"
|
|
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
|
|
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${arch}")
|
|
|
|
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
|
|
|
|
echo "creating config.h"
|
|
tr -d '\015' < confdefs.h > config.h
|
|
|
|
AC_OUTPUT($FIRSTMAKEFILE Makefile ext/extmk.rb)
|