diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-25 07:00:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-25 07:00:10 +0000 |
commit | df9199d468ffd0b0dfc669dbbb8923301a4b1d07 (patch) | |
tree | 7e3714b240777b2637cdfecadc8741daa09e87d9 /configure.in | |
parent | 7af1261dc8478fde09aa7ed0c9052c03917f2c18 (diff) | |
download | ruby-df9199d468ffd0b0dfc669dbbb8923301a4b1d07.tar.gz |
configure.in, win32/Makefile.sub: PACKED_STRUCT with VC
* configure.in (PACKED_STRUCT): check VC pragma too, and make
function-style macro.
* win32/Makefile.sub (PACKED_STRUCT): enable with VC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/configure.in b/configure.in index bdb22f0318..f13f550be7 100644 --- a/configure.in +++ b/configure.in @@ -1273,17 +1273,24 @@ RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>]) RUBY_CHECK_SIZEOF(clock_t, [], [], [@%:@include <time.h>]) AC_CACHE_CHECK(packed struct attribute, rb_cv_packed_struct, - [AC_TRY_COMPILE([struct { int a; } __attribute__((packed));], [], - [rb_cv_packed_struct=yes], [rb_cv_packed_struct=no])]) -if test "$rb_cv_packed_struct" = yes; then - AC_DEFINE_UNQUOTED(PACKED_STRUCT, __attribute__((packed))) - AS_CASE(["$target_cpu"], - [x86*|i?86|x64], [AC_DEFINE_UNQUOTED(PACKED_STRUCT_UNALIGNED, PACKED_STRUCT)], - [AC_DEFINE_UNQUOTED(PACKED_STRUCT_UNALIGNED,)]) + [rb_cv_packed_struct=no + for mac in \ + "__pragma(pack(push, 1)) x __pragma(pack(pop))" \ + "x __attribute__((packed))" \ + ; do + AC_TRY_COMPILE([@%:@define PACKED_STRUCT(x) $mac + PACKED_STRUCT(struct { int a; });], [], + [rb_cv_packed_struct=$mac; break]) + done]) +packed_struct_unaligned=x +if test "$rb_cv_packed_struct" != no; then + AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], [$rb_cv_packed_struct]) + AS_CASE(["$target_cpu"], + [x86*|i?86|x64], [packed_struct_unaligned='PACKED_STRUCT(x)']) else - AC_DEFINE_UNQUOTED(PACKED_STRUCT,) - AC_DEFINE_UNQUOTED(PACKED_STRUCT_UNALIGNED,) + AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], x) fi +AC_DEFINE_UNQUOTED(PACKED_STRUCT_UNALIGNED(x), $packed_struct_unaligned) AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [ AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[ |