summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-26 03:00:13 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-26 03:00:13 +0000
commit495f72ed3885970c40689186d0031c0f457f7e49 (patch)
treeeec24a7fabf7e4031873e4be9ee20843d45806f2 /configure.in
parente4b760128b523007ab31c5e8eb7ca22c2ce43df2 (diff)
* configure.in: enable -fPIE when checking -pie for fixing
OpenBSD build error. Patch by George Koehler. Thank you! [Bug #7606] [ruby-core:51082] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in9
1 files changed, 8 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index 57be606be1..3648814a9f 100644
--- a/configure.in
+++ b/configure.in
@@ -2708,14 +2708,21 @@ AS_CASE("$enable_shared", [yes], [
if test "$GCC" = yes -a -z "$EXTSTATIC" -a "x$pie" != xno; then
RUBY_TRY_CFLAGS(-fPIE, [pie=yes], [pie=no])
if test "$pie" = yes; then
- RUBY_APPEND_OPTION(XCFLAGS, -fPIE)
+ # Use -fPIE when testing -pie. RUBY_TRY_LDFLAGS sets
+ # $save_CFLAGS internally, so set other name here.
+ save_CFLAGS_before_pie="$CFLAGS"
+ CFLAGS="$CFLAGS -fPIE"
+
+ # gcc need -pie but clang need -Wl,-pie.
for pie in -pie -Wl,-pie; do
RUBY_TRY_LDFLAGS([$pie], [], [pie=])
if test "x$pie" != x; then
+ RUBY_APPEND_OPTION(XCFLAGS, -fPIE)
RUBY_APPEND_OPTION(XLDFLAGS, $pie)
break
fi
done
+ CFLAGS="$save_CFLAGS_before_pie"
fi
fi
])