Allow an --enable-pic option to turn on -fPIC compiler option when building.

The default is disabled until we know this doesn't break anyone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32635 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2006-12-16 22:07:52 +00:00
parent 95ca3a453a
commit 89b0d995d2
4 changed files with 82 additions and 28 deletions

View File

@ -224,6 +224,9 @@ ENABLE_DOXYGEN = @ENABLE_DOXYGEN@
# Do we want to enable threads?
ENABLE_THREADS := @ENABLE_THREADS@
# Do we want to build with position independent code?
ENABLE_PIC := @ENABLE_PIC@
# This option tells the Makefiles to produce verbose output.
# It essentially prints the commands that make is executing
#VERBOSE = 1

View File

@ -255,6 +255,11 @@ else
C.Flags += -D_DEBUG
endif
ifeq ($(ENABLE_PIC),1)
CXX.Flags += -fPIC
C.Flags += -fPIC
endif
CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual
C.Flags += $(CFLAGS)
CPP.BaseFlags += $(CPPFLAGS)
@ -264,8 +269,12 @@ LibTool.Flags := --tag=CXX
# Make Floating point IEEE compliant on Alpha.
ifeq ($(ARCH),Alpha)
CXX.Flags += -mieee -fPIC
CPP.BaseFlags += -mieee -fPIC
CXX.Flags += -mieee
CPP.BaseFlags += -mieee
ifeq ($(ENABLE_PIC),0)
CXX.Flags += -fPIC
CPP.BaseFlags += -fPIC
endif
endif
#--------------------------------------------------------------------

View File

@ -322,6 +322,20 @@ case "$enableval" in
esac
AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
dnl Allow building with position independent code
AC_ARG_ENABLE(pic,
AS_HELP_STRING([--enable-pic],
[Build LLVM with Position Independent Code (default is NO)]),,
enableval=default)
case "$enableval" in
yes) AC_SUBST(ENABLE_PIC,[1]) ;;
no) AC_SUBST(ENABLE_PIC,[0]) ;;
default) AC_SUBST(ENABLE_PIC,[0]) ;;
*) AC_MSG_ERROR([Invalid setting for --enable-pic. Use "yes" or "no"]) ;;
esac
AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC,
[Define if position independent code is enabled])
dnl Allow specific targets to be specified for building (or not)
TARGETS_TO_BUILD=""
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],

80
configure vendored
View File

@ -835,6 +835,7 @@ JIT
TARGET_HAS_JIT
ENABLE_DOXYGEN
ENABLE_THREADS
ENABLE_PIC
TARGETS_TO_BUILD
ENABLE_CBE_PRINTF_A
EXTRA_OPTIONS
@ -1525,6 +1526,8 @@ Optional Features:
--enable-jit Enable Just In Time Compiling (default is YES)
--enable-doxygen Build doxygen documentation (default is NO)
--enable-threads Use threads if available (default is YES)
--enable-pic Build LLVM with Position Independent Code (default
is NO)
--enable-targets Build specific host targets:
all,host-only,{target-name} (default=all)
--enable-cbe-printf-a Enable C Backend output with hex floating point via
@ -4652,6 +4655,30 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# Check whether --enable-pic was given.
if test "${enable_pic+set}" = set; then
enableval=$enable_pic;
else
enableval=default
fi
case "$enableval" in
yes) ENABLE_PIC=1
;;
no) ENABLE_PIC=0
;;
default) ENABLE_PIC=0
;;
*) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-pic. Use \"yes\" or \"no\"" >&5
echo "$as_me: error: Invalid setting for --enable-pic. Use \"yes\" or \"no\"" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
cat >>confdefs.h <<_ACEOF
#define ENABLE_PIC $ENABLE_PIC
_ACEOF
TARGETS_TO_BUILD=""
# Check whether --enable-targets was given.
if test "${enable_targets+set}" = set; then
@ -10299,7 +10326,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 10302 "configure"
#line 10329 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12443,7 +12470,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 12446 "configure"' > conftest.$ac_ext
echo '#line 12473 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -14161,11 +14188,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14164: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14191: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:14168: \$? = $ac_status" >&5
echo "$as_me:14195: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -14429,11 +14456,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14432: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14459: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:14436: \$? = $ac_status" >&5
echo "$as_me:14463: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -14533,11 +14560,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14536: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14563: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:14540: \$? = $ac_status" >&5
echo "$as_me:14567: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -16985,7 +17012,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 16988 "configure"
#line 17015 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17085,7 +17112,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17088 "configure"
#line 17115 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -19453,11 +19480,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19456: $lt_compile\"" >&5)
(eval echo "\"\$as_me:19483: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:19460: \$? = $ac_status" >&5
echo "$as_me:19487: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -19557,11 +19584,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19560: $lt_compile\"" >&5)
(eval echo "\"\$as_me:19587: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:19564: \$? = $ac_status" >&5
echo "$as_me:19591: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -21127,11 +21154,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:21130: $lt_compile\"" >&5)
(eval echo "\"\$as_me:21157: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:21134: \$? = $ac_status" >&5
echo "$as_me:21161: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -21231,11 +21258,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:21234: $lt_compile\"" >&5)
(eval echo "\"\$as_me:21261: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:21238: \$? = $ac_status" >&5
echo "$as_me:21265: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -23466,11 +23493,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:23469: $lt_compile\"" >&5)
(eval echo "\"\$as_me:23496: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:23473: \$? = $ac_status" >&5
echo "$as_me:23500: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -23734,11 +23761,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:23737: $lt_compile\"" >&5)
(eval echo "\"\$as_me:23764: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:23741: \$? = $ac_status" >&5
echo "$as_me:23768: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -23838,11 +23865,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:23841: $lt_compile\"" >&5)
(eval echo "\"\$as_me:23868: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:23845: \$? = $ac_status" >&5
echo "$as_me:23872: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -34170,6 +34197,7 @@ JIT!$JIT$ac_delim
TARGET_HAS_JIT!$TARGET_HAS_JIT$ac_delim
ENABLE_DOXYGEN!$ENABLE_DOXYGEN$ac_delim
ENABLE_THREADS!$ENABLE_THREADS$ac_delim
ENABLE_PIC!$ENABLE_PIC$ac_delim
TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim
ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim
EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
@ -34187,7 +34215,6 @@ NM!$NM$ac_delim
ifGNUmake!$ifGNUmake$ac_delim
LN_S!$LN_S$ac_delim
CMP!$CMP$ac_delim
CP!$CP$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@ -34229,6 +34256,7 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
CP!$CP$ac_delim
DATE!$DATE$ac_delim
FIND!$FIND$ac_delim
MKDIR!$MKDIR$ac_delim
@ -34296,7 +34324,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 65; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5