#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
unset MAKEFLAGS
unset MAKELEVEL
export BUILDTYPE=""
export BUILDMODE=""
export CONFIG="sunpro.config"
export TOPLEVELDIR=""
export BUILDDIR=""
export LDSOFLAGS="${LDFLAGS}"
export CXXOPTS="${CXXFLAGS}"
export LDOPTS="${LDFLAGS}"
export LD="${CXX} ${CXXFLAGS} ${LDFLAGS}"
-m32)
BUILDTYPE="8d"
BUILDMODE="shared,pthreads"
;;
-m64)
BUILDTYPE="8D"
BUILDMODE="shared,pthreads"
;;
-topdir=*)
;;
-builddir=*)
;;
*)
;;
esac
echo "$1: Invalid argument"
shift
continue
fi
shift
done
export BUILDTYPE BUILDMODE TOPLEVELDIR
export BUILDDIR="${TOPLEVELDIR}/build"
export LD_LIBRARY_PATH="${BUILDDIR}/lib:${LD_LIBRARY_PATH}"
echo "BUILDTYPE: ${BUILDTYPE}"
echo "TOPLEVELDIR: ${TOPLEVELDIR}"
echo "BUILDDIR: ${BUILDDIR}"
cd ${TOPLEVELDIR}
if [ -f config.done ] ; then
rm -f config.done
fi
if [ "x${BUILDTYPE}" = "x" ] || [ "x${TOPLEVELDIR}" = "x" ] ; then
fi
exit 1
fi
}
if [ ! -d Solaris ] ; then
echo "Expected directory Solaris not found."
echo "Make sure this directory exists in the stdcxx toplevel."
echo ""
exit 1
fi
}
if [ "x${BUILDTYPE}" = "x" ] ; then
echo "\$BUILDTYPE [ 8d | 8D ] is not set."
echo ""
exit 1
fi
echo "BUILDTYPE: ${BUILDTYPE}."
echo "BUILDMODE: ${BUILDMODE}."
}
if [ "x${CC}" = "x" ] ; then
echo "\$CC is not set."
echo ""
exit 1
fi
echo "CC: ${CC}."
if [ "x${CXX}" = "x" ] ; then
echo "\$CXX is not set."
echo ""
exit 1
fi
echo "CXX: ${CXX}."
if [ "x${CFLAGS}" = "x" ] ; then
echo "\$CFLAGS is not set."
echo ""
exit 1
fi
echo "CFLAGS: ${CFLAGS}."
if [ "x${CPPFLAGS}" = "x" ] ; then
echo "\$CPPFLAGS is not set."
echo ""
exit 1
fi
echo "CPPFLAGS: ${CPPFLAGS}."
if [ "x${CXXFLAGS}" = "x" ] ; then
echo "\$CXXFLAGS is not set. Make sure you have set -library=no%Cstd."
echo ""
exit 1
fi
echo "CXXFLAGS: ${CXXFLAGS}."
if [ "x${LDFLAGS}" = "x" ] ; then
echo "\$LDFLAGS is not set."
echo ""
exit 1
fi
echo "LDFLAGS: ${LDFLAGS}."
}
if [ "x${MAKE}" = "x" ] ; then
echo "\$MAKE is not set. Please use GNU make to build stdcxx."
echo ""
exit 1
fi
if [ "x${gnumake}" = "x" ] ; then
echo "\$MAKE is not GNU make. stdcxx requires GNU make."
exit 1
fi
echo "MAKE: ${MAKE}."
}
cd ${TOPLEVELDIR}
wctype.h \
wchar.h \
time.h \
string.h \
stdlib.h \
stdio.h \
stddef.h \
stdarg.h \
signal.h \
setjmp.h \
math.h \
locale.h \
limits.h \
float.h \
errno.h \
ctype.h \
assert.h \
_ctime.h \
_cmath.h \
do
fi
done
do
fi
done
do
fi
done
}
echo "Configuring ..." `pwd`
echo
echo "MAKEFLAGS: ${MAKEFLAGS}"
echo "MAKELEVEL: ${MAKELEVEL}"
unset MAKEFLAGS
unset MAKELEVEL
export LIBDIR="${TOPLEVELDIR}/lib"
do
echo "${CXX} ${CPPFLAGS} ${CXXFLAGS} -c ${TOPLEVELDIR}/etc/config/src/${file}.cpp -o ${LIBDIR}/${file}.o"
echo "${CXX} ${CXXFLAGS} ${LDFLAGS} -G -hlib${file}.so ${LIBDIR}/${file}.o -o ${LIBDIR}/lib${file}.so"
done
unset LIBDIR
export LD_OPTIONS="-L${TOPLEVELDIR}/lib -R${TOPLEVELDIR}/lib"
export LD_OPTIONS="${LD_OPTIONS} -L${BUILDDIR}/include -R${BUILDDIR}/include"
echo $MAKE SHELL=/bin/bash CC=${CC} CXX=${CXX} LD_OPTIONS="${LD_OPTIONS}" LDFLAGS="${LDFLAGS} ${LD_OPTIONS}" TOPDIR=${TOPLEVELDIR} BUILDTYPE=${BUILDTYPE} BUILDMODE=${BUILDMODE} CONFIG=${CONFIG} config
${MAKE} SHELL=/bin/bash CC="${CC}" CXX="${CXX}" LD_OPTIONS="${LD_OPTIONS}" LDFLAGS="${LDFLAGS} ${LD_OPTIONS}" TOPDIR="${TOPLEVELDIR}" BUILDTYPE="${BUILDTYPE}" BUILDMODE="${BUILDMODE}" CONFIG="${CONFIG}" config
unset LD_OPTIONS
echo "Configuration finished."
}
echo "Performing post-configuration updates ... "
if [ ! -f ../Solaris/atomic-cxx.d ] ; then
echo "atomic-cxx.d not found!"
echo "Post-configuration FAILED!!!"
exit 1
fi
if [ -f config.h ] ; then
export HEADER_FILE="stdcxx"
if [ "x${unamep}" = "xsparc" ] ; then
if [ "x${is64bit}" = "x" ] ; then
export HEADER_FILE="${HEADER_FILE}_sparc.h"
else
export HEADER_FILE="${HEADER_FILE}_sparcv9.h"
fi
else
if [ "x${is64bit}" = "x" ] ; then
export HEADER_FILE="${HEADER_FILE}_i386.h"
else
export HEADER_FILE="${HEADER_FILE}_amd64.h"
fi
fi
if [ ! -f ../../Solaris/${HEADER_FILE} ] ; then
echo "Required configuration header file ${HEADER_FILE} not found!"
exit 1
fi
echo "Using configuration header file ${HEADER_FILE}"
cp -fp ../../Solaris/${HEADER_FILE} .
chmod 0644 ${HEADER_FILE}
touch -r config.h.orig -acm ${HEADER_FILE}
chmod 0644 rwconfig_std.h
cd ${TOPLEVELDIR}
echo "Removing configuration phase core files [expected]."
echo "Post-configuration succeeded."
else
echo "Standard configuration file ${TOPLEVELDIR}/../Solaris/rwconfig_std.h not found!"
echo "Post-configuration FAILED!!!"
exit 1
fi
else
echo "Initial configuration file 'config.h' has not been created."
echo "Post-configuration FAILED!!!"
exit 1
fi
}
echo "stdcxx has been configured. You can now type '$MAKE' to build."
echo ""
cd ${TOPLEVELDIR}
exit 0
}
check_args $@