summaryrefslogtreecommitdiff
path: root/libbacktrace
diff options
context:
space:
mode:
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-25 23:32:06 +0000
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-25 23:32:06 +0000
commit697bc369ee50379a9f57ef87bd212d94cda04c34 (patch)
treecb01c9c9d57c1272bda09c4601ea9503707034f9 /libbacktrace
parentb3b1474e93cc22f9d35cd95218506a737bb45362 (diff)
downloadlinaro-gcc-697bc369ee50379a9f57ef87bd212d94cda04c34.tar.gz
linaro-gcc-697bc369ee50379a9f57ef87bd212d94cda04c34.tar.bz2
linaro-gcc-697bc369ee50379a9f57ef87bd212d94cda04c34.zip
* configure.ac: Only compile with -fPIC if the target
supports it. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227203 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libbacktrace')
-rw-r--r--libbacktrace/ChangeLog6
-rwxr-xr-xlibbacktrace/configure20
-rw-r--r--libbacktrace/configure.ac8
3 files changed, 31 insertions, 3 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index c31c651f95c..8961199e36d 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,9 @@
+2015-08-26 Hans-Peter Nilsson <hp@axis.com>
+
+ * configure.ac: Only compile with -fPIC if the target
+ supports it.
+ * configure: Regenerate.
+
2015-08-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* configure.ac: Set have_mmap to no on spu-*-* targets.
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 268659948e8..72832d529e1 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -11710,11 +11710,29 @@ fi
# When building as a target library, shared libraries may want to link
# this in. We don't want to provide another shared library to
-# complicate dependencies. Instead, we just compile with -fPIC.
+# complicate dependencies. Instead, we just compile with -fPIC, if
+# the target supports compiling with that option.
PIC_FLAG=
if test -n "${with_target_subdir}"; then
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fPIC"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
PIC_FLAG=-fPIC
fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
+fi
# Similarly, use -fPIC with --enable-host-shared:
# Check whether --enable-host-shared was given.
if test "${enable_host_shared+set}" = set; then :
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index a0e487bb42d..feca006974b 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -163,10 +163,14 @@ fi
# When building as a target library, shared libraries may want to link
# this in. We don't want to provide another shared library to
-# complicate dependencies. Instead, we just compile with -fPIC.
+# complicate dependencies. Instead, we just compile with -fPIC, if
+# the target supports compiling with that option.
PIC_FLAG=
if test -n "${with_target_subdir}"; then
- PIC_FLAG=-fPIC
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fPIC"
+ AC_TRY_COMPILE([], [], [PIC_FLAG=-fPIC])
+ CFLAGS="$ac_save_CFLAGS"
fi
# Similarly, use -fPIC with --enable-host-shared:
AC_ARG_ENABLE(host-shared,