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

Support configure for illumos or solaris (including SmartOS) #28589

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 41 additions & 28 deletions configure
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/sh

# /bin/sh on Solaris is not a POSIX compatible shell, but /usr/bin/ksh is.
if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
POSIX_SHELL="true"
export POSIX_SHELL
exec /usr/bin/ksh $0 "$@"
fi
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as well
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ksh available by default? IOW, will this branch always catch SunOS and switch to ksh?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining the function of POSIX_SHELL here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when it re-executes this script under ksh, having POSIX_SHELL already set prevents it from entering an infinite loop of executing ksh. Instead, it continues with the rest of the script.


msg() {
echo "configure: $*"
}
Expand Down Expand Up @@ -66,7 +74,7 @@ move_if_changed() {
}

putvar() {
local T
T=
eval T=\$$1
eval TLEN=\${#$1}
if [ $TLEN -gt 35 ]
Expand All @@ -79,7 +87,7 @@ putvar() {
}

putpathvar() {
local T
T=
eval T=\$$1
eval TLEN=\${#$1}
if [ $TLEN -gt 35 ]
Expand All @@ -97,10 +105,10 @@ putpathvar() {
}

probe() {
local V=$1
V=$1
shift
local P
local T
P=
T=
for P
do
T=$(command -v $P 2>&1)
Expand All @@ -125,7 +133,7 @@ probe() {
}

probe_need() {
local V=$1
V=$1
probe $*
eval VV=\$$V
if [ -z "$VV" ]
Expand Down Expand Up @@ -183,18 +191,18 @@ validate_opt () {
valopt_core() {
VAL_OPTIONS="$VAL_OPTIONS $2"

local SAVE=$1
local OP=$2
local DEFAULT=$3
SAVE=$1
OP=$2
DEFAULT=$3
shift
shift
shift
local DOC="$*"
DOC="$*"
if [ $HELP -eq 0 ]
then
local UOP=$(echo $OP | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
local V="CFG_${UOP}"
local V_PROVIDED="${V}_PROVIDED"
UOP=$(echo $OP | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
V="CFG_${UOP}"
V_PROVIDED="${V}_PROVIDED"
eval $V="$DEFAULT"
for arg in $CFG_CONFIGURE_ARGS
do
Expand Down Expand Up @@ -239,14 +247,14 @@ valopt() {
opt_core() {
BOOL_OPTIONS="$BOOL_OPTIONS $2"

local SAVE=$1
local OP=$2
local DEFAULT=$3
SAVE=$1
OP=$2
DEFAULT=$3
shift
shift
shift
local DOC="$*"
local FLAG=""
DOC="$*"
FLAG=""

if [ $DEFAULT -eq 0 ]
then
Expand All @@ -266,8 +274,8 @@ opt_core() {
then
OP=$(echo $OP | tr 'a-z-' 'A-Z_')
FLAG=$(echo $FLAG | tr 'a-z' 'A-Z')
local V="CFG_${FLAG}_${OP}"
local V_PROVIDED="CFG_${FLAG}_${OP}_PROVIDED"
V="CFG_${FLAG}_${OP}"
V_PROVIDED="CFG_${FLAG}_${OP}_PROVIDED"
eval $V=1
eval $V_PROVIDED=1
if [ "$SAVE" = "save" ]
Expand All @@ -278,7 +286,7 @@ opt_core() {
then
OP=$(echo $OP | tr 'a-z-' 'A-Z_')
DEFAULT_FLAG=$(echo $DEFAULT_FLAG | tr 'a-z' 'A-Z')
local V_PROVIDED="CFG_${DEFAULT_FLAG}_${OP}_PROVIDED"
V_PROVIDED="CFG_${DEFAULT_FLAG}_${OP}_PROVIDED"
eval $V_PROVIDED=1
fi
done
Expand All @@ -300,8 +308,8 @@ opt() {
}

envopt() {
local NAME=$1
local V="CFG_${NAME}"
NAME=$1
V="CFG_${NAME}"
eval VV=\$$V

# If configure didn't set a value already, then check environment.
Expand All @@ -324,10 +332,10 @@ envopt() {
}

enable_if_not_disabled() {
local OP=$1
local UOP=$(echo $OP | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
local ENAB_V="CFG_ENABLE_$UOP"
local EXPLICITLY_DISABLED="CFG_DISABLE_${UOP}_PROVIDED"
OP=$1
UOP=$(echo $OP | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
ENAB_V="CFG_ENABLE_$UOP"
EXPLICITLY_DISABLED="CFG_DISABLE_${UOP}_PROVIDED"
eval VV=\$$EXPLICITLY_DISABLED
if [ -z "$VV" ]; then
eval $ENAB_V=1
Expand All @@ -352,7 +360,7 @@ to_gnu_triple() {

# Prints the absolute path of a directory to stdout
abs_path() {
local _path="$1"
_path="$1"
# Unset CDPATH because it causes havok: it makes the destination unpredictable
# and triggers 'cd' to print the path to stdout. Route `cd`'s output to /dev/null
# for good measure.
Expand Down Expand Up @@ -424,6 +432,11 @@ case $CFG_OSTYPE in
CFG_OSTYPE=apple-darwin
;;

SunOS)
CFG_OSTYPE=sun-solaris
CFG_CPUTYPE=$(isainfo -n)
;;

MINGW*)
# msys' `uname` does not print gcc configuration, but prints msys
# configuration. so we cannot believe `uname -m`:
Expand Down
22 changes: 22 additions & 0 deletions mk/cfg/x86_64-sun-solaris.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# x86_64-sun-solaris configuration
CC_x86_64-sun-solaris=$(CC)
CXX_x86_64-sun-solaris=$(CXX)
CPP_x86_64-sun-solaris=$(CPP)
AR_x86_64-sun-solaris=$(AR)
CFG_LIB_NAME_x86_64-sun-solaris=lib$(1).so
CFG_STATIC_LIB_NAME_x86_64-sun-solaris=lib$(1).a
CFG_LIB_GLOB_x86_64-sun-solaris=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_x86_64-sun-solaris=$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_x86_64-sun-solaris := -I/usr/local/include $(CFLAGS)
CFG_GCCISH_CFLAGS_x86_64-sun-solaris := -Wall -Werror -g -fPIC -I/usr/local/include $(CFLAGS)
CFG_GCCISH_LINK_FLAGS_x86_64-sun-solaris := -shared -fPIC -g -pthread -lrt
CFG_GCCISH_DEF_FLAG_x86_64-sun-solaris := -Wl,--export-dynamic,--dynamic-list=
CFG_LLC_FLAGS_x86_64-sun-solaris :=
CFG_INSTALL_NAME_x86_64-sun-solaris =
CFG_EXE_SUFFIX_x86_64-sun-solaris :=
CFG_WINDOWSY_x86_64-sun-solaris :=
CFG_UNIXY_x86_64-sun-solaris := 1
CFG_LDPATH_x86_64-sun-solaris :=
CFG_RUN_x86_64-sun-solaris=$(2)
CFG_RUN_TARG_x86_64-sun-solaris=$(call CFG_RUN_x86_64-sun-solaris,,$(2))
CFG_GNU_TRIPLE_x86_64-sun-solaris := x86_64-sun-solaris