summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-10-30 10:37:05 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-10-30 10:37:05 +0000
commitf65cd7e93eeb39d7ebb4066793345dd45051abe2 (patch)
tree4993379e0551f92c46252442cb5f705c620fd9b3 /configure
parent88805f471a66064c778ea49ef22287fcd37deb93 (diff)
downloadskalibs-f65cd7e93eeb39d7ebb4066793345dd45051abe2.tar.xz
Make all-pic a user option
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure30
1 files changed, 19 insertions, 11 deletions
diff --git a/configure b/configure
index f149d2a..84bffc4 100755
--- a/configure
+++ b/configure
@@ -34,6 +34,7 @@ Dependencies:
Optional features:
--disable-shared do not build shared libraries [enabled]
--disable-static do not build static libraries [enabled]
+ --enable-all-pic build everything as PIC [enabled iff toolchain builds PIE]
--enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled]
$package options:
@@ -230,6 +231,7 @@ sysdepdir='$prefix/lib/$package/sysdeps'
sysdeps=
shared=true
static=true
+allpic=detect
slashpackage=false
ipv6=true
select=false
@@ -249,7 +251,6 @@ vpaths=''
vpathd=''
build=
-
for arg ; do
case "$arg" in
--help) usage ;;
@@ -267,6 +268,8 @@ for arg ; do
--disable-shared|--enable-shared=no) shared=false ;;
--enable-static|--enable-static=yes) static=true ;;
--disable-static|--enable-static=no) static=false ;;
+ --enable-all-pic|--enable-all-pic=yes) allpic=true ;;
+ --disable-all-pic|--enable-all-pic=no) allpic=false ;;
--enable-slashpackage=*) sproot=${arg#*=} ; slashpackage=true ; ;;
--enable-slashpackage) sproot= ; slashpackage=true ;;
--disable-slashpackage) sproot= ; slashpackage=false ;;
@@ -377,13 +380,18 @@ if test -z "$target" ; then
fi
echo " ... $target"
-defaultpie=false
-echo "Checking whether we're building PIE..."
-if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -dM -E - < /dev/null | grep -qF __PIE__ ; then
- defaultpie=true
- echo " ... yes"
-else
- echo " ... no"
+if test $allpic = detect ; then
+ echo "Checking whether we need to build everything as PIC..."
+ if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -dM -E - < /dev/null | grep -qF __PIE__ ; then
+ allpic=true
+ echo " ... yes"
+ else
+ allpic=false
+ echo " ... no"
+ fi
+fi
+if $allpic ; then
+ tryflag CFLAGS_AUTO -fPIC
fi
tryflag CFLAGS_AUTO -std=c99
@@ -595,10 +603,10 @@ if $shared ; then
else
echo "SHARED_LIBS :="
fi
-if $defaultpie ; then
- echo "DEFAULT_PIE := true"
+if $allpic ; then
+ echo "STATIC_LIBS_ARE_PIC := 1"
else
- echo "DEFAULT_PIE :="
+ echo "STATIC_LIBS_ARE_PIC :="
fi
exec 1>&3 3>&-