File dovecot-1.1.7_pie.patch of Package dovecot11
Index: configure.in =================================================================== --- configure.in.orig 2008-11-24 15:32:37.973017731 +0100 +++ configure.in 2008-11-24 15:32:39.841017876 +0100 @@ -31,6 +31,15 @@ AC_ARG_ENABLE(ipv6, fi, want_ipv6=auto) +AC_ARG_ENABLE(pie, +[ --enable-pie Enable PIE support (default)], + if test x$enableval = xno; then + want_pie=no + else + want_pie=yes + fi, + want_pie=no) + AC_ARG_ENABLE(debug, [ --enable-debug Enable some extra expensive checks for developers], if test x$enableval = xyes; then @@ -1664,6 +1673,29 @@ if test $want_gc != no; then ]) fi + +dnl ** +dnl ** PIE check +dnl ** + +if test $want_pie = yes; then + AC_MSG_CHECKING([if we can use PIE]) + # try to compile something with pie + old_cflags=$CFLAGS + CFLAGS="-pie -fPIE -DPIE -Werror" + AC_TRY_LINK([],,[ + LIBS="$LIBS -pie" + # enforce -fPIC so all objects are compiled with it + CFLAGS="$old_cflags -fPIC -DPIC" + ac_want_pie="yes" + ], [ + # restore old CFLAGS + CFLAGS="$old_cflags" + ac_want_pie="no" + ]) + AC_MSG_RESULT($ac_want_pie) +fi + dnl ** dnl ** userdb and passdb checks dnl **