summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-11-08 15:38:59 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-11-08 15:38:59 +0000
commite1ce8f9c41bd9273a283dd0826ef0898c2a63763 (patch)
treec351ac4a3a6601d2086cfeaa5efcff9d698f5dbe
parentcc807663bfdfa6d7d2b25785d0ff1a8a674c04c9 (diff)
downloadmpv-e1ce8f9c41bd9273a283dd0826ef0898c2a63763.tar.bz2
mpv-e1ce8f9c41bd9273a283dd0826ef0898c2a63763.tar.xz
Add a check if compiler creates PIC code and if so add -DPIC to YASMFLAGS.
Should make it possible to compile MPlayer as PIE on x86_64 e.g. on hardened Gentoo and probably OpenBSD, too. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29853 b3059339-0415-0410-9bf9-f77b7e298cf2
-rwxr-xr-xconfigure15
1 files changed, 15 insertions, 0 deletions
diff --git a/configure b/configure
index 166127d934..c17ff27d0f 100755
--- a/configure
+++ b/configure
@@ -2576,6 +2576,20 @@ EOF
cc_check && ebx_available=yes && def_ebx_available='#define HAVE_EBX_AVAILABLE 1'
echores $ebx_available
+echocheck "PIC"
+pic=no
+cat > $TMPC << EOF
+int main(void) {
+// keep in sync with mangle.h and libavutil/internal.h
+#if !(defined(__PIC__) || defined(__pic__) || defined(PIC))
+#error PIC not enabled
+#endif
+ return 0;
+}
+EOF
+cc_check && pic=yes
+echores $pic
+
echocheck "yasm"
if test -z "$YASMFLAGS" ; then
if darwin ; then
@@ -2588,6 +2602,7 @@ if test -z "$YASMFLAGS" ; then
# currently tested for Linux x86, x86_64
YASMFLAGS="-f $objformat"
x86_64 && YASMFLAGS="$YASMFLAGS -DARCH_X86_64 -m amd64"
+ test "$pic" = "yes" && YASMFLAGS="$YASMFLAGS -DPIC"
case "$objformat" in
elf) test $_debug && YASMFLAGS="$YASMFLAGS -g dwarf2" ;;
macho64) YASMFLAGS="$YASMFLAGS -DPIC -DPREFIX" ;;