From 60a2045d616c2e7bcca9658f0d76e7b5b888249c Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Thu, 11 Dec 2003 04:06:55 +0000 Subject: [PATCH] configure.ac: add support for position-independent executables. can be disabled with --disable-pie --- citadel/ChangeLog | 5 +++++ citadel/configure.ac | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index a27f0f57a..c6a6fdda3 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ + Revision 612.12 2003/12/11 04:06:55 nbryant + configure.ac: add support for position-independent executables. can be disabled + with --disable-pie + Revision 612.11 2003/12/11 03:44:18 nbryant domain.c: include if present configure.ac: check for @@ -5146,3 +5150,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/configure.ac b/citadel/configure.ac index c990f4b23..6d56daae9 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -17,6 +17,8 @@ AC_ARG_ENABLE(chkpwd, [ --disable-chkpwd don't build 'chkpwd']) AC_ARG_ENABLE(threaded-client, [ --disable-threaded-client disable multithreaded client]) +AC_ARG_ENABLE(pie, [ --disable-pie don't build position-independent executables]) + AC_ARG_WITH(pam, [ --with-pam use PAM if present (see PAM.txt before you try this)]) AC_ARG_WITH(kthread, [ --with-kthread use kernel threads (on FreeBSD) (not recommended yet)]) AC_ARG_WITH(db, [ --with-db@<:@=DIR@:>@ use Sleepycat DB 3.x @<:@DIR=/usr/local/BerkeleyDB.3.@<:@123@:>@@:>@]) @@ -111,6 +113,21 @@ if test "$GCC" = yes; then ;; esac fi + +if test "x$enable_pie" != xno; then + save_CFLAGS="$CFLAGS" + save_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS -fpie" + LDFLAGS="$LDFLAGS -pie -fpie" + AC_CACHE_CHECK([whether compiler accepts -pie -fpie], ac_cv_pie_fpie, + [AC_TRY_LINK([], [], + ac_cv_pie_fpie=yes, ac_cv_pie_fpie=no)]) + if test $ac_cv_pie_fpie = no; then + CFLAGS="$save_CFLAGS" + LDFLAGS="$save_LDFLAGS" + fi +fi + AC_PROG_INSTALL AC_PROG_YACC missing_dir=`cd $ac_aux_dir && pwd` -- 2.39.2