File dovecot-2.0-pigeonhole_pie.patch of Package dovecot20

diff -r 0592366457df configure.in
--- dovecot-2.0-pigeonhole/configure.in	Sun Aug 08 11:21:04 2010 +0200
+++ dovecot-2.0-pigeonhole/configure.in	Wed Aug 11 03:52:33 2010 +0200
@@ -99,6 +99,35 @@
         fi,
         want_managesieve=yes)
 AM_CONDITIONAL(BUILD_MANAGESIEVE, test "$want_managesieve" = "yes")
+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)
+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
 
 AC_CONFIG_FILES([
 Makefile
openSUSE Build Service is sponsored by