diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-18 04:11:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-18 04:11:57 +0000 |
commit | bf6efa76c0abcd1a2577cf0ca49f8137d3483b60 (patch) | |
tree | bfab888b7c78cbc78abfd7cf282ace921246ab50 /configure.in | |
parent | 353cd251706d07ae4ffd66994a72acae06e98057 (diff) | |
download | ruby-bf6efa76c0abcd1a2577cf0ca49f8137d3483b60.tar.gz |
* configure.in (pid_t, uid_t, gid_t): check if defined.
* intern.h, process.c, rubyio.h, ext/etc/etc.c, ext/pty/pty.c: use
rb_{pid,uid,gid}_t instead of plain int. [ruby-dev:30376]
* ext/etc/extconf.rb (PIDT2NUM, NUM2PIDT, UIDT2NUM, NUM2UIDT, GIDT2NUM,
NUM2GIDT): moved to configure.in.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/configure.in b/configure.in index 3ae9cecff4..a69aed9bea 100644 --- a/configure.in +++ b/configure.in @@ -239,10 +239,46 @@ AC_CHECK_SIZEOF(float, 4) AC_CHECK_SIZEOF(double, 8) AC_CHECK_SIZEOF(time_t, 0) -for id in pid_t gid_t uid_t; do - AC_CHECK_TYPE($id, [typ=$id], [typ=int]) - AC_DEFINE_UNQUOTED(rb_$id, $typ) -done +AC_DEFUN([RUBY_REPLACE_TYPE], [dnl + AC_CHECK_SIZEOF($1, 0, $3) + u= + size=$ac_cv_sizeof_[$1] + if test $size -gt 0; then + typ=$1 + AC_COMPILE_IFELSE( + [AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT] + [$3], [($typ)-1 > 0])], + [u=U]) + else + typ=$2 + size=$ac_cv_sizeof_[$2] + fi + if test $size -gt $ac_cv_sizeof_long; then + f=LL + elif test $size = $ac_cv_sizeof_long; then + f=LONG + else + f=INT + fi + AC_DEFINE_UNQUOTED(rb_$1, $typ) + AC_DEFINE_UNQUOTED(SIZEOF_RB_`echo $1 | tr a-z A-Z`, + SIZEOF_`echo $typ | tr a-z A-Z`) + typ=`echo $1 | tr a-z A-Z | tr -d _` + AC_DEFINE_UNQUOTED(${typ}2NUM, ${u}${f}2NUM) + AC_DEFINE_UNQUOTED(NUM2${typ}, NUM2${u}${f}) +]) +RUBY_REPLACE_TYPE(pid_t, int, [ +#include <sys/types.h> +#include <unistd.h> +]) +RUBY_REPLACE_TYPE(uid_t, int, [ +#include <sys/types.h> +#include <pwd.h> +]) +RUBY_REPLACE_TYPE(gid_t, int, [ +#include <sys/types.h> +#include <grp.h> +]) AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes, [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], |