Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve portability, enable build on Solaris SPARC. #27

Merged
merged 7 commits into from Jan 15, 2020
2 changes: 1 addition & 1 deletion Makefile.in
Expand Up @@ -140,7 +140,7 @@ BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%%
CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED)
CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DVERSION=$(VERSION) %%LONG_BIT_DEFINE%%
CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC)
CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700
CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600
CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN)
gavinhoward marked this conversation as resolved.
Show resolved Hide resolved
CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT)
CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -24,9 +24,9 @@ This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD
## Prerequisites

This `bc` only requires a C99-compatible compiler and a (mostly) POSIX
2008-compatible system with the XSI (X/Open System Interfaces) option group.
2001-compatible system with the XSI (X/Open System Interfaces) option group.

Since POSIX 2008 with XSI requires the existence of a C99 compiler as `c99`, any
Since POSIX 2001 with XSI requires the existence of a C99 compiler as `c99`, any
POSIX and XSI-compatible system will have everything needed.

Systems that are known to work:
Expand Down
20 changes: 10 additions & 10 deletions configure.sh
Expand Up @@ -278,7 +278,7 @@ gen_file_lists() {

if [ "$_gen_file_lists_use" -ne 0 ]; then

_gen_file_lists_replacement=$(ls $_gen_file_lists_filedir/*.c | tr '\n' ' ')
_gen_file_lists_replacement=$(cd "$_gen_file_lists_filedir" && find . ! -name . -prune -name "*.c" | cut -d/ -f2 | sed "s@^@$_gen_file_lists_filedir/@g" | tr '\n' ' ')
_gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_src" "$_gen_file_lists_replacement")
gavinhoward marked this conversation as resolved.
Show resolved Hide resolved

_gen_file_lists_replacement=$(replace_exts "$_gen_file_lists_replacement" "c" "o")
Expand Down Expand Up @@ -441,7 +441,7 @@ while getopts "bBcdDEfgGhHk:MNO:PST-" opt; do

done

if [ "$bc_only" -eq 1 -a "$dc_only" -eq 1 ]; then
if [ "$bc_only" -eq 1 ] && [ "$dc_only" -eq 1 ]; then
usage "Can only specify one of -b(-D) or -d(-B)"
gavinhoward marked this conversation as resolved.
Show resolved Hide resolved
fi

Expand Down Expand Up @@ -550,15 +550,15 @@ else
LONG_BIT_DEFINE="-DBC_LONG_BIT=\$(BC_LONG_BIT)"
fi

if [ -z "${HOSTCFLAGS+set}" -a -z "${HOST_CFLAGS+set}" ]; then
if [ -z "${HOSTCFLAGS+set}" ] && [ -z "${HOST_CFLAGS+set}" ]; then
HOSTCFLAGS="$CFLAGS"
elif [ -z "${HOSTCFLAGS+set}" ]; then
HOSTCFLAGS="$HOST_CFLAGS"
fi

if [ "$debug" -eq 1 ]; then

if [ -z "$CFLAGS" -a -z "$optimization" ]; then
if [ -z "$CFLAGS" ] && [ -z "$optimization" ]; then
CFLAGS="-O0"
fi

Expand All @@ -577,7 +577,7 @@ fi

if [ "$coverage" -eq 1 ]; then

if [ "$bc_only" -eq 1 -o "$dc_only" -eq 1 ]; then
if [ "$bc_only" -eq 1 ] || [ "$dc_only" -eq 1 ]; then
usage "Can only specify -c without -b or -d"
gavinhoward marked this conversation as resolved.
Show resolved Hide resolved
fi

Expand Down Expand Up @@ -608,7 +608,7 @@ if [ -z "${BINDIR+set}" ]; then
BINDIR="$PREFIX/bin"
fi

if [ "$install_manpages" -ne 0 -o "$nls" -ne 0 ]; then
if [ "$install_manpages" -ne 0 ] || [ "$nls" -ne 0 ]; then
if [ -z "${DATAROOTDIR+set}" ]; then
DATAROOTDIR="$PREFIX/share"
fi
Expand Down Expand Up @@ -637,7 +637,7 @@ if [ -z "$CC" ]; then
CC="c99"
fi

if [ -z "$HOSTCC" -a -z "$HOST_CC" ]; then
if [ -z "$HOSTCC" ] && [ -z "$HOST_CC" ]; then
HOSTCC="$CC"
elif [ -z "$HOSTCC" ]; then
HOSTCC="$HOST_CC"
Expand All @@ -652,7 +652,7 @@ if [ "$nls" -ne 0 ]; then
flags="-DBC_ENABLE_NLS=1 -DBC_ENABLED=$bc -DDC_ENABLED=$dc -DBC_ENABLE_SIGNALS=$signals"
flags="$flags -DBC_ENABLE_HISTORY=$hist"
flags="$flags -DBC_ENABLE_EXTRA_MATH=$extra_math -I./include/"
flags="$flags -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
flags="$flags -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600"

gavinhoward marked this conversation as resolved.
Show resolved Hide resolved
"$HOSTCC" $HOSTCFLAGS $flags -c "src/vm.c" -o "$scriptdir/vm.o" > /dev/null 2>&1

Expand Down Expand Up @@ -725,7 +725,7 @@ if [ "$hist" -eq 1 ]; then
flags="-DBC_ENABLE_HISTORY=1 -DBC_ENABLED=$bc -DDC_ENABLED=$dc -DBC_ENABLE_SIGNALS=$signals"
flags="$flags -DBC_ENABLE_NLS=$nls"
flags="$flags -DBC_ENABLE_EXTRA_MATH=$extra_math -I./include/"
flags="$flags -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
flags="$flags -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600"

"$HOSTCC" $HOSTCFLAGS $flags -c "src/history/history.c" -o "$scriptdir/history.o" > /dev/null 2>&1

Expand All @@ -751,7 +751,7 @@ if [ "$hist" -eq 1 ]; then

fi

if [ "$extra_math" -eq 1 -a "$bc" -ne 0 ]; then
if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ]; then
BC_LIB2_O="\$(GEN_DIR)/lib2.o"
else
BC_LIB2_O=""
Expand Down