Option for Position Independent Code

This commit is contained in:
Carsten Larsen 2017-04-15 22:32:42 +02:00
parent 6cf752a257
commit 78f598d49b
2 changed files with 23 additions and 14 deletions

View File

@ -7,29 +7,29 @@ rm -Rf amath
rm -Rf dist rm -Rf dist
mkdir dist mkdir dist
./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul" ./configure --disable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul"
make clean make clean
make static make static
mv amath dist/amath.000 mv amath dist/amath.000
make clean make clean
./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul" ./configure --disable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul"
make static make static
mv amath dist/amath.020 mv amath dist/amath.020
make clean make clean
./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul" ./configure --disable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul"
make static make static
mv amath dist/amath.030 mv amath dist/amath.030
make clean make clean
./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul" ./configure --enable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul"
make static make static
mv amath dist/amath-test.000 mv amath dist/amath-test.000
make clean make clean
./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul" ./configure --enable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul"
make static make static
mv amath dist/amath-test.020 mv amath dist/amath-test.020
make clean make clean
./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul" ./configure --enable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul"
make static make static
mv amath dist/amath-test.030 mv amath dist/amath-test.030
make clean make clean

25
configure vendored
View File

@ -36,6 +36,7 @@ openlibm=false
stdlibm=false stdlibm=false
stdlibc=false stdlibc=false
useldconfig=false useldconfig=false
fpic=true
prefix="/usr" prefix="/usr"
pkgconfigdir="lib/pkgconfig" pkgconfigdir="lib/pkgconfig"
@ -184,6 +185,8 @@ for arg in "$@"; do
echo ' --disable-clang: do not build with clang compiler' echo ' --disable-clang: do not build with clang compiler'
echo ' --enable-ldconfig: use ldconfig to registre libraries' echo ' --enable-ldconfig: use ldconfig to registre libraries'
echo ' --disable-ldconfig: do not use ldconfig to registre libraries' echo ' --disable-ldconfig: do not use ldconfig to registre libraries'
echo ' --enable-pic: build with Position Independent Code (-fPIC)'
echo ' --disable-pic: do not build static libraries with Position Independent Code'
echo ' --with-libm: link with libm library (-lm)' echo ' --with-libm: link with libm library (-lm)'
echo ' --without-libm: do not link with libm library' echo ' --without-libm: do not link with libm library'
echo ' --with-openlibm: link with openlibm library (-lopenlibm)' echo ' --with-openlibm: link with openlibm library (-lopenlibm)'
@ -257,6 +260,12 @@ if $stdlibc; then
gcclib="${gcclib} -lc" gcclib="${gcclib} -lc"
fi fi
if $fpic; then
fPIC=" -fPIC"
else
fPIC=""
fi
cflags="${cflags}${debugflag}${mflags}" cflags="${cflags}${debugflag}${mflags}"
cxxflags="${cflags} ${cxxflags}" cxxflags="${cflags} ${cxxflags}"
@ -566,7 +575,7 @@ ldlibflags="-l${amathapp} ${libm}-l${amathcplex} ${libm}-l${amath} -l${amathc} $
############################ Main Application ########################### ############################ Main Application ###########################
{ {
echo "CXX = ${crosscompile}${cxxcompiler}" echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-I. -I.. -Wall" echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I.. -Wall"
echo "AR = ${crosscompile}ar" echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib" echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f" echo "DEL = rm -f"
@ -598,7 +607,7 @@ echo
########################### Functions Library ########################### ########################### Functions Library ###########################
{ {
echo "CXX = ${crosscompile}${cxxcompiler}" echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-I. -I../.. -Wall" echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I../.. -Wall"
echo "AR = ${crosscompile}ar" echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib" echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f" echo "DEL = rm -f"
@ -630,7 +639,7 @@ echo
########################### Statement Library ########################### ########################### Statement Library ###########################
{ {
echo "CXX = ${crosscompile}${cxxcompiler}" echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-I. -I../.. -Wall" echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I../.. -Wall"
echo "AR = ${crosscompile}ar" echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib" echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f" echo "DEL = rm -f"
@ -662,7 +671,7 @@ echo
############################ System Library ############################# ############################ System Library #############################
{ {
echo "CXX = ${crosscompile}${cxxcompiler}" echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-I. -I.. -Wall" echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I.. -Wall"
echo "AR = ${crosscompile}ar" echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib" echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f" echo "DEL = rm -f"
@ -724,7 +733,7 @@ for f in ${LIBAPPSRCS}
do do
b=`basename $f .cpp` b=`basename $f .cpp`
echo "static/${b}.o: ${f}" echo "static/${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -c ${f} -o static/${b}.o" echo " \${CXX} \${CXXFLAGS}${fPIC} -c ${f} -o static/${b}.o"
echo echo
echo "shared/${b}.o: ${f}" echo "shared/${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -fPIC -c ${f} -o shared/${b}.o" echo " \${CXX} \${CXXFLAGS} -fPIC -c ${f} -o shared/${b}.o"
@ -835,7 +844,7 @@ for f in ${LIBC1SRCS}
do do
b=`basename $f .c` b=`basename $f .c`
echo "static/${b}.o: ${f}" echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fno-builtin -c ${f} -o static/${b}.o" echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo echo
echo "shared/${b}.o: ${f}" echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o" echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"
@ -934,7 +943,7 @@ for f in ${LIBREALSRCS}
do do
b=`basename $f .c` b=`basename $f .c`
echo "static/${b}.o: ${f}" echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fno-builtin -c ${f} -o static/${b}.o" echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo echo
echo "shared/${b}.o: ${f}" echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o" echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"
@ -1031,7 +1040,7 @@ for f in ${LIBCPLEXSRCS}
do do
b=`basename $f .c` b=`basename $f .c`
echo "static/${b}.o: ${f}" echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fno-builtin -c ${f} -o static/${b}.o" echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo echo
echo "shared/${b}.o: ${f}" echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o" echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"