# HG changeset patch # User reimar # Date 1257694739 0 # Node ID 0cc6fcd342fd8e60f81e88103727712cc35222fe # Parent c540d350f7ab67e04a16739933278ea290e7cb2c 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. diff -r c540d350f7ab -r 0cc6fcd342fd configure --- a/configure Sun Nov 08 15:01:05 2009 +0000 +++ b/configure Sun Nov 08 15:38:59 2009 +0000 @@ -2576,6 +2576,20 @@ 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 @@ # 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" ;;