(linenum→info "unix/slp.c:2238")

ruby/1.9.0/configure.in

    1: dnl Process this file with autoconf to produce a configure script.
    2: AC_INIT()
    3: 
    4: AC_PREREQ(2.58)
    5: 
    6: AC_ARG_WITH(baseruby,
    7:         [  --with-baseruby=RUBY use RUBY as baseruby; RUBY is the pathname of ruby],
    8:         [
    9:                 case "$withval" in
   10:                 *ruby*)
   11:                         BASERUBY=$withval
   12:                         ;;
   13:                 *)
   14:                         AC_MSG_ERROR(need ruby)
   15:                         ;;
   16:                 esac
   17:         ],
   18:         [
   19:                 BASERUBY="ruby"
   20:         ])
   21: test "`$BASERUBY -e 'p 42' 2>/dev/null`" = 42 ||
   22:     BASERUBY="echo executable host ruby is required.  use --with-baseruby option.; false"
   23: AC_SUBST(BASERUBY)
   24: 
   25: AC_DEFUN([RUBY_MINGW32],
   26: [case "$host_os" in
   27: cygwin*)
   28: AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32,
   29: [AC_TRY_CPP([
   30: #ifndef __MINGW32__
   31: # error
   32: #endif
   33: ], rb_cv_mingw32=yes,rb_cv_mingw32=no)
   34: rm -f conftest*])
   35: test "$rb_cv_mingw32" = yes && target_os="mingw32"
   36:   ;;
   37: esac])
   38: 
   39: AC_DEFUN([RUBY_CPPOUTFILE],
   40: [AC_CACHE_CHECK(whether ${CPP} accepts -o, rb_cv_cppoutfile,
   41: [cppflags=$CPPFLAGS
   42: CPPFLAGS='-o conftest.i'
   43: AC_TRY_CPP([], rb_cv_cppoutfile=yes, rb_cv_cppoutfile=no)
   44: CPPFLAGS=$cppflags
   45: rm -f conftest*])
   46: if test "$rb_cv_cppoutfile" = yes; then
   47:   CPPOUTFILE='-o conftest.i'
   48: elif test "$rb_cv_cppoutfile" = no; then
   49:   CPPOUTFILE='> conftest.i'
   50: elif test -n "$rb_cv_cppoutfile"; then
   51:   CPPOUTFILE="$rb_cv_cppoutfile"
   52: fi
   53: AC_SUBST(CPPOUTFILE)])
   54: 
   55: AC_DEFUN([RUBY_PROG_GNU_LD],
   56: [AC_CACHE_CHECK(whether the linker is GNU ld, rb_cv_prog_gnu_ld,
   57: [if `$CC $CFLAGS $CPPFLAGS $LDFLAGS --print-prog-name=ld 2>&1` -v 2>&1 | grep "GNU ld" > /dev/null; then
   58:   rb_cv_prog_gnu_ld=yes
   59: else
   60:   rb_cv_prog_gnu_ld=no
   61: fi
   62: ])
   63: GNU_LD=$rb_cv_prog_gnu_ld
   64: AC_SUBST(GNU_LD)])
   65: 
   66: rb_version=`grep RUBY_VERSION $srcdir/version.h`
   67: MAJOR=`expr "$rb_version" : '#define RUBY_VERSION "\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*"'`
   68: MINOR=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*"'`
   69: TEENY=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)"'`
   70: AC_SUBST(MAJOR)
   71: AC_SUBST(MINOR)
   72: AC_SUBST(TEENY)
   73: dnl checks for alternative programs
   74: AC_ARG_WITH(gcc, [  --without-gcc           never use gcc], [
   75:         case $withval in
   76:         no)    : ${CC=cc}
   77:                 ;;
   78:         yes)   : ${CC=gcc}
   79:                 ;;
   80:         *)     CC=$withval
   81:                 ;;
   82:         esac])
   83: dnl If the user switches compilers, we can't believe the cache
   84: if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
   85: then
   86:   AC_MSG_ERROR(cached CC is different -- throw away $cache_file
   87: (it is also a good idea to do 'make clean' before compiling))
   88: fi
   89: 
   90: if test "$program_prefix" = NONE; then
   91:   program_prefix=
   92: fi
   93: 
   94: AC_CANONICAL_TARGET
   95: target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
   96: ac_install_sh='' # unusable for extension libraries.
   97: 
   98: dnl checks for fat-binary
   99: AC_ARG_ENABLE(fat-binary,
  100:        [  --enable-fat-binary=ARCHS
  101:                           build an Apple/NeXT Multi Architecture Binary (MAB);
  102:                           ARCHS is a comma-delimited list of architectures for
  103:                           which to build; if ARCHS is omitted, then the package
  104:                           will be built for all architectures supported by the
  105:                           platform ("ppc" for MacOS/X and Darwin; "ppc,i386"
  106:                           for Rhapsody; "m68k,i386,sparc" for OpenStep;
  107:                           "m68k,i386,sparc,hppa" for NextStep); if this option
  108:                           is disabled or omitted entirely, then the package
  109:                           will be built only for the target platform],
  110:        [fat_binary=$enableval], [fat_binary=no])
  111: if test "$fat_binary" != no; then
  112: 
  113:     AC_MSG_CHECKING([target architectures])
  114: 
  115:     # Respect TARGET_ARCHS setting from environment if available.
  116:     if test -z "$TARGET_ARCHS"; then
  117:         # Respect ARCH given to --enable-fat-binary if present.
  118:         if test "$fat_binary" != yes; then
  119:             TARGET_ARCHS=`echo "$fat_binary" | tr ',' ' '`
  120:         else
  121:             # Choose a default set of architectures based upon platform.
  122:             case "$target_os" in
  123:             darwin*)
  124:                 TARGET_ARCHS="ppc"
  125:                 ;;
  126:             rhapsody*)
  127:                 TARGET_ARCHS="ppc i386"
  128:                 ;;
  129:             openstep*)
  130:                 TARGET_ARCHS="m68k i386 sparc"
  131:                 ;;
  132:             nextstep*)
  133:                 TARGET_ARCHS="m68k i386 sparc hppa"
  134:                 ;;
  135:             *)
  136:                 TARGET_ARCHS=`arch`
  137:             esac
  138:         fi
  139:     fi
  140: 
  141:     AC_MSG_RESULT([$TARGET_ARCHS])
  142: 
  143:     # /usr/lib/arch_tool -archify_list $TARGET_ARCHS
  144:     ARCH_FLAG=
  145:     for archs in $TARGET_ARCHS 
  146:     do
  147:         ARCH_FLAG="$ARCH_FLAG -arch $archs"
  148:     done
  149:     AC_DEFINE(NEXT_FAT_BINARY)
  150: fi
  151: 
  152: case $target_cpu in
  153:   i?86) frame_address=yes;;
  154:   *)    frame_address=no;;
  155: esac
  156: AC_ARG_ENABLE(frame-address,
  157:        [  --enable-frame-address  use GCC __builtin_frame_address(). ],
  158:        [frame_address=$enableval])
  159: if test $frame_address = yes; then
  160:     AC_DEFINE(USE_BUILTIN_FRAME_ADDRESS)
  161: fi
  162: 
  163: AC_ARG_PROGRAM
  164: 
  165: dnl Checks for programs.
  166: 
  167: if test x"${build}" != x"${host}"; then
  168:   AC_CHECK_TOOL(CC, gcc)
  169: fi
  170: AC_PROG_CC
  171: AC_PROG_CXX
  172: AC_PROG_GCC_TRADITIONAL
  173: if test "$GCC" = yes; then
  174:     linker_flag=-Wl,
  175: else
  176:     linker_flag=
  177: fi
  178: 
  179: RUBY_PROG_GNU_LD
  180: RUBY_CPPOUTFILE
  181: 
  182: : ${OUTFLAG='-o '}
  183: : ${COUTFLAG=${OUTFLAG}}
  184: AC_SUBST(OUTFLAG)
  185: AC_SUBST(COUTFLAG)
  186: 
  187: RUBY_MINGW32
  188: 
  189: AC_CHECK_TOOL(RANLIB, ranlib, :)
  190: AC_CHECK_TOOL(AR, ar)
  191: if test -z "$AR"; then
  192:   AC_CHECK_PROGS(AR, aal, ar)
  193: fi
  194: 
  195: AC_CHECK_TOOL(AS, as)
  196: ASFLAGS=$ASFLAGS
  197: AC_SUBST(ASFLAGS)
  198: 
  199: case "$target_os" in
  200: cygwin*|mingw*)
  201:     AC_CHECK_TOOL(NM, nm)
  202:     AC_CHECK_TOOL(WINDRES, windres)
  203:     AC_CHECK_TOOL(DLLWRAP, dllwrap)
  204:     target_cpu=`echo $target_cpu | sed s/i.86/i386/`
  205:     case "$target_os" in
  206:     mingw*)
  207:         test "$rb_cv_msvcrt" = "" && unset rb_cv_msvcrt
  208:         AC_CHECK_TOOL(OBJDUMP, objdump)
  209:         AC_CACHE_CHECK(for mingw32 runtime DLL, rb_cv_msvcrt, [
  210:         AC_TRY_LINK([#include <stdio.h>],
  211:                     [FILE* volatile f = stdin; return 0;],
  212:                     [rb_cv_msvcrt=`$OBJDUMP -p conftest$ac_exeext |
  213:                                  tr A-Z a-z |
  214:                                    sed -n '/^[[     ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`],
  215:                     [rb_cv_msvcrt=msvcrt])
  216:         test "$rb_cv_msvcrt" = "" && rb_cv_msvcrt=msvcrt])
  217:     esac
  218:     : ${enable_shared=yes}
  219:     ;;
  220: aix*)
  221:     AC_CHECK_TOOL(NM, nm, /usr/ccs/bin/nm, /usr/ccs/bin:$PATH)
  222:     ;;
  223: hiuxmpp*)
  224:     # by TOYODA Eizi <toyoda@npd.kishou.go.jp>
  225:     AC_DEFINE(__HIUX_MPP__)
  226:     ;;
  227: esac
  228: 
  229: AC_PROG_LN_S
  230: AC_PROG_MAKE_SET
  231: AC_PROG_INSTALL
  232: 
  233: # checks for UNIX variants that set C preprocessor variables
  234: AC_AIX
  235: AC_MINIX
  236: 
  237: AC_SUBST(RM, ['rm -f'])
  238: AC_SUBST(CP, ['cp'])
  239: if $as_mkdir_p; then
  240:   MAKEDIRS='mkdir -p'
  241: else
  242:   MAKEDIRS='install -d'
  243: fi
  244: AC_SUBST(MAKEDIRS)
  245: 
  246: dnl check for large file stuff
  247: mv confdefs.h confdefs1.h
  248: : > confdefs.h
  249: AC_SYS_LARGEFILE
  250: mv confdefs.h largefile.h
  251: mv confdefs1.h confdefs.h
  252: cat largefile.h >> confdefs.h
  253: 
  254: case "$target_os" in
  255: mingw*)
  256:         ac_cv_type_off_t=yes
  257:         ac_cv_sizeof_off_t=8
  258:         ;;
  259: esac
  260: 
  261: AC_CHECK_TYPES([long long, off_t])
  262: 
  263: AC_CHECK_SIZEOF(int, 4)
  264: AC_CHECK_SIZEOF(short, 2)
  265: AC_CHECK_SIZEOF(long, 4)
  266: AC_CHECK_SIZEOF(long long, 0)
  267: AC_CHECK_SIZEOF(__int64, 0)
  268: AC_CHECK_SIZEOF(off_t, 0)
  269: AC_CHECK_SIZEOF(void*, 4)
  270: AC_CHECK_SIZEOF(float, 4)
  271: AC_CHECK_SIZEOF(double, 8)
  272: AC_CHECK_SIZEOF(time_t, 0)
  273: 
  274: dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
  275: AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
  276:     AC_CHECK_TYPE([$1],
  277:         [AC_DEFINE_UNQUOTED(rb_[$1], [$1])],
  278:         [AC_DEFINE_UNQUOTED(rb_[$1], [$2])],
  279:         [$4])
  280:     AC_CACHE_CHECK([for convertible type of [$1]], rb_cv_[$1]_convertible, [
  281:         u= t=
  282:         AC_COMPILE_IFELSE(
  283:             [AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT]
  284:                                       [$4], [(rb_[$1])-1 > 0])],
  285:             [u=U])
  286:         if test x"$t" = x; then
  287:             AC_COMPILE_IFELSE(
  288:                 [AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT]
  289:                                           [$4], [sizeof(rb_[$1]) > sizeof(long)])],
  290:                 [t=LL])
  291:         fi
  292:         if test x"$t" = x; then
  293:             AC_COMPILE_IFELSE(
  294:                 [AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT]
  295:                                           [$4], [sizeof(rb_[$1]) == sizeof(long)])],
  296:                 [t=LONG])
  297:         fi
  298:         if test x"$t" = x; then
  299:             t=INT
  300:         fi
  301:         rb_cv_[$1]_convertible=${u}${t}])
  302:     AC_DEFINE_UNQUOTED([$3]2NUM[(v)], [${rb_cv_[$1]_convertible}2NUM(v)])
  303:     AC_DEFINE_UNQUOTED(NUM2[$3][(v)], [NUM2${rb_cv_[$1]_convertible}(v)])
  304: ])
  305: RUBY_REPLACE_TYPE(pid_t, int, PIDT)
  306: RUBY_REPLACE_TYPE(uid_t, int, UIDT)
  307: RUBY_REPLACE_TYPE(gid_t, int, GIDT)
  308: 
  309: AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
  310:   [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
  311:         rb_cv_have_prototypes=yes,
  312:         rb_cv_have_prototypes=no)])
  313: if test "$rb_cv_have_prototypes" = yes; then
  314:   AC_DEFINE(HAVE_PROTOTYPES)
  315: fi
  316: 
  317: AC_CACHE_CHECK(token paste string, rb_cv_tokenpaste,
  318:   [AC_TRY_COMPILE([#define paste(a,b) a##b],
  319:                   [int xy = 1; return paste(x,y);],
  320:                   rb_cv_tokenpaste=ansi,
  321:                   rb_cv_tokenpaste=knr)])
  322: if test "$rb_cv_tokenpaste" = ansi; then
  323:   AC_DEFINE(TOKEN_PASTE(x,y),[x##y])
  324: else
  325:   AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
  326: fi
  327: 
  328: AC_CACHE_CHECK(stringization, rb_cv_stringization, [
  329:   rb_cv_stringization=no
  330:   for string in "#expr" '"expr"'; do
  331:     AC_COMPILE_IFELSE([
  332:       AC_LANG_BOOL_COMPILE_TRY([
  333: #define STRINGIZE0(expr) $string
  334: #define STRINGIZE(expr) STRINGIZE0(expr)
  335: #undef real_test_for_stringization
  336: #define test_for_stringization -.real_test_for_stringization.-
  337: const char stringized[[]] = STRINGIZE(test_for_stringization);
  338: ], [sizeof(stringized) == 32])],
  339:       [rb_cv_stringization="$string"; break],
  340:       [rb_cv_stringization=no])
  341:   done]
  342: )
  343: AC_DEFINE(STRINGIZE(expr),STRINGIZE0(expr))
  344: if test x"$rb_cv_stringization" != xno -a "$rb_cv_stringization" != "#expr"; then
  345:   AC_DEFINE_UNQUOTED(STRINGIZE0(expr),$rb_cv_stringization)
  346:   AC_DEFINE(OLD_FASHIONED_STRINGIZATION,1)
  347: fi
  348: 
  349: AC_CACHE_CHECK([string literal concatenation],
  350:   rb_cv_string_literal_concatenation, [
  351:   AC_COMPILE_IFELSE([
  352:     AC_LANG_BOOL_COMPILE_TRY([
  353: const char concatenated_literal[[]] = "literals" "to"
  354:   "be" "concatenated.";
  355: ], [sizeof(concatenated_literal) == 26])],
  356:     [rb_cv_string_literal_concatenation=yes],
  357:     [rb_cv_string_literal_concatenation=no])]
  358: )
  359: if test "$rb_cv_string_literal_concatenation" = no; then
  360:   AC_DEFINE(NO_STRING_LITERAL_CONCATENATION,1)
  361: fi
  362: 
  363: AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg,
  364:   [AC_TRY_COMPILE([
  365: #include <stdarg.h>
  366: int foo(int x, ...) {
  367:         va_list va;
  368:         va_start(va, x);
  369:         va_arg(va, int);
  370:         va_arg(va, char *);
  371:         va_arg(va, double);
  372:         return 0;
  373: }
  374: ], [return foo(10, "", 3.14);],
  375:         rb_cv_stdarg=yes,
  376:         rb_cv_stdarg=no)])
  377: if test "$rb_cv_stdarg" = yes; then
  378:   AC_DEFINE(HAVE_STDARG_PROTOTYPES)
  379: fi
  380: 
  381: AC_DEFUN([RUBY_FUNC_ATTRIBUTE], [dnl
  382: m4_ifval([$2], dnl
  383:   [AS_VAR_PUSHDEF([attrib],[$2])], dnl
  384:   [AS_VAR_PUSHDEF([attrib],[FUNC_]AS_TR_CPP($1))] dnl
  385: )dnl
  386: m4_ifval([$3], dnl
  387:   [AS_VAR_PUSHDEF([rbcv],[$3])], dnl
  388:   [AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
  389: )dnl
  390: AC_CACHE_CHECK(for [$1] function attribute, rbcv,
  391: [rbcv=x
  392: if test "${ac_c_werror_flag+set}"; then
  393:   rb_c_werror_flag="$ac_c_werror_flag"
  394: else
  395:   unset rb_c_werror_flag
  396: fi
  397: ac_c_werror_flag=yes
  398: for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do
  399:   AC_TRY_COMPILE(
  400:     [#define ]attrib[(x) $mac
  401:     ]attrib[(void conftest_attribute_check(void));], [],
  402:     [rbcv="$mac"; break])
  403: done
  404: if test "${rb_c_werror_flag+set}"; then
  405:   ac_c_werror_flag="$rb_c_werror_flag"
  406: else
  407:   unset ac_c_werror_flag
  408: fi
  409: ])
  410: AC_DEFINE_UNQUOTED(attrib[(x)], $rbcv)
  411: AS_VAR_POPDEF([attrib])
  412: AS_VAR_POPDEF([rbcv])
  413: ])
  414: 
  415: RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
  416: RUBY_FUNC_ATTRIBUTE(deprecated, DEPRECATED)
  417: RUBY_FUNC_ATTRIBUTE(noinline, NOINLINE)
  418: RUBY_FUNC_ATTRIBUTE(stdcall)
  419: RUBY_FUNC_ATTRIBUTE(cdecl)
  420: RUBY_FUNC_ATTRIBUTE(fastcall)
  421: 
  422: AC_CACHE_CHECK([for RUBY_EXTERN], rb_cv_ruby_extern,
  423: [rb_cv_ruby_extern=no
  424: for mac in "__attribute__((dllimport))" "__declspec(dllimport)"; do
  425:   AC_TRY_COMPILE(
  426:     [extern $mac void conftest(void);],
  427:     [rb_cv_ruby_extern="extern $mac"; break])
  428: done])
  429: test "x$rb_cv_ruby_extern" = xno || AC_DEFINE_UNQUOTED(RUBY_EXTERN, $rb_cv_ruby_extern)
  430: 
  431: XCFLAGS="$XCFLAGS -DRUBY_EXPORT"
  432: 
  433: dnl Check whether we need to define sys_nerr locally
  434: AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
  435: #include <errno.h>])
  436: 
  437: case "$target_os" in
  438: freebsd*)
  439:   AC_CACHE_CHECK([whether pthread should be enabled by default],
  440:     rb_cv_enable_pthread_default,
  441:     [AC_TRY_CPP([
  442: #include <osreldate.h>
  443: #if __FreeBSD_version < 502102
  444: #error pthread should be disabled on this platform
  445: #endif
  446:       ],
  447:       rb_cv_enable_pthread_default=yes,
  448:       rb_cv_enable_pthread_default=no)])
  449:   enable_pthread_default=$rb_cv_enable_pthread_default
  450:   ;;
  451: mingw*)
  452:   enable_pthread_default=no
  453:   ;;
  454: *)
  455:   enable_pthread_default=yes
  456:   ;;
  457: esac
  458: 
  459: AC_ARG_ENABLE(pthread,
  460:        [  --enable-pthread        use pthread library.],
  461:        [enable_pthread=$enableval], [enable_pthread=$enable_pthread_default])
  462: 
  463: dnl Checks for libraries.
  464: case "$target_os" in
  465: nextstep*)      ;;
  466: openstep*)      ;;
  467: rhapsody*)      ;;
  468: darwin*)        LIBS="-lobjc $LIBS";;
  469: hpux*)          LIBS="-lm $LIBS"
  470:                 ac_cv_c_inline=no;;
  471: human*)         ac_cv_func_getpgrp_void=yes
  472:                 ac_cv_func_setitimer=no
  473:                 ;;
  474: beos*)          ac_cv_func_link=no;;
  475: cygwin*)        rb_cv_have_daylight=no
  476:                 ac_cv_var_tzname=no
  477:                 ac_cv_func__setjmp=no
  478:                 ac_cv_func_setitimer=no
  479:                 ;;
  480: mingw*)         LIBS="-lshell32 -lws2_32 $LIBS"
  481:                 ac_cv_header_a_out_h=no
  482:                 ac_cv_header_pwd_h=no
  483:                 ac_cv_header_utime_h=no
  484:                 ac_cv_header_sys_ioctl_h=no
  485:                 ac_cv_header_sys_param_h=no
  486:                 ac_cv_header_sys_resource_h=no
  487:                 ac_cv_header_sys_select_h=no
  488:                 ac_cv_header_sys_time_h=no
  489:                 ac_cv_header_sys_times_h=no
  490:                 ac_cv_func_times=yes
  491:                 ac_cv_func_waitpid=yes
  492:                 ac_cv_func_fsync=yes
  493:                 ac_cv_func_snprintf=yes
  494:                 ac_cv_func_vsnprintf=yes
  495:                 ac_cv_func_seekdir=yes
  496:                 ac_cv_func_telldir=yes
  497:                 ac_cv_func_isinf=yes
  498:                 ac_cv_func_isnan=yes
  499:                 ac_cv_func_finite=yes
  500:                 ac_cv_func_link=yes
  501:                 ac_cv_func_truncate=yes
  502:                 ac_cv_func_fseeko=yes
  503:                 ac_cv_func_ftello=yes
  504:                 ac_cv_lib_crypt_crypt=no
  505:                 ac_cv_func_getpgrp_void=no
  506:                 ac_cv_func_setpgrp_void=yes
  507:                 ac_cv_func_memcmp_working=yes
  508:                 ac_cv_lib_dl_dlopen=no
  509:                 rb_cv_binary_elf=no
  510:                 rb_cv_negative_time_t=no
  511:                 ac_cv_func_fcntl=yes
  512:                 ;;
  513: os2-emx*)       LIBS="-lm $LIBS"
  514:                 ac_cv_lib_dir_opendir=no;;
  515: msdosdjgpp*)    LIBS="-lm $LIBS"
  516:                 ac_cv_func_getpgrp_void=yes
  517:                 ac_cv_func_setitimer=no
  518:                 ac_cv_sizeof_rlim_t=4
  519:                 ac_cv_func_fork=no
  520:                 ac_cv_func_setrlimit=no
  521:                 ;;
  522: bsdi*)          LIBS="-lm $LIBS"
  523:                 ac_cv_sizeof_rlim_t=8;;
  524: freebsd*)       LIBS="-lm $LIBS"
  525:                 AC_CACHE_CHECK([whether -lxpg4 has to be linked],
  526:                   rb_cv_lib_xpg4_needed,
  527:                   [AC_TRY_CPP([
  528: #include <osreldate.h>
  529: #if __FreeBSD_version < 400020 || \
  530:    (__FreeBSD_version >= 500000 && __FreeBSD_version < 500005)
  531: #error needs libxpg4
  532: #endif
  533:                    ],
  534:                    rb_cv_lib_xpg4_needed=no,
  535:                    rb_cv_lib_xpg4_needed=yes,
  536:                    rb_cv_lib_xpg4_needed=yes)])
  537:                 if test "$rb_cv_lib_xpg4_needed" = yes; then
  538:                         AC_CHECK_LIB(xpg4, setlocale)
  539:                 fi
  540:                 ;;
  541: dragonfly*)     LIBS="-lm $LIBS"
  542:                 ;;
  543: bow)            ac_cv_func_setitimer=no
  544:                 ;;
  545: superux*)     ac_cv_func_setitimer=no
  546:               ;;
  547: *) LIBS="-lm $LIBS";;
  548: esac
  549: AC_CHECK_LIB(crypt, crypt)
  550: AC_CHECK_LIB(dl, dlopen)        # Dynamic linking for SunOS/Solaris and SYSV
  551: AC_CHECK_LIB(dld, shl_load)     # Dynamic linking for HP-UX
  552: AC_CHECK_LIB(socket, socketpair)        # SunOS/Solaris
  553: AC_CHECK_LIB(rt, clock_gettime) # GNU/Linux
  554: 
  555: case "$target_cpu" in
  556: alpha*)         case "$target_os"::"$GCC" in
  557:                 *::yes)       CFLAGS="-mieee $CFLAGS" ;;   # gcc
  558:                 osf*)   CFLAGS="-ieee $CFLAGS" ;;    # ccc
  559:                 esac ;;
  560: esac
  561: 
  562: dnl Checks for header files.
  563: AC_HEADER_DIRENT
  564: AC_HEADER_STDC
  565: AC_HEADER_SYS_WAIT
  566: AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h sys/syscall.h\
  567:                  fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
  568:                  syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \
  569:                  sys/mkdev.h sys/utime.h netinet/in_systm.h float.h ieeefp.h pthread.h \
  570:                  ucontext.h intrinsics.h langinfo.h locale.h)
  571: 
  572: dnl Check additional types.
  573: AC_CHECK_SIZEOF(rlim_t, 0, [
  574:   #ifdef HAVE_SYS_TYPES_H
  575:   # include <sys/types.h>
  576:   #endif
  577:   #ifdef HAVE_SYS_TIME_H
  578:   # include <sys/time.h>
  579:   #endif
  580:   #ifdef HAVE_SYS_RESOURCE_H
  581:   # include <sys/resource.h>
  582:   #endif
  583:   #ifdef HAVE_UNISTD_H
  584:   # include <unistd.h>
  585:   #endif
  586:   #include <stdio.h>
  587: ])
  588: 
  589: dnl Checks for typedefs, structures, and compiler characteristics.
  590: AC_TYPE_SIZE_T
  591: AC_STRUCT_ST_BLKSIZE
  592: AC_STRUCT_ST_BLOCKS
  593: AC_STRUCT_ST_RDEV
  594: AC_CHECK_MEMBERS([struct stat.st_atim])
  595: AC_CHECK_MEMBERS([struct stat.st_atimespec])
  596: AC_CHECK_MEMBERS([struct stat.st_atimensec])
  597: AC_CHECK_MEMBERS([struct stat.st_mtim])
  598: AC_CHECK_MEMBERS([struct stat.st_mtimespec])
  599: AC_CHECK_MEMBERS([struct stat.st_mtimensec])
  600: AC_CHECK_MEMBERS([struct stat.st_ctim])
  601: AC_CHECK_MEMBERS([struct stat.st_ctimespec])
  602: AC_CHECK_MEMBERS([struct stat.st_ctimensec])
  603: 
  604: AC_CHECK_TYPES(struct timespec)
  605: 
  606: AC_CHECK_TYPE(fd_mask, [AC_DEFINE(HAVE_RB_FD_INIT, 1)])
  607: 
  608: AC_CACHE_CHECK(for stack end address, rb_cv_stack_end_address,
  609: [rb_cv_stack_end_address=no
  610: for addr in __libc_stack_end _SEND; do
  611:   AC_TRY_LINK(
  612:     [extern void *$addr;],
  613:     [if (!$addr) return 1;],
  614:     [rb_cv_stack_end_address="$addr"; break])
  615: done])
  616: if test $rb_cv_stack_end_address != no; then
  617:   AC_DEFINE_UNQUOTED(STACK_END_ADDRESS, $rb_cv_stack_end_address)
  618: fi
  619: 
  620: dnl Checks for library functions.
  621: AC_TYPE_GETGROUPS
  622: AC_TYPE_SIGNAL
  623: case "${target_cpu}-${target_os}" in
  624: powerpc-darwin*)
  625:   AC_LIBSOURCES(alloca.c)
  626:   AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.${ac_objext}])
  627:   AC_DEFINE(C_ALLOCA)
  628:   AC_DEFINE_UNQUOTED(alloca, alloca)
  629:   ;;
  630: *)
  631:   AC_FUNC_ALLOCA
  632:   ;;
  633: esac
  634: AC_FUNC_MEMCMP
  635: AC_REPLACE_FUNCS(dup2 memmove strcasecmp strncasecmp strerror strftime\
  636:                  strchr strstr strtoul crypt flock vsnprintf\
  637:                  isnan finite isinf hypot acosh erf strlcpy strlcat)
  638: AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot fsync getcwd eaccess\
  639:               truncate chsize times utimes utimensat fcntl lockf lstat\
  640:               link symlink readlink\
  641:               setitimer setruid seteuid setreuid setresuid setproctitle socketpair\
  642:               setrgid setegid setregid setresgid issetugid pause lchown lchmod\
  643:               getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
  644:               getpriority getrlimit setrlimit sysconf group_member\
  645:               dlopen sigprocmask sigaction _setjmp vsnprintf snprintf\
  646:               setsid telldir seekdir fchmod cosh sinh tanh log2 round\
  647:               setuid setgid daemon select_large_fdset setenv unsetenv\
  648:               mktime timegm clock_gettime gettimeofday)
  649: AC_ARG_ENABLE(setreuid,
  650:        [  --enable-setreuid       use setreuid()/setregid() according to need even if obsolete.],
  651:        [use_setreuid=$enableval])
  652: if test "$use_setreuid" = yes; then
  653:     AC_DEFINE(USE_SETREUID)
  654:     AC_DEFINE(USE_SETREGID)
  655: fi
  656: AC_STRUCT_TIMEZONE
  657: AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
  658:   [AC_TRY_COMPILE([#include <time.h>],
  659:     [struct tm t; t.tm_gmtoff = 3600;],
  660:   [rb_cv_member_struct_tm_tm_gmtoff=yes],
  661:   [rb_cv_member_struct_tm_tm_gmtoff=no])])
  662: if test "$rb_cv_member_struct_tm_tm_gmtoff" = yes; then
  663:   AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF)
  664: fi
  665: AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
  666:   [AC_TRY_LINK([#include <time.h>
  667:   int i;],
  668:         [i = daylight;],
  669:         rb_cv_have_daylight=yes,
  670:         rb_cv_have_daylight=no)])
  671: if test "$rb_cv_have_daylight" = yes; then
  672:   AC_DEFINE(HAVE_DAYLIGHT)
  673: fi
  674: AC_DEFUN([RUBY_CHECK_VARTYPE], [dnl
  675: AC_CACHE_CHECK([for external $1], rb_cv_var_$1,
  676:   [rb_cv_var_$1=no
  677:   AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
  678:     $2
  679:     const volatile void *volatile t;],
  680:     [t = &(&$1)[0];],
  681:     [for t in $3; do
  682:       AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
  683:         $2
  684:         extern $t $1;
  685:         const volatile void *volatile t;],
  686:         [t = &(&$1)[0];],
  687:         [rb_cv_var_$1=$t; break])
  688:     done])])
  689: if test "[$rb_cv_var_]$1" != no; then
  690:   AC_DEFINE([HAVE_VAR_]m4_toupper($1))
  691:   AC_DEFINE_UNQUOTED([TYPEOF_VAR_]m4_toupper($1), $rb_cv_var_$1)
  692: fi])
  693: RUBY_CHECK_VARTYPE(timezone, [#include <time.h>], [long int])
  694: RUBY_CHECK_VARTYPE(altzone, [#include <time.h>], [long int])
  695: if test "$rb_cv_var_timezone" = no; then
  696:   AC_CHECK_FUNCS(timezone)
  697:   if test "$ac_cv_func_timezone" = yes; then
  698:     AC_CACHE_CHECK([whether timezone requires zero arguments], rb_cv_func_timezone_void,
  699:       [AC_TRY_COMPILE([#include <time.h>],
  700:         [(void)timezone(0, 0);],
  701:         [rb_cv_func_timezone_void=no],
  702:         [rb_cv_func_timezone_void=yes])]
  703:     )
  704:     if test $rb_cv_func_timezone_void = yes; then
  705:       AC_DEFINE(TIMEZONE_VOID)
  706:     fi
  707:   fi
  708: fi
  709: 
  710: AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
  711:   [AC_TRY_RUN([
  712: #include <time.h>
  713: 
  714: void
  715: check(tm, y, m, d, h, s)
  716:     struct tm *tm;
  717:     int y, m, d, h, s;
  718: {
  719:     if (!tm ||
  720:         tm->tm_year != y ||
  721:         tm->tm_mon  != m-1 ||
  722:         tm->tm_mday != d ||
  723:         tm->tm_hour != h ||
  724:         tm->tm_sec  != s) {
  725:         exit(1);
  726:     }
  727: }
  728: 
  729: int
  730: main()
  731: {
  732:    time_t t = -1;
  733:    struct tm *tm;
  734: 
  735:    check(gmtime(&t), 69, 12, 31, 23, 59);
  736:    t = ~(time_t)0 << 31;
  737:    check(gmtime(&t), 1, 12, 13, 20, 52);
  738:    return 0;
  739: }
  740: ],
  741:         rb_cv_negative_time_t=yes,
  742:         rb_cv_negative_time_t=no,
  743:         rb_cv_negative_time_t=yes)])
  744: if test "$rb_cv_negative_time_t" = yes; then
  745:   AC_DEFINE(NEGATIVE_TIME_T)
  746: fi
  747: 
  748: if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
  749:    AC_DEFINE(POSIX_SIGNAL)
  750: else
  751:   AC_CACHE_CHECK(for BSD signal semantics, rb_cv_bsd_signal,
  752:     [AC_TRY_RUN([
  753: #include <stdio.h>
  754: #include <signal.h>
  755: 
  756: void
  757: sig_handler(dummy)
  758:      int dummy;
  759: {
  760: }
  761: 
  762: int
  763: main()
  764: {
  765:   signal(SIGINT, sig_handler);
  766:   kill(getpid(), SIGINT);
  767:   kill(getpid(), SIGINT);
  768:   return 0;
  769: }
  770: ],
  771:         rb_cv_bsd_signal=yes,
  772:         rb_cv_bsd_signal=no,
  773:         rb_cv_bsd_signal=no)])
  774:   if test "$rb_cv_bsd_signal" = yes; then
  775:     AC_DEFINE(BSD_SIGNAL)
  776:   fi
  777: fi
  778: 
  779: AC_FUNC_GETPGRP
  780: AC_FUNC_SETPGRP  
  781: 
  782: AC_C_BIGENDIAN
  783: AC_C_CONST
  784: AC_C_CHAR_UNSIGNED
  785: AC_C_INLINE
  786: AC_C_VOLATILE
  787: 
  788: if test x"$target_cpu" = xia64; then
  789:     AC_LIBOBJ([ia64])
  790:     AC_CACHE_CHECK(for __libc_ia64_register_backing_store_base,
  791:                    rb_cv___libc_ia64_register_backing_store_base,
  792:     [rb_cv___libc_ia64_register_backing_store_base=no
  793:     AC_TRY_LINK(
  794:       [extern unsigned long __libc_ia64_register_backing_store_base;],
  795:       [unsigned long p = __libc_ia64_register_backing_store_base;
  796:        printf("%ld\n", p);],
  797:       [rb_cv___libc_ia64_register_backing_store_base=yes])])
  798:     if test $rb_cv___libc_ia64_register_backing_store_base = yes; then
  799:       AC_DEFINE(HAVE___LIBC_IA64_REGISTER_BACKING_STORE_BASE)
  800:     fi
  801: fi
  802: 
  803: AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
  804:     [AC_TRY_RUN([
  805: int
  806: main()
  807: {
  808:   if (-1==(-1>>1))
  809:     return 0;
  810:   return 1;
  811: }
  812: ],
  813:         rb_cv_rshift_sign=yes,
  814:         rb_cv_rshift_sign=no,
  815:         rb_cv_rshift_sign=yes)])
  816: if test "$rb_cv_rshift_sign" = yes; then
  817:   AC_DEFINE(RSHIFT(x,y), ((x)>>(int)y))
  818: else
  819:   AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>y) : (x)>>y))
  820: fi
  821: 
  822: AC_MSG_CHECKING(read count field in FILE structures)