diff --git a/ChangeLog b/ChangeLog index 29df28d912..545348ebfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Nov 25 08:48:35 2011 KOSAKI Motohiro + + * configure.in: turn on PIE if --enable-shared is not specified. + Fri Nov 25 08:05:07 2011 KOSAKI Motohiro * configure.in: add -fstack-protector. It help to protect us from diff --git a/configure.in b/configure.in index caef7d6684..30be256903 100644 --- a/configure.in +++ b/configure.in @@ -2350,6 +2350,12 @@ AS_CASE("$enable_shared", [yes], [ ]) ], [ LIBRUBYARG_SHARED= + + # enable PIE if possible + if test "$GCC" = yes; then + RUBY_TRY_CFLAGS(-fPIE, [RUBY_APPEND_OPTION(XCFLAGS, -fPIE) + RUBY_APPEND_OPTION(XLDFLAGS, -pie)]) + fi ]) if test "$enable_rpath" = yes; then test -z "$LIBRUBY_RPATHFLAGS" || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS "