Index: cyrus-imapd-2.3.17/configure.in
===================================================================
--- cyrus-imapd-2.3.17.orig/configure.in
+++ cyrus-imapd-2.3.17/configure.in
@@ -1257,6 +1257,27 @@ AC_SUBST(PERL_SUBDIRS)
 AC_SUBST(PERL_DEPSUBDIRS)
 AC_SUBST(PERL)
 
+AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
+  cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+  if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
+                              -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+  then
+    libc_cv_fpie=yes
+    PIE_CFLAGS="-fPIE"
+    PIE_LDFLAGS="-pie"
+  else
+    libc_cv_fpie=no
+    PIE_CFLAGS=""
+    PIE_LDFLAGS=""
+  fi
+  rm -f conftest*])
+AC_SUBST(libc_cv_fpie)
+AC_SUBST(PIE_CFLAGS)
+AC_SUBST(PIE_LDFLAGS)
+
 AH_TOP([
 /*
  * Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
Index: cyrus-imapd-2.3.17/imap/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/imap/Makefile.in
+++ cyrus-imapd-2.3.17/imap/Makefile.in
@@ -70,8 +70,8 @@ DRAC_LIBS = @DRACLIBS@
 LIBS = $(IMAP_LIBS) $(IMAP_COM_ERR_LIBS)
 DEPLIBS = ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@
 
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@ @COM_ERR_LDFLAGS@ 
+CFLAGS = @CFLAGS@ @PIE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @COM_ERR_LDFLAGS@ @PIE_LDFLAGS@
 
 SHELL = /bin/sh
 MAKEDEPEND = @MAKEDEPEND@
Index: cyrus-imapd-2.3.17/lib/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/lib/Makefile.in
+++ cyrus-imapd-2.3.17/lib/Makefile.in
@@ -63,8 +63,8 @@ CPPFLAGS = -I.. @CPPFLAGS@ @COM_ERR_CPPF
 LIBS = @LIBS@
 
 MAKEDEPEND_CFLAGS = @CFLAGS@
-CFLAGS = @CFLAGS@ @PERL_CCCDLFLAGS@
-LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@ @PERL_CCCDLFLAGS@ -fPIC
+LDFLAGS = @LDFLAGS@ @PIE_LDFLAGS@
 
 SHELL = /bin/sh
 MAKEDEPEND = @MAKEDEPEND@
Index: cyrus-imapd-2.3.17/master/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/master/Makefile.in
+++ cyrus-imapd-2.3.17/master/Makefile.in
@@ -56,8 +56,8 @@ DEFS = @DEFS@ @LOCALDEFS@
 CPPFLAGS = -I.. -I$(srcdir)/../lib -I$(srcdir)/../imap @CPPFLAGS@ @COM_ERR_CPPFLAGS@
 DEPLIBS = @DEPLIBS@
 
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@ @COM_ERR_LDFLAGS@
+CFLAGS = @CFLAGS@ @PIE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @COM_ERR_LDFLAGS@ @PIE_LDFLAGS@
 LIBS = ../lib/libcyrus_min.a @LIB_UCDSNMP@ @LIBS@ @COM_ERR_LIBS@ @SLPLIBS@
 
 SHELL = /bin/sh
Index: cyrus-imapd-2.3.17/netnews/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/netnews/Makefile.in
+++ cyrus-imapd-2.3.17/netnews/Makefile.in
@@ -55,8 +55,8 @@ CPPFLAGS = -I.. -I$(srcdir) -I$(srcdir)/
 LIBS =  @IMAP_LIBS@ @LIB_RT@
 DEPLIBS = ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@ 
 
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@ @PIE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @PIE_LDFLAGS@
 
 SHELL = /bin/sh
 MAKEDEPEND = @MAKEDEPEND@
Index: cyrus-imapd-2.3.17/notifyd/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/notifyd/Makefile.in
+++ cyrus-imapd-2.3.17/notifyd/Makefile.in
@@ -56,8 +56,8 @@ CYRUS_GROUP=@cyrus_group@
 
 DEFS = @DEFS@ @LOCALDEFS@
 CPPFLAGS = -I.. -I$(srcdir)/../sieve -I$(srcdir)/../imap -I$(srcdir)/../lib @COM_ERR_CPPFLAGS@ @CPPFLAGS@ @SASLFLAGS@
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@ @PIE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @PIE_LDFLAGS@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
Index: cyrus-imapd-2.3.17/perl/sieve/lib/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/perl/sieve/lib/Makefile.in
+++ cyrus-imapd-2.3.17/perl/sieve/lib/Makefile.in
@@ -58,7 +58,7 @@ IMAP_LIBS = @IMAP_LIBS@
 DEPLIBS = ../../../lib/libcyrus.a ../../../lib/libcyrus_min.a @DEPLIBS@
 
 MAKEDEPEND_CFLAGS = @CFLAGS@
-CFLAGS = @CFLAGS@ @PERL_CCCDLFLAGS@
+CFLAGS = @CFLAGS@ @PERL_CCCDLFLAGS@ -fPIC
 LDFLAGS = @LDFLAGS@
 
 SHELL = /bin/sh
Index: cyrus-imapd-2.3.17/sieve/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/sieve/Makefile.in
+++ cyrus-imapd-2.3.17/sieve/Makefile.in
@@ -60,8 +60,8 @@ COMPILE_ET = @COMPILE_ET@
 DEFS = @DEFS@ @LOCALDEFS@
 CPPFLAGS = -I.. -I$(srcdir)/../lib @COM_ERR_CPPFLAGS@ @CPPFLAGS@ @SASLFLAGS@
 MAKEDEPEND_CFLAGS = @CFLAGS@
-CFLAGS = @CFLAGS@ @PERL_CCCDLFLAGS@
-LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@ @PERL_CCCDLFLAGS@ @PIE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @PIE_LDFLAGS@
 
 MAKEDEPEND = @MAKEDEPEND@
 
Index: cyrus-imapd-2.3.17/syslog/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/syslog/Makefile.in
+++ cyrus-imapd-2.3.17/syslog/Makefile.in
@@ -55,8 +55,8 @@ DEFS = @DEFS@
 CPPFLAGS = @CPPFLAGS@
 LIBS = @LIBS@
 
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@ @PIE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @PIE_LDFLAGS@
 
 SHELL = /bin/sh
 MAKEDEPEND = @MAKEDEPEND@
Index: cyrus-imapd-2.3.17/timsieved/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/timsieved/Makefile.in
+++ cyrus-imapd-2.3.17/timsieved/Makefile.in
@@ -56,8 +56,8 @@ CYRUS_GROUP=@cyrus_group@
 
 DEFS = @DEFS@ @LOCALDEFS@
 CPPFLAGS = -I.. -I$(srcdir)/../sieve -I$(srcdir)/../imap -I$(srcdir)/../lib @COM_ERR_CPPFLAGS@ @CPPFLAGS@ @SASLFLAGS@
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@ @PIE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @PIE_LDFLAGS@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
Index: cyrus-imapd-2.3.17/com_err/et/Makefile.in
===================================================================
--- cyrus-imapd-2.3.17.orig/com_err/et/Makefile.in
+++ cyrus-imapd-2.3.17/com_err/et/Makefile.in
@@ -58,8 +58,8 @@ DEFS = @DEFS@
 CPPFLAGS = @CPPFLAGS@
 LIBS = @LIBS@
 
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
+CFLAGS = @CFLAGS@ @PIE_CFLAGS@
+LDFLAGS = @LDFLAGS@ @PIE_LDFLAGS@
 
 SHELL = /bin/sh
 
