[MPlayer-dev-eng] [PATCH] detect PIC and set -DPIC in YASMFLAGS

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Nov 8 00:47:36 CET 2009


Hello,
this is necessary to compile with YASM enabled on amd64 systems that
have PIC/PIE enabled by default, e.g. hardened Gentoo.
Index: configure
===================================================================
--- configure   (revision 29850)
+++ configure   (working copy)
@@ -2580,6 +2580,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) {
+#if defined(__PIC__) || defined(__pic__) || defined(PIC)
+    return 0;
+#else
+    error please!
+#endif
+}
+EOF
+cc_check && pic=yes
+echores $pic
+
 echocheck "yasm"
 if test -z "$YASMFLAGS" ; then
   if darwin ; then
@@ -2592,6 +2606,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" ;;




More information about the MPlayer-dev-eng mailing list