cgal/Packages/Installation/install_cgal

2459 lines
60 KiB
Bash
Executable File

#!/bin/sh
# ------------------------------------------------------------
# a CGAL installation script prototype
# $Id$
# ------------------------------------------------------------
# ------------------------------------------------------------
# some important global variables
# ------------------------------------------------------------
CGAL_VERSION=0.9
CGAL_INSTALL_VERSION='$Revision$'
CGAL_DIR=`pwd`
CGAL_EXAMPLE_DIR=${CGAL_DIR}/examples
CGAL_INCL_DIR=${CGAL_DIR}/include
CGAL_LIB_DIR=${CGAL_DIR}/lib
CGAL_MAKE_DIR=${CGAL_DIR}/make
CGAL_SRC_DIR=${CGAL_DIR}/src
CGAL_TEST_DIR=${CGAL_DIR}/test
CGAL_CONF_DIR=${CGAL_DIR}/config
CGAL_LIB_NAME='libCGAL'
CGAL_DIRFILE=${CGAL_DIR}/make/CGAL_directories
CGAL_TESTFILE=${CGAL_TEST_DIR}/cgal_test
# toggles the use of LEDA: ('' - no LEDA, '_LEDA' - LEDA)
LEDA_EXT=''
LEDA_INCL_DIR=''
LEDA_LIB_DIR=''
# specifies STL setting (since this is compiler specific,
# it will be updated each time a compiler is chosen)
# 'e' means an extra STL is needed and
# 'b' means compiler is shipped with an STL (and it should be used)
# while 'x' means to use an extra STL anyway
STL_STATUS='e'
STL_DIR=''
# type of STL: (see test_stl_version below)
CGAL_STL_VERSION='CGAL_STL_UNKNOWN'
# toggles use of gcc rtti patch ('' - no, '_rtti' - use it)
GCC_RTTI_PATCH_EXT=''
# logfile for testsuite:
TEST_LOGFILE=${CGAL_TEST_DIR}/error.txt
# ------------------------------------------------------------
# internal variables
# ------------------------------------------------------------
# width of menu screen / 10 (in characters)
_MENU_WIDTH=6
# left indentation of menu
_LEFTSPACE=' '
# installation logfile (verbose)
INSTALL_LOGFILE="${CGAL_DIR}/install.log"
INSTALL_LOGFILE_REDIRECTION=">>${INSTALL_LOGFILE}"
# installation logfile (only completed compile/test runs)
# (Really Important Stuff)
INSTALL_RIS_LOGFILE=${CGAL_DIR}/install_ris.log
# compilation logfile
COMPILE_LOGFILE=${CGAL_DIR}/compile.log
# logfile for temporary use (e.g. compiler tests)
TMP_LOGFILE=${CGAL_DIR}/tmptmp.log
# temporary C++ file for confidence tests
TMP_CXX_FILE=${CGAL_DIR}/tmp_test.C
# compiler to be used
COMPILER=''
# string defining OS and compiler
# (used for naming makefiles and lib directories)
CGAL_OS_COMPILER=''
# can we start building the libs?
SETUP_COMPLETE=''
# does there exist a CGALlib for this compiler?
LIB_COMPILED=''
# Was there any successfull compile run during this session?
ANY_LIB_COMPILED=''
# ------------------------------------------------------------
# system related functions:
# ------------------------------------------------------------
# (/usr)/bin/which is completely STUPID
# it looks at ~/.cshrc and reports aliases
# that do not exist, if you run a shell other than csh
# so it's us who have to do the work again :)
# needs awk!
real_which()
{
_t=0
for i in `echo ${PATH} | ${_awk} 'BEGIN {RS=":"}{print $0}'`; do
if [ ${_t} = 0 -a -x ${i}/$1 ]; then
echo ${i}/$1
_t=1
fi
done
}
# print to logfile
log_print()
{
eval "$_printf \"$*\n\" ${INSTALL_LOGFILE_REDIRECTION}"
}
# checks for existency of program $1
# and set variable _$3 to its full path
# ($3 defaults to $1 if not specified)
# (if $2 is 'y', exit if it is not existent,
# otherwise return 0, iff it exists)
_check_for_util()
{
_tmp=`$_which $1`
if [ -x "$_tmp" ]; then
eval "_${3:-$1}=$_tmp"
elif [ "$2" = "y" ]; then
echo
echo "ERROR: Couldn't find $1, exiting."
exit 1
else
log_print "WARNING: Couldn't find $1."
return 1
fi
_tmp="echo $\_`echo ${3:-$1}`"
_tmp=`eval "$_tmp"`
_tmp=`eval "echo $_tmp"`
log_print "$1 is $_tmp."
return 0
}
# same as _check_for_util above except that it searches
# in /bin and /usr/bin first
_check_for_sysutil()
{
if [ -x /bin/$1 ]; then
eval "_$1=/bin/$1"
elif [ -x /usr/bin/$1 ]; then
eval "_$1=/usr/bin/$1"
else
_check_for_util $*
return $?
fi
_tmp="echo $\_`echo ${3:-$1}`"
_tmp=`eval "$_tmp"`
_tmp=`eval "echo $_tmp"`
log_print "$1 is $_tmp."
return 0
}
# exit, if there is no directory $1 or it is not readable and executable
_check_dir_exists()
{
if [ ! -d $1 ]; then
echo
echo "ERROR: Directory $1 does not exist, exiting."
exit 1
fi
if [ ! -r $1 ]; then
echo
echo "ERROR: Cannot read from directory $1, exiting."
exit 1
fi
if [ ! -x $1 ]; then
echo
echo "ERROR: No execute permission for directory $1, exiting."
exit 1
fi
}
# exit, if you can't write to directory/file $1
_check_write()
{
if [ ! -w $1 ]; then
echo
echo "ERROR: Cannot write to $1, exiting."
exit 1
fi
}
# initialize the logfiles
init_logfiles()
{
_check_dir_exists ${CGAL_DIR}
_check_write ${CGAL_DIR}
if [ -f ${INSTALL_RIS_LOGFILE} -a ! -w ${INSTALL_RIS_LOGFILE} ]; then
/bin/rm -f ${INSTALL_RIS_LOGFILE}
fi
if [ -f ${INSTALL_LOGFILE} -a ! -w ${INSTALL_LOGFILE} ]; then
/bin/rm -f ${INSTALL_LOGFILE}
fi
_check_for_sysutil printf y
$_printf "----------------------------------------------------------\n" \
>${INSTALL_LOGFILE}
log_print "log of $0 $*"
log_print "called by $LOGNAME on `date`"
log_print "CGAL_DIR is $CGAL_DIR"
log_print "----------------------------------------------------------"
$_printf "${_LEFTSPACE}----------------------------------------------------------\n" \
>${INSTALL_RIS_LOGFILE}
$_printf "${_LEFTSPACE}You built CGAL ${CGAL_VERSION} on:\n" \
>>${INSTALL_RIS_LOGFILE}
$_printf "${_LEFTSPACE}----------------------------------------------------------\n" \
>>${INSTALL_RIS_LOGFILE}
}
# first do a confidence test, if ${CGAL_DIR} is really
# the CGAL directory
# check ${CGAL_CONF_DIR}: create it, if not existent
check_conf_dir()
{
# confidence tests
case `$_basename ${CGAL_DIR}` in
CGAL*)
log_print "Confidence test passed.";;
*)
$_printf "\nERROR: The name of this directory\n"
$_printf " does not start with \"CGAL\", exiting.\n"
exit 1;;
esac
_check_dir_exists ${CGAL_MAKE_DIR}
_check_dir_exists ${CGAL_SRC_DIR}
_check_dir_exists ${CGAL_INCL_DIR}
_check_dir_exists ${CGAL_LIB_DIR}
# test for ${CGAL_CONF_DIR}
if [ ! -d ${CGAL_CONF_DIR} ]; then
log_print \
"WARNING: ${CGAL_CONF_DIR} does not exist, it will be created."
mkdir ${CGAL_CONF_DIR}
fi
if [ ! -w ${CGAL_CONF_DIR} ]; then
$_printf "\nERROR: cannot write to ${CGAL_CONF_DIR}, exiting.\n"
exit 1
fi
}
# print the version number of this file
# (in an RCS Revision string this is field nr two)
_install_version_number()
{
$_printf "${CGAL_INSTALL_VERSION}" | $_awk '{print $2}'
}
# check, if all needed utility programs are available
# (they should be on a unix system, but ...)
check_for_utils()
{
_which='which'
_check_for_sysutil awk y
_check_for_sysutil basename y
_which=real_which
_check_for_sysutil uname y
_check_for_sysutil cat y
_check_for_sysutil rm y
_check_for_sysutil chmod y
_check_for_sysutil mkdir y
_check_for_sysutil tput y
_check_for_sysutil fgrep y
_check_for_sysutil sed y
if [ -n "${PAGER}" ]; then
_check_for_sysutil ${PAGER} y
PAGER=`eval "echo \$\_$PAGER"`
PAGER=`eval "echo ${PAGER}"`
fi
CGAL_INSTALL_VERSION=`_install_version_number`
log_print "This is `basename $0` version ${CGAL_INSTALL_VERSION}."
}
# guess operating system, write logs via $1
# set SYST to [architecture]_[os][os-version]
# try to get architecture from uname -p,
# if this fails (e.g. on some linux systems), try uname -m
# if this also fails, leave architecture blank
guess_os()
{
_tmp=`${_uname} -p 2>/dev/null`
if [ -z "${_tmp}" ]; then
_tmp=`${_uname} -m 2>/dev/null`
fi
if [ -n "${_tmp}" ]; then
_tmp=${_tmp}"_"
else
$1 "WARNING: Could not determine architecture."
fi
SYST="${_tmp}`${_uname} -s`-`${_uname} -r`"
$1 "OS is \"${SYST}\"."
}
# give version numbers for GNU GCC
# NB: truncated to *.*.* (three numbers)
# since we don't want to make a difference between 2.7.2.*
_gpp_version()
{
_tmp="`$1 --version 2>&1 | $_awk '{print $1}' | $_awk 'BEGIN {FS="."}
{print $1"."$2"."$3}'`"
$_printf "$_tmp"
}
# give version numbers for SUNPRO CC
_sunpro_version()
{
_tmp="`$1 -V 2>&1 | $_fgrep "C++" | $_awk '{print $NF}'`"
$_printf "$_tmp"
}
# give version numbers for IRIX MIPSPRO CC
_sgi_version()
{
_tmp=`$_showprods -nM | $_fgrep "C++," | $_fgrep c++_dev | $_awk '{print $5}'`
$_printf "$_tmp"
}
# map description to executable with full path
# (e.g. "GNU g++ 2.7.2.1" to "/usr/local/bin/g++")
compiler_bin()
{
case ${COMPILER} in
GNU*)
$_printf "${_gpp}";;
SUN*|IRIX*)
$_printf "${_CC}";;
*)
$_printf "undefined";;
esac
}
# return the cmdline-switch to set the runtime linker path
# for ${COMPILER}
rpath_directive()
{
case ${COMPILER} in
IRIX*) $_printf "-rpath ";;
GNU*) $_printf "-Xlinker -R";;
*) $_printf "-R";;
esac
}
# return currently needed compiler flags for gcc rtti patch
rtti_patch_cxxflags()
{
if [ -n "${GCC_RTTI_PATCH_EXT}" ]; then
$_printf "-frtti -L${GCC_RTTI_PATCH_DIR} `rpath_directive`${GCC_RTTI_PATCH_DIR}"
fi
}
# return currently needed linker flags for gcc rtti patch
rtti_patch_ldflags()
{
if [ -n "${GCC_RTTI_PATCH_EXT}" ]; then
$_printf "-nodefaultlibs -lstdc++ -lg++ -lgcc -lc"
fi
}
# give basename of ${COMPILER}s executable
# (assumed to be the second record of ${COMPILER})
compiler_basename()
{
$_printf "${COMPILER}" | $_awk '{print $2}'
}
# append a version number to ${COMPILER}, if possible
# $1 must be the compiler executable(full path)
compute_compiler_version()
{
case `compiler_basename` in
*CC*)
case ${SYST} in
*IRIX*) _check_for_sysutil showprods y
COMPILER="${COMPILER} `_sgi_version $1`"
log_print "SGI CC version is `_sgi_version $1`.";;
*SunOS*) COMPILER="${COMPILER} `_sunpro_version $1`"
log_print "SUNPRO CC version is `_sunpro_version $1`.";;
*) COMPILER="${COMPILER}";;
esac;;
*g++*)
COMPILER="${COMPILER} `_gpp_version $1`"
log_print "GNU g++ version is `_gpp_version $1`.";;
*)
COMPILER="${COMPILER}";;
esac
}
# give version of ${COMPILER}
# assumes this is the third component of ${COMPILER}
compiler_version()
{
$_printf "${COMPILER}" | $_awk '{print $3}'
}
# give a literal description for compiler $1
# (e.g. $1 = CC, g++, ...)
compiler_description()
{
case $1 in
*CC*)
case ${SYST} in
*IRIX*) $_printf "IRIX CC";;
*SunOS*) $_printf "SUNPRO CC";;
*) $_printf "unknown CC";;
esac;;
*g++*)
$_printf "GNU g++";;
*)
$_printf "unknown $1";;
esac
}
# return 0, iff current compiler needs rtti patch
# (gcc2.7.2.*)
show_rtti_options()
{
if [ "`compiler_basename`" = "g++" -a \
"`compiler_version`" = "2.7.2" ]; then
return 0
fi
return 1
}
# search for compiler
# $1 is the basename of the executable (e.g. CC)
# $2 is a description of it (e.g. SunPro C++ 4.1)
# $3 is the variable to store the path to the executable
# (this is needed for g++, since there can't be a '+' in a variable name;
# defaults to $1, if not specified)
_search_compiler()
{
if _check_for_util "$1" n "${3:-$1}"; then
COMPILER="$2"
compute_compiler_version `compiler_bin ${COMPILER}`
eval "_COMPILER_$_COMPILER_NUMBER=\"${COMPILER}\""
eval "$_EXPR $_COMPILER_NUMBER + 1"
_COMPILER_NUMBER=$_result
fi
}
# search for compilers
# NB: The declarativ strings must have the version number as
# their third component, since this is used later to extract it)
search_for_compilers()
{
guess_os log_print
_COMPILER_NUMBER=1
case ${SYST} in
*IRIX*|*SunOS*)
_search_compiler CC "`compiler_description CC`"
_search_compiler g++ "`compiler_description g++`" gpp;;
*)
_search_compiler g++ "`compiler_description CC`" gpp;;
esac
if [ ${_COMPILER_NUMBER} = 1 ]; then
$_printf "\nERROR: Couldn't find any compiler, exiting.\n"
exit 1
fi
}
# ------------------------------------------------------------
# arithmetic functions
# ------------------------------------------------------------
# since this great shell does not generally support
# arithmetics, we have to use a supplement in some cases.
# this may be expr or bc.
# evaluate expression $1 $2 $3 using shell let
# and store result in _result
_let_expr()
{
if ! eval "let _result=$1$2$3"; then
$_printf "\nERROR: cannot evaluate $1$2$3 in _let_expr()\n"
exit 1
fi
}
# evaluate expression $1 $2 $3 using expr
# and store result in _result
_expr_expr()
{
# we have to do the indirection in three steps
# (since there can be only one `...` expression level)
eval "_result=`/bin/expr $1 \"$2\" $3`"
if [ $? != 0 ]; then
$_printf "\nERROR: cannot evaluate $1 in _expr_expr()\n"
exit 1
fi
}
# evaluate expression $1 $2 $3 using bc
# and store result in _result
_bc_expr()
{
# we have to do the indirection in three steps
# (since there can be only one `...` expression level)
eval "_result=`echo $1 \"$2\" $3 | /bin/bc`"
if [ $? != 0 ]; then
$_printf "\nERROR: cannot evaluate $1 in _bc_expr()\n"
exit 1
fi
}
# set _EXPR such that eval "$_EXPR op1 op op2" evaluates
# the expression and stores the result in _result
set_expr()
{
# first try shell let, then expr, bc, dc and csh
if /bin/sh -tc 'e=0; let e+=1' 2>/dev/null; then
_EXPR=_let_expr
elif [ -x /bin/expr ]; then
_EXPR=_expr_expr
elif [ -x /bin/bc ]; then
_EXPR=_bc_expr
else
$_printf "\nERROR: cannot find either of bc, dc and csh\n"
$_printf " nor does /bin/sh support let.\n"
exit 1
fi
log_print "use $_EXPR() for evaluating arithmetic expressions."
}
# ------------------------------------------------------------
# terminal related functions
# ------------------------------------------------------------
# ------------------------------------------------------------
# BUFFERED OUTPUT:
# for the sake of efficiency we buffer all output
clear_buffer()
{
_BUF=''
}
# print buffer
flush_buffer()
{
$_printf "$_BUF"
clear_buffer
}
# write to to buffer
write_buffer()
{
_BUF=$_BUF$1
}
# ------------------------------------------------------------
# STRING FUNCTIONS:
# print $2 times string $1
# (for $2 in 1 .. 32) - if $2 > 32, just loop
# NB: this is really brute force, but I don't know how to do it
# more elegant, since this great shell can't even increment
# natural numbers by 1 and syscalls are prohibitively slow
# in this context ...)
string_n_print()
{
s="$1"
i=$2
while [ $i -gt 32 ]; do
s="$s$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1"
eval "$_EXPR $i - 32"
i=$_result
done
if [ $i -le 16 ]; then
if [ $i -le 8 ]; then
if [ $i -le 4 ]; then
if [ $i -le 2 ]; then
if [ $i -ge 2 ]; then
s=$s"$1"
fi
else # $i > 2
s=$s"$1""$1"
if [ $i -ge 4 ]; then
s=$s"$1"
fi
fi
else # $i > 4
s=$s"$1""$1""$1""$1"
if [ $i -le 6 ]; then
if [ $i -ge 6 ]; then
s=$s"$1"
fi
else # $i > 6
s=$s"$1""$1"
if [ $i -ge 8 ]; then
s=$s"$1"
fi
fi
fi
else # $i > 8
s=$s"$1""$1""$1""$1""$1""$1""$1""$1"
if [ $i -le 12 ]; then
if [ $i -le 10 ]; then
if [ $i -ge 10 ]; then
s=$s"$1"
fi
else # $i > 10
s=$s"$1""$1"
if [ $i -ge 12 ]; then
s=$s"$1"
fi
fi
else # $i > 12
s=$s"$1""$1""$1""$1"
if [ $i -le 14 ]; then
if [ $i -ge 14 ]; then
s=$s"$1"
fi
else # $i > 14
s=$s"$1""$1"
if [ $i -ge 16 ]; then
s=$s"$1"
fi
fi
fi
fi
else # $i > 16
s=$s"$1""$1""$1""$1""$1""$1""$1""$1""$1""$1""$1""$1""$1""$1""$1""$1"
if [ $i -le 24 ]; then
if [ $i -le 20 ]; then
if [ $i -le 18 ]; then
if [ $i -ge 18 ]; then
s=$s"$1"
fi
else # $i > 18
s=$s"$1""$1"
if [ $i -ge 20 ]; then
s=$s"$1"
fi
fi
else # $i > 20
s=$s"$1""$1""$1""$1"
if [ $i -le 22 ]; then
if [ $i -ge 22 ]; then
s=$s"$1"
fi
else # $i > 22
s=$s"$1""$1"
if [ $i -ge 24 ]; then
s=$s"$1"
fi
fi
fi
else # $i > 24
s=$s"$1""$1""$1""$1""$1""$1""$1""$1"
if [ $i -le 28 ]; then
if [ $i -le 26 ]; then
if [ $i -ge 26 ]; then
s=$s"$1"
fi
else # $i > 26
s=$s"$1""$1"
if [ $i -ge 28 ]; then
s=$s"$1"
fi
fi
else # $i > 28
s=$s"$1""$1""$1""$1"
if [ $i -le 30 ]; then
if [ $i -ge 30 ]; then
s=$s"$1"
fi
else # $i > 30
s=$s"$1""$1"
if [ $i -ge 32 ]; then
s=$s"$1"
fi
fi
fi
fi
fi
write_buffer "$s"
}
# count length of variable $1 (in characters)
length()
{
# first try ${#var} substitution, if that fails wc
# if neither succeeds, we just return 30
# (this function is used to layout the menus,
# so worst case it just looks a little bit ugly ;)
if /bin/sh -tc 'echo ${#1} >/dev/null' 2>/dev/null
then
return ${#1}
elif [ -x /bin/wc ]; then
return `$_printf "$1" | /bin/wc -c`
else
return 30
fi
}
# ------------------------------------------------------------
# FUNCTIONS FOR MENUS:
clear_screen()
{
write_buffer "$_clear_screen\n"
}
# moves cursor up $1 lines
go_up_lines()
{
string_n_print "$_line_up" $1
write_buffer "\r"
}
# moves cursor down $1 lines
go_down_lines()
{
if [ -n "${_line_down}" ]; then
string_n_print "$_line_down" $1
fi
}
# print a line containing string $1
# bounded by two stars on each side
print_line()
{
write_buffer "$_MENU_LINE_EMPTY\r${_LEFTSPACE}** $1\n"
}
# print an empty line bounded by two stars on each side
print_empty_line()
{
write_buffer "$_MENU_LINE_EMPTY\n"
}
# print a line filled with stars
print_filled_line()
{
write_buffer "$_MENU_LINE_FILLED\n"
}
# give a prompt with text $1
print_prompt()
{
write_buffer "$_MENU_LINE_EMPTY\r${_LEFTSPACE}** $1"
flush_buffer
}
# print a centered line with text $1
print_center_line()
{
length "`echo "$1"`"
l=$?
eval "$_EXPR $_MENU_WIDTH \* 10"
eval "$_EXPR $_result - $l"
eval "$_EXPR $_result / 2"
write_buffer "$_MENU_LINE_EMPTY\r${_LEFTSPACE}**"
string_n_print " " $_result
write_buffer "$1\n"
}
# print a headline with text $1
print_headline()
{
length "`echo "$1"`"
l=$?
eval "$_EXPR $_MENU_WIDTH \* 10"
eval "$_EXPR $_result - $l"
eval "$_EXPR $_result / 2"
write_buffer "$_MENU_LINE_EMPTY\r${_LEFTSPACE}**"
string_n_print " " $_result
write_buffer "$1\n"
write_buffer "$_MENU_LINE_EMPTY\r${_LEFTSPACE}**"
string_n_print " " $_result
string_n_print "-" $l
write_buffer "\n"
print_empty_line
}
# wait until enter is pressed
wait_for_enter()
{
print_center_line "Please press <ENTER> to continue."
print_filled_line
flush_buffer
read dummy
}
# setup two strings for printing the menu
set_menu_lines()
{
_MENU_LINE_FILLED="${_LEFTSPACE}**"
_MENU_LINE_EMPTY="${_LEFTSPACE}**"
clear_buffer
string_n_print "**********" $_MENU_WIDTH
_MENU_LINE_FILLED=$_MENU_LINE_FILLED$_BUF"**"
clear_buffer
string_n_print " " $_MENU_WIDTH
_MENU_LINE_EMPTY=$_MENU_LINE_EMPTY$_BUF"**"
clear_buffer
}
# set some variables for output
set_terminal_variables()
{
$_tput smcup # turn on cup (see man terminfo)
_line_up=`$_tput cuu1`"\r"
_line_down="\n"
_bold_on=`$_tput bold`
_bold_off=`$_tput sgr0`
_clear_screen=`$_tput clear`
_clear_end_of_display=`$_tput ed`
eval "$_EXPR $_MENU_WIDTH \* 10"
if [ `$_tput cols` -lt $_result ]; then
print_filled_line
print_line "$_bold_onWARNING$_bold_off: Your terminal screen is too narrow."
print_line "It should have at least $_result columns."
print_filled_line
wait_for_enter
fi
}
# ------------------------------------------------------------
# FILE / DIR FUNCTIONS:
# some confidence test for the directories
# (return 0, iff problem - output with command $1)
check_LEDA_INCL_DIR()
{
if [ ! -d $LEDA_INCL_DIR/LEDA ]; then
$1 "WARNING: LEDA_INCL_DIR should contain"
$1 " a subdirectory LEDA."
return 0
fi
if [ ! -r $LEDA_INCL_DIR/LEDA/basic.h ]; then
$1 "WARNING: LEDA_INCL_DIR should contain"
$1 " LEDA/basic.h."
return 0
fi
return 1
}
check_LEDA_LIB_DIR()
{
if [ ! -r $LEDA_LIB_DIR/libL.a -a ! -r $LEDA_LIB_DIR/libL.so ]; then
$1 "WARNING: LEDA_LIB_DIR should contain libL.a or libL.so."
return 0
fi
return 1
}
check_STL_DIR()
{
if [ ! -r $STL_DIR/iterator.h ]; then
$1 "WARNING: STL_DIR should contain iterator.h."
return 0
fi
return 1
}
check_GCC_RTTI_PATCH_DIR()
{
if [ ! -r $GCC_RTTI_PATCH_DIR/libg++.a ]; then
$1 "WARNING: GCC_RTTI_PATCH_DIR"
$1 " should contain libg++.a."
return 0
fi
return 1
}
check_GCC_RTTI_PATCH_EXT()
{
if [ "${GCC_RTTI_PATCH_EXT}" != "" -a \
"${GCC_RTTI_PATCH_EXT}" != "_rtti" ]; then
$1 "WARNING: GCC_RTTI_PATCH_EXT"
$1 " is not set correctly."
return 0
fi
return 1
}
check_LEDA_EXT()
{
if [ "${LEDA_EXT}" != "" -a "${LEDA_EXT}" != "_LEDA" ]; then
$1 "WARNING: LEDA_EXT is not set correctly."
return 0
fi
return 1
}
check_STL_STATUS()
{
if [ "${STL_STATUS}" != "b" -a "${STL_STATUS}" != "x" \
-a "${STL_STATUS}" != "e" ]; then
$1 "WARNING: STL_STATUS is not set correctly."
return 0
fi
return 1
}
check_CGAL_STL_VERSION()
{
case ${CGAL_STL_VERSION} in
CGAL_STL_GCC|CGAL_STL_HP|CGAL_STL_SGI_WWW|CGAL_STL_SGI_WWW_OLD|\
CGAL_STL_SGI_CC|CGAL_STL_WITH_ITERATOR_TRAITS|CGAL_STL_UNKNOWN)
return 1;;
*)
$1 "WARNING: CGAL_STL_VERSION is not set correctly."
return 0;;
esac
}
check_CGAL_INSTALL_VERSION()
{
case ${CGAL_INSTALL_VERSION} in
*.*) return 1;;
*) $1 "WARNING: CGAL_INSTALL_VERSION is not set correctly."
return 0;;
esac
}
# try to read variable $1 from file $2
# (usually this is $CGAL_DIRECTORY_FILE)
# (and run "check_$1", if you got it)
# return 0, iff something went wrong
try_to_get_var_from_file()
{
if [ -r $2 ]; then
_awkprg="/$1/"'{print $3}'
_tmp=`$_awk "$_awkprg" $2`
log_print "got $1 from $2.\nset to \"$_tmp\"."
_tmp=\'$_tmp\'
eval $1="$_tmp"
eval "check_$1 log_print"
return $?
else
# delete previous value of $1
eval $1=''
log_print "WARNING: cannot find file $2."
return 0
fi
}
# ------------------------------------------------------------
# THE MENUS:
# ------------------------------------------------------------
# ------------------------------------------------------------
# compiler menu
#
# cleanup after compilation
cleanup_after_compile()
{
# remove tmp C++ file
$_rm -f ${TMP_CXX_FILE}
# remove sunpro template database
$_rm -rf Templates.DB
# remove irix mipspro template database
$_rm -rf ii_files
}
# run a compiler test named $1, return 0, iff ok
# (use $2 as parameters for the compiler call)
# if $3 is non-zero, inform about eventually occurring problems
_test_compiler()
{
$_printf "${_LEFTSPACE}Testing for $1 ..."
$_printf 'Got the following error messages:\n\n' >${TMP_LOGFILE}
eval "`compiler_bin` $2"
i=$?
j=1
cleanup_after_compile
if [ $i = 0 ]; then
a.out >>${TMP_LOGFILE} 2>&1;
j=$?
$_rm -f a.out core
fi
if [ $j = 0 -a $i = 0 ]; then
log_print "$1 test passed."
$_printf " ok.\n"
$_rm -f ${TMP_LOGFILE}
return 0
else
if [ -n "$3" ]; then
log_print "ERROR: $1 test failed."
write_buffer "\n"
print_filled_line
print_empty_line
print_headline "Test failed"
print_center_line "You will be shown a log now ..."
wait_for_enter
$_cat ${TMP_LOGFILE} | ${PAGER:-$_cat}
write_buffer "\n"
print_filled_line
wait_for_enter
else
log_print "remark: $1 test -> no."
$_printf " no.\n"
fi
$_rm -f ${TMP_LOGFILE}
return 1
fi
}
# ------------------------------------------------------------
# LEDA TEST:
# test if LEDA setting works (return 0, iff ok)
# ($1 nonzero indicates verbosity)
test_leda()
{
if [ -n "${LEDA_EXT}" ]; then
$_printf "\n" > ${TMP_CXX_FILE}
if [ -n "${GCC_RTTI_PATCH_EXT}" ]; then
$_printf "#include <typeinfo>\n" >> ${TMP_CXX_FILE}
fi
$_printf '#include <iostream.h>
#include <LEDA/integer.h>
#include <LEDA/REDEFINE_NAMES.h>
typedef integer I;
#include <LEDA/UNDEFINE_NAMES.h>
int main() {
I a( 123);
I b( 456);
cout << "leda test: " << a << " + " << b << " = " << a+b << endl;
return 0;
}' >> ${TMP_CXX_FILE}
$_printf "\n" >> ${TMP_CXX_FILE}
_test_compiler LEDA "`rtti_patch_cxxflags` -I${LEDA_INCL_DIR} -L${LEDA_LIB_DIR} `rpath_directive`${LEDA_LIB_DIR} `rtti_patch_ldflags` ${TMP_CXX_FILE} -lL >>${TMP_LOGFILE} 2>&1" $1
return $?
else
return 0
fi
}
# ------------------------------------------------------------
# STL TESTS:
# (I use "@error" instead of "#error" to indicate an error,
# since sunpro CC treats the latter as warnings ...)
# test if ${TMP_CXX_FILE} compiles and runs correctly with current setup
# ($1 is the string given to _test_compiler)
# ($2 nonzero indicates verbosity)
_do_stl_test()
{
if [ ${STL_STATUS} != "b" ]; then
_tmp="-I${STL_DIR}"
else
# compiler "builtin" STL
_tmp=''
fi
_test_compiler "$1" "${_tmp} ${TMP_CXX_FILE} >>${TMP_LOGFILE} 2>&1" $2
return $?
}
# test, if STL is original HP from 1994 (or compatible?)
# (return 0, iff it is)
# (test program due to Lutz Kettner)
# ($1 nonzero indicates verbosity)
_test_hp_1994_stl()
{
$_printf '#include <assert.h>
#include <defalloc.h>
#include <iterator.h>
#define Allocator allocator
#include <list.h>
#ifndef LIST_H
@error Program does not use the HP STL from 1994.
#endif
#ifdef Allocator
@error Program does not use the HP STL from 1994.
#endif
int main() {
list<int> l;
l.push_back(42);
assert( 42 == *(l.begin()));
return 0;
}' > ${TMP_CXX_FILE}
$_printf "\n" >> ${TMP_CXX_FILE}
_do_stl_test "HP STL" $1
return $?
}
# test, if STL is SGI STL from 1996 (or compatible?)
# (return 0, iff it is)
# (test program due to Lutz Kettner)
# ($1 nonzero indicates verbosity)
_test_sgi_1996_stl()
{
$_printf '#include <assert.h>
#include <defalloc.h>
#include <iterator.h>
#define Allocator allocator
#include <list.h>
#ifndef __SGI_STL_LIST_H
@error Program does not use the old SGI STL from the web from 1996.
#endif
#ifndef Allocator
@error Program does not use the old SGI STL from the web from 1996.
#endif
template< class T> inline
int check( const __list_const_iterator<T>&){
return 1;
}
int main() {
const list<int> l;
assert( check( l.begin()));
return 0;
}' > ${TMP_CXX_FILE}
$_printf "\n" >> ${TMP_CXX_FILE}
_do_stl_test "SGI 1996 STL" $1
return $?
}
# test, if STL is SGI STL supplied with compiler (or compatible?)
# (return 0, iff it is)
# (test program due to Lutz Kettner)
# ($1 nonzero indicates verbosity)
_test_sgi_cc_stl()
{
$_printf '#include <assert.h>
#include <defalloc.h>
#include <iterator.h>
#define Allocator allocator
#include <list.h>
#ifndef LIST_H
@error Program does not use the SGI STL shipped with C++ from 1996.
#endif
#ifndef Allocator
@error Program does not use the SGI STL shipped with C++ from 1996.
#endif
int main() {
list<int> l;
l.push_back(42);
assert( 42 == *(l.begin()));
return 0;
}' > ${TMP_CXX_FILE}
_do_stl_test "SGI CC STL" $1
return $?
}
# test, if STL supports iterator traits
# (return 0, iff it is)
# (test program due to Lutz Kettner)
# ($1 nonzero indicates verbosity)
_test_stl_iterator_traits()
{
$_printf '#include <assert.h>
#include <iterator.h>
#include <list.h>
template <class Iterator>
struct Get_val {
typedef typename iterator_traits<Iterator>::value_type value_type;
value_type operator()( Iterator i) { return *i;}
};
template <class Iterator>
typename iterator_traits<Iterator>::value_type get_val( Iterator i) {
return *i;
}
int main() {
list<int> l;
l.push_back(42);
l.push_back(13);
assert( 42 == Get_val<list<int>::iterator>()( l.begin()));
assert( 42 == get_val( l.begin()));
return 0;
}' > ${TMP_CXX_FILE}
$_printf "\n" >> ${TMP_CXX_FILE}
_do_stl_test "ITERATOR TRAITS" $1
return $?
}
# test, if STL is SGI STL from June 1997 (or compatible?)
# (return 0, iff it is)
# (test program due to Lutz Kettner)
# ($1 nonzero indicates verbosity)
_test_sgi_june_1997_stl()
{
$_printf '#include <assert.h>
#include <defalloc.h>
#include <iterator.h>
#define Allocator allocator
#include <list.h>
#ifndef __SGI_STL_LIST_H
@error Program does not use the SGI STL from June 13, 1997.
#endif
#ifndef Allocator
@error Program does not use the SGI STL from June 13, 1997.
#endif
template< class T, class Ref> inline
int check( const __list_iterator<T,Ref>&){
return 1;
}
int main() {
list<int> l;
assert( check( l.begin()));
return 0;
}' > ${TMP_CXX_FILE}
$_printf "\n" >> ${TMP_CXX_FILE}
_do_stl_test "SGI 6/97 STL" $1
return $?
}
# test, if STL works
# (return 0, iff it is)
# (test program due to Lutz Kettner)
# ($1 nonzero indicates verbosity)
test_stl_general()
{
$_printf '#include <iostream.h>
#include <algo.h>
#include <vector.h>
#include <list.h>
#include <iterator.h>
#include <assert.h>
list<char> lst( char* s) {
list<char> x;
while (*s != '\0') x.push_back( *s++);
return x;
}
int main() {
list<char> list1 = lst( "mark twain");
reverse( list1.begin(), list1.end());
assert( list1 == lst( "niawt kram"));
return 0;
}' > ${TMP_CXX_FILE}
_do_stl_test "STL" $1
return $?
}
# determine which STL version is used
# ($1 nonzero indicates verbosity)
# we have the following different types:
# CGAL_STL_GCC
# CGAL_STL_HP
# CGAL_STL_SGI_WWW
# CGAL_STL_SGI_WWW_OLD
# CGAL_STL_SGI_CC
# CGAL_STL_WITH_ITERATOR_TRAITS
# CGAL_STL_UNKNOWN
set_stl_type()
{
if [ "`compiler_basename`" = "g++" ]; then
CGAL_STL_VERSION='CGAL_STL_GCC'
elif _test_stl_iterator_traits $1; then
CGAL_STL_VERSION='CGAL_STL_WITH_ITERATOR_TRAITS'
elif _test_sgi_june_1997_stl $1; then
CGAL_STL_VERSION='CGAL_STL_SGI_WWW'
elif _test_sgi_1996_stl $1; then
CGAL_STL_VERSION='CGAL_STL_SGI_WWW_OLD'
elif _test_sgi_cc_stl $1; then
CGAL_STL_VERSION='CGAL_STL_SGI_CC'
elif _test_hp_1994_stl $1; then
CGAL_STL_VERSION='CGAL_STL_HP'
else
CGAL_STL_VERSION='CGAL_STL_UNKNOWN'
fi
}
# ------------------------------------------------------------
# GCC RTTI PATCH TEST:
# test, if RTTI patch works
# (return 0, iff it does)
# ($1 nonzero indicates verbosity)
test_gcc_rtti_patch()
{
if [ -n "${GCC_RTTI_PATCH_EXT}" ]; then
$_printf '#include <typeinfo>
#include <fstream.h>
#include <iostream.h>
int main() {
ifstream t;
t.open( "README");
int i;
cout << "If this is the last line you see,"
<< "the test failed." << endl;
t >> i;
cout << "test ok" << endl;
return 0;
}' > ${TMP_CXX_FILE}
$_printf "\n" >> ${TMP_CXX_FILE}
_test_compiler 'RTTI patch' "`rtti_patch_cxxflags` ${TMP_CXX_FILE} `rtti_patch_ldflags` >>${TMP_LOGFILE} 2>&1" $1
return $?
fi
return 0
}
# set variable CGAL_OS_COMPILER according to the current
# compiler settings
set_ostype()
{
if [ -n "`compiler_version`" ]; then
CGAL_OS_COMPILER="${SYST}_`compiler_basename`-`compiler_version`"
else
CGAL_OS_COMPILER="${SYST}_`compiler_basename`"
fi
}
# return the full os/compiler string
# (i.e. including LEDA and RTTI extension)
full_ostype()
{
$_printf "${CGAL_OS_COMPILER}${GCC_RTTI_PATCH_EXT}${LEDA_EXT}"
}
# print information about LEDA support in current setup
print_leda_support()
{
if [ -n "${LEDA_EXT}" ]; then
$_printf "LEDA:\t\tsupported."
else
$_printf "LEDA:\t\tnot supported."
fi
}
# print information about rtti-patch support in current setup
print_rtti_support()
{
if show_rtti_options; then
if [ -n "${GCC_RTTI_PATCH_EXT}" ]; then
$_printf "RTTI:\t\tsupported."
else
$_printf "RTTI:\t\tnot supported."
fi
fi
}
# print the current os/compiler in a readable fashion
print_os_setting()
{
$_printf "${_LEFTSPACE}OS:\t\t${SYST}\n"
$_printf "${_LEFTSPACE}COMPILER:\t${COMPILER}\n"
$_printf "${_LEFTSPACE}STL:\t\t${CGAL_STL_VERSION}.\n"
$_printf "${_LEFTSPACE}`print_leda_support`\n"
$_printf "${_LEFTSPACE}`print_rtti_support`\n"
}
set_lib_compiled_flag()
{
# does there exist a lib for this os/compiler?
if [ -r ${CGAL_LIB_DIR}/`full_ostype`/${CGAL_LIB_NAME}.a ]; then
LIB_COMPILED='ok'
else
LIB_COMPILED=''
fi
}
# try to retrieve the compiler specific settings from
# file ${CGAL_CONF_DIR}/${CGAL_OS_COMPILER}
retrieve_compiler_settings()
{
_file="${CGAL_CONF_DIR}/${CGAL_OS_COMPILER}"
_tmp_version=${CGAL_INSTALL_VERSION}
try_to_get_var_from_file CGAL_INSTALL_VERSION "${_file}"
if [ "${_tmp_version}" != "${CGAL_INSTALL_VERSION}" ]; then
# this config file was generated by an older install
log_print "WARNING: config file `$_basename ${_file}`"
log_print " was generated by another `$_basename $0` version."
SETUP_COMPLETE=''
CGAL_INSTALL_VERSION=${_tmp_version}
else
SETUP_COMPLETE='y'
fi
# these two have to be ok:
if try_to_get_var_from_file LEDA_EXT "${_file}"; then
LEDA_EXT=''
fi
if try_to_get_var_from_file GCC_RTTI_PATCH_EXT "${_file}"; then
GCC_RTTI_PATCH_EXT=''
fi
if try_to_get_var_from_file LEDA_INCL_DIR "${_file}"; then
if [ -n "${LEDA_EXT}" ]; then
SETUP_COMPLETE=''
fi
LEDA_EXT=''
fi
if try_to_get_var_from_file LEDA_LIB_DIR "${_file}"; then
if [ -n "${LEDA_EXT}" ]; then
SETUP_COMPLETE=''
fi
LEDA_EXT=''
fi
if try_to_get_var_from_file GCC_RTTI_PATCH_DIR "${_file}"; then
if [ -n "${GCC_RTTI_PATCH_EXT}" ]; then
SETUP_COMPLETE=''
fi
GCC_RTTI_PATCH_EXT=''
fi
if try_to_get_var_from_file STL_STATUS "${_file}"; then
# couldn't get STL_STATUS
SETUP_COMPLETE=''
fi
if try_to_get_var_from_file STL_DIR "${_file}"; then
if [ "${STL_STATUS}" != "b" ]; then
SETUP_COMPLETE=''
fi
fi
if try_to_get_var_from_file CGAL_STL_VERSION "${_file}"; then
# couldn't get CGAL_STL_VERSION
SETUP_COMPLETE=''
fi
set_lib_compiled_flag
}
# store the actual compiler specific settings to the
# file ${CGAL_CONF_DIR}/${CGAL_OS_COMPILER}
store_compiler_settings()
{
_file="${CGAL_CONF_DIR}/${CGAL_OS_COMPILER}"
$_printf "# file: `$_basename ${_file}`\n" >${_file}
$_printf "# Configuration file for ${COMPILER} on ${SYST}\n" >>${_file}
$_printf "# Automatically created by $0.\n" >>${_file}
$_printf "# Please do not edit.\n" >>${_file}
$_printf "CGAL_INSTALL_VERSION = ${CGAL_INSTALL_VERSION}\n" >>${_file}
$_printf "LEDA_INCL_DIR = ${LEDA_INCL_DIR}\n" >>${_file}
$_printf "LEDA_LIB_DIR = ${LEDA_LIB_DIR}\n" >>${_file}
$_printf "GCC_RTTI_PATCH_DIR = ${GCC_RTTI_PATCH_DIR}\n" >>${_file}
$_printf "STL_DIR = ${STL_DIR}\n" >>${_file}
$_printf "STL_STATUS = ${STL_STATUS}\n" >>${_file}
$_printf "CGAL_STL_VERSION = ${CGAL_STL_VERSION}\n" >>${_file}
$_printf "LEDA_EXT = ${LEDA_EXT}\n" >>${_file}
$_printf "GCC_RTTI_PATCH_EXT = ${GCC_RTTI_PATCH_EXT}\n" >>${_file}
log_print "Settings stored in ${_file}."
}
# load the settings for $COMPILER,
# if a config file exists, otherwise check for "builtin" STL
# and set STL_STATUS accordingly
_choose_compiler()
{
log_print "Choosing $COMPILER as compiler."
set_ostype
retrieve_compiler_settings
if [ -z "${SETUP_COMPLETE}" ]; then
go_down_lines 15
flush_buffer
STL_STATUS='b'
if test_stl_general; then
log_print "$COMPILER seems to have builtin STL."
else
log_print "$COMPILER seems NOT to have builtin STL."
STL_STATUS='e'
fi
fi
}
# set COMPILER to $COMPILER_$1 (for $1 in {1..${_COMPILER_NUMBER}-1})
_set_compiler()
{
if [ $1 -ge ${_COMPILER_NUMBER} ]; then
$_printf "\nERROR: argument greater than expexted\n"
$_printf " ($1 >= ${_COMPILER_NUMBER}) in _set_compiler\n"
exit 1
fi
_tmp=`eval "echo '$'_COMPILER_$1"`
_tmp=`eval "echo $_tmp"`
COMPILER=$_tmp
}
compiler_menu()
{
_OLD_COMPILER=${COMPILER}
while [ 0 ]; do
clear_screen
print_filled_line
print_headline "CGAL $CGAL_VERSION Installation Compiler Menu"
print_line "Your OS is: $SYST"
print_line "Current Compiler is: ${COMPILER:-<undefined>}"
print_empty_line
i=1
while [ $i -lt $_COMPILER_NUMBER ]; do
_tmp=`eval "echo '$'_COMPILER_$i"`
_tmp=`eval "echo $_tmp"`
print_line "$_bold_on<$i>$_bold_off $_tmp"
eval "$_EXPR $i + 1"
i=$_result
done
print_empty_line
print_line "$_bold_on<Q>$_bold_off Back to Main Menu"
print_empty_line
print_empty_line
print_empty_line
print_filled_line
go_up_lines 3
print_prompt "Your choice: "
read KEY
go_up_lines 12
case $KEY in
1|2|3|4|5)
if [ $KEY -lt $_COMPILER_NUMBER ]; then
_set_compiler $KEY
fi
;;
q|Q|b|B)
if [ -n "${COMPILER}" -a "${_OLD_COMPILER}" != "${COMPILER}" ]
then
_choose_compiler
fi
return;;
esac
done
}
# ------------------------------------------------------------
# dir_menu to setup directories
#
# change directory variable $1 in dir_menu()
# (go $2 lines up before querying for input)
change_dir()
{
go_up_lines 1
print_prompt "New $1: "
read DIR
if [ -n "$DIR" ]; then
go_down_lines $2
print_filled_line
if [ ! -d $DIR ]; then
print_center_line "ERROR: Directory does not exist."
wait_for_enter
else
# store old value
_tmp=`eval "echo '$'$1"`
_tmp=\'`eval "echo $_tmp"`\'
eval $1=$DIR
if eval "check_$1 print_line"; then
eval $1="$_tmp"
wait_for_enter
else
_CHANGED='y'
fi
fi
fi
}
dir_menu()
{
_CHANGED=''
while [ 0 ]; do
clear_screen
print_filled_line
print_headline "CGAL $CGAL_VERSION Directory Setup"
print_line "Current setup:"
print_line "--------------"
if [ -z "${LEDA_EXT}" ]; then
_tmp='not '
else
_tmp=''
fi
print_line " LEDA is ${_tmp}used."
if [ "${STL_STATUS}" != "e" ]; then
if [ "${STL_STATUS}" != "b" ]; then
_tmp='not '
else
_tmp=''
fi
print_line " STL shipped with compiler is ${_tmp}used."
fi
if show_rtti_options; then
if [ -z "${GCC_RTTI_PATCH_EXT}" ]; then
_tmp="Do not use"
else
_tmp="Use"
fi
print_line " ${_tmp} RTTI-patched libg++."
fi
print_empty_line
if [ -n "$LEDA_EXT" ]; then
print_line "$_bold_on<U>$_bold_off Do not use LEDA"
print_line "$_bold_on<I>$_bold_off LEDA include directory"
print_line " ${LEDA_INCL_DIR:-<undefined>}"
print_line "$_bold_on<L>$_bold_off LEDA lib directory"
print_line " ${LEDA_LIB_DIR:-<undefined>}"
else
print_line "$_bold_on<U>$_bold_off Use LEDA"
fi
_OFFSET1=1
if [ "${STL_STATUS}" != "e" ]; then
if [ "${STL_STATUS}" = "x" ]; then
_OFFSET1=2
print_line "$_bold_on<X>$_bold_off Use STL shipped with compiler"
else
_OFFSET1=0
print_line "$_bold_on<X>$_bold_off Use an extra STL"
fi
fi
if [ "${STL_STATUS}" != "b" ]; then
print_line "$_bold_on<S>$_bold_off STL include directory"
print_line " ${STL_DIR:-<undefined>}"
fi
if show_rtti_options; then
if [ -n "${GCC_RTTI_PATCH_EXT}" ]; then
_OFFSET2=7
print_line "$_bold_on<R>$_bold_off Don't use g++ RTTI-patch"
print_line "$_bold_on<G>$_bold_off g++ RTTI-patch directory"
print_line " ${GCC_RTTI_PATCH_DIR:-<undefined>}"
else
_OFFSET2=5
print_line "$_bold_on<R>$_bold_off Use g++ RTTI-patch"
fi
else
_OFFSET2=4
fi
print_empty_line
print_line "$_bold_on<Q>$_bold_off Back to Main Menu"
print_empty_line
print_empty_line
print_empty_line
print_filled_line
go_up_lines 3
print_prompt "Change: "
read KEY
case $KEY in
u|U)
_CHANGED='y'
if [ -z "$LEDA_EXT" ]; then
LEDA_EXT='_LEDA'
else
LEDA_EXT=''
fi
;;
i|I)
if [ -n "$LEDA_EXT" ]; then
eval "$_EXPR ${_OFFSET2} + ${_OFFSET1}"
eval "$_EXPR ${_result} + 4"
change_dir LEDA_INCL_DIR ${_result}
fi
;;
l|L)
if [ -n "$LEDA_EXT" ]; then
eval "$_EXPR ${_OFFSET2} + ${_OFFSET1}"
eval "$_EXPR ${_result} + 2"
change_dir LEDA_LIB_DIR ${_result}
fi
;;
x|X)
_CHANGED='y'
if [ "${STL_STATUS}" = "x" ]; then
STL_STATUS="b"
elif [ "${STL_STATUS}" = "b" ]; then
STL_STATUS="x"
fi
;;
s|S)
if [ "${STL_STATUS}" != "b" ]; then
eval "$_EXPR ${_OFFSET2} + 1"
change_dir STL_DIR ${_result}
fi
;;
r|R)
_CHANGED='y'
if [ -z "${GCC_RTTI_PATCH_EXT}" ]; then
GCC_RTTI_PATCH_EXT='_rtti'
else
GCC_RTTI_PATCH_EXT=''
fi
;;
g|G)
if [ -n "${GCC_RTTI_PATCH_EXT}" ]; then
change_dir GCC_RTTI_PATCH_DIR 5
fi
;;
q|Q|b|B)
if [ -n "$_CHANGED" -o -z "${SETUP_COMPLETE}" ]; then
go_down_lines 3
flush_buffer
if test_leda v && test_stl_general v && \
test_gcc_rtti_patch v; then
log_print "$COMPILER configured correctly."
set_stl_type
log_print "STL type seems to be ${CGAL_STL_VERSION}."
$_printf \
"${_LEFTSPACE}STL type seems to be ${CGAL_STL_VERSION}."
store_compiler_settings
SETUP_COMPLETE='ok'
set_lib_compiled_flag
else
log_print "$COMPILER NOT configured correctly."
SETUP_COMPLETE=''
LIB_COMPILED=''
fi
fi
return;;
*);;
esac
done
}
# ------------------------------------------------------------
# lib menu
#
#################### (begin) from old cgal_install ############################
# ------------------------------------------------------------
# create include makefile
# these makefiles are placed in ${CGAL_MAKE_DIR}
# and define compiler/os specific flags
# they should be included in any CGAL makefile
# when compiling on this compiler/os
# ------------------------------------------------------------
# (this is taken from scripts/create_include_makefiles)
# ------------------------------------------------------------
header()
{
echo "#---------------------------------------------------------------------#"
echo "# $1"
echo "#---------------------------------------------------------------------#"
}
write_compiler_flags()
{
header "compiler flags" >> $FILE
echo "# For more information about the compiler flags see the installation guide." >> $FILE
echo >> $FILE
echo "CGAL_STL_VERSION = CGAL_STL_UNKNOWN" >> $FILE
echo "# *** Fill in your STL_include_directory ***" >> $FILE
echo "# (including the -I directive)" >> $FILE
echo "# (e.g. -I/usr/local/STL)" >> $FILE
echo "CGAL_STL_INCLUDE_DIRECTIVE =" >> $FILE
if [ ! -z "$USE_LEDA" ] ; then
echo "LEDA_INCL_DIR = *** FILL IN YOUR LEDA_include_directory ***" >> $FILE
fi
echo >> $FILE
echo "CGAL_CXXFLAGS = \\" >> $FILE
echo " -D${CGAL_COMPILER} \\" >> $FILE
echo " -D\$(CGAL_STL_VERSION) \\" >> $FILE
if [ ! -z "$USE_LEDA" ] ; then
echo " -DCGAL_USE_LEDA_BOOL \\" >> $FILE
fi
if [ ! -z "$USE_RTTI_PATCH" ] ; then
echo " -DRTTI_PATCH \\" >> $FILE
fi
if [ ! -z "$USE_STDEXCEPT" ] ; then
echo " -D__STDEXCEPT__ \\" >> $FILE
fi
if [ ! -z "$ADDITIONAL_CXXFLAGS" ] ; then
echo " $ADDITIONAL_CXXFLAGS \\" >> $FILE
fi
echo " \$(CGAL_STL_INCLUDE_DIRECTIVE) \\" >> $FILE
if [ ! -z "$USE_LEDA" ] ; then
echo " -I\$(CGAL_INCL_DIR) \\" >> $FILE
echo " -I\$(LEDA_INCL_DIR)" >> $FILE
else
echo " -I\$(CGAL_INCL_DIR)" >> $FILE
fi
echo >> $FILE
}
write_linker_flags()
{
header "linker flags" >> $FILE
echo >> $FILE
if [ ! -z "$USE_LEDA" ] ; then
echo "# *** Fill in your LEDA_lib_directory ***" >> $FILE
echo "LEDA_LIB_DIR =" >> $FILE
echo >> $FILE
fi
if [ ! -z "$USE_RTTI_PATCH" ] ; then
echo "# *** Fill in your g++_rttipatch_directory ***" >> $FILE
echo "GCC_RTTI_PATCH_DIR =" >> $FILE
echo >> $FILE
fi
LIB_PATH="-L\$(CGAL_LIB_DIR)/\$(CGAL_OS_COMPILER)"
RUNTIME_LIB_PATH="\$(CGAL_LIB_DIR)/\$(CGAL_OS_COMPILER)"
LIBS="-lCGAL"
if [ ! -z "$USE_LEDA" ] ; then
LIB_PATH="${LIB_PATH} -L\$(LEDA_LIB_DIR)"
RUNTIME_LIB_PATH="${RUNTIME_LIB_PATH}:\$(LEDA_LIB_DIR)"
LIBS="${LIBS} -lL"
fi
if [ ! -z "$USE_RTTI_PATCH" ] ; then
LIB_PATH="${LIB_PATH} -L\$(GCC_RTTI_PATCH_DIR)"
RUNTIME_LIB_PATH="${RUNTIME_LIB_PATH}:\$(GCC_RTTI_PATCH_DIR)"
LIBS="${LIBS} \\\\\n -nodefaultlibs -lstdc++ -liberty -lg++ -lgcc -lc"
fi
echo "CGAL_LDFLAGS = \\" >> $FILE
echo " $LIB_PATH \\" >> $FILE
if [ ! -z "$RUNTIME_FLAG" ] ; then
echo " ${RUNTIME_FLAG}${RUNTIME_LIB_PATH} \\" >> $FILE
fi
echo " $LIBS -lm" >> $FILE
echo >> $FILE
if [ ! -z "$USE_LEDA" ] ; then
LIB_PATH="${LIB_PATH} -L$WINDOW_DIR"
RUNTIME_LIB_PATH="${RUNTIME_LIB_PATH}:$WINDOW_DIR"
LIBS="-lW -lP -lG -lX11 ${LIBS}"
echo "CGAL_WINDOW_LDFLAGS = \\" >> $FILE
echo " $LIB_PATH \\" >> $FILE
if [ ! -z "$RUNTIME_FLAG" ] ; then
echo " ${RUNTIME_FLAG}${RUNTIME_LIB_PATH} \\" >> $FILE
fi
echo " $LIBS -lm" >> $FILE
echo >> $FILE
fi
}
_create_include_makefile()
{
FILE=$CGAL_MAKEFILE
if [ -z "$LEDA_EXT" ] ; then
USE_LEDA=
else
USE_LEDA=Y
fi
if [ -z "$GCC_RTTI_PATCH_EXT" ] ; then
USE_RTTI_PATCH=
if show_rtti_options; then
USE_STDEXCEPT=Y
else
USE_STDEXCEPT=
fi
else
USE_RTTI_PATCH=Y
USE_STDEXCEPT=
fi
echo "# This file contains CGAL makefile settings for the following platform:" >> $FILE
echo "# operating system: $OPERATING_SYSTEM" >> $FILE
if [ ! -z "$USE_RTTI_PATCH" ] ; then
echo "# compiler: ${COMPILER:-<unknown>} (with rtti patch)" >> $FILE
else
echo "# compiler: ${COMPILER:-<unknown>}" >> $FILE
fi
if [ ! -z "$USE_LEDA" ] ; then
echo "# with LEDA" >> $FILE
else
echo "# without LEDA" >> $FILE
fi
echo >> $FILE
header "include directory settings" >> $FILE
echo >> $FILE
echo "CGAL_DIRECTORIES =" >> $FILE
echo "include \$(CGAL_DIRECTORIES)" >> $FILE
echo >> $FILE
header "os/compiler description" >> $FILE
echo >> $FILE
echo "CGAL_OS_COMPILER = ${CGAL_OS_COMPILER}" >> $FILE
echo >> $FILE
header "compiler" >> $FILE
echo >> $FILE
echo "CGAL_CXX = $CGAL_CXX" >> $FILE
echo >> $FILE
write_compiler_flags
write_linker_flags
header "commands and flags for creating libraries" >> $FILE
echo >> $FILE
echo "CGAL_LIB = libCGAL.a" >> $FILE
echo "CGAL_LIB_CXXFLAGS = \$(CGAL_CXXFLAGS) $CGAL_LIB_CXXFLAGS" >> $FILE
echo "CGAL_LIB_LDFLAGS = $CGAL_LIB_LDFLAGS" >> $FILE
echo "CGAL_LIB_CREATE = $CGAL_LIB_CREATE" >> $FILE
echo >> $FILE
echo "CGAL_SHARED_LIB = libCGAL.so" >> $FILE
echo "CGAL_SHARED_LIB_CXXFLAGS = \$(CGAL_CXXFLAGS) $CGAL_SHARED_LIB_CXXFLAGS" >> $FILE
if [ -z "$USE_LEDA" ] ; then
echo "CGAL_SHARED_LIB_LDFLAGS = $CGAL_SHARED_LIB_LDFLAGS" >> $FILE
else
if [ ! -z "$RUNTIME_FLAG" ] ; then
echo "CGAL_SHARED_LIB_LDFLAGS = -L\$(LEDA_LIB_DIR) ${RUNTIME_FLAG}\$(LEDA_LIB_DIR) -lL $CGAL_SHARED_LIB_LDFLAGS" >> $FILE
else
echo "CGAL_SHARED_LIB_LDFLAGS = -L\$(LEDA_LIB_DIR) -lL $CGAL_SHARED_LIB_LDFLAGS" >> $FILE
fi
fi
echo "CGAL_SHARED_LIB_CREATE = $CGAL_SHARED_LIB_CREATE" >> $FILE
echo >> $FILE
}
# -----------------------------------------------------------
# Now the new function to create the include makefile
# for compiler/os combination CGAL_OS_COMPILER
create_include_makefile()
{
# first, set some compiler/os specific variables
case ${CGAL_OS_COMPILER} in
*IRIX*5.*CC*)
#### settings for sgi mipspro compiler on irix5
OPERATING_SYSTEM="IRIX 5.3"
CGAL_COMPILER="CGAL_SGI_MIPSPRO_CC_40"
CGAL_CXX="CC"
ADDITIONAL_CXXFLAGS=
CGAL_LIB_CXXFLAGS=
CGAL_LIB_LDFLAGS=
CGAL_LIB_CREATE="ar cr"
CGAL_SHARED_LIB_CXXFLAGS=
CGAL_SHARED_LIB_LDFLAGS="-lm"
CGAL_SHARED_LIB_CREATE="CC -shared -o"
WINDOW_DIR="/usr/lib/X11"
RUNTIME_FLAG="-rpath "
_create_include_makefile;;
*IRIX*6.*CC*)
#### settings for sgi mipspro compiler on irix6
OPERATING_SYSTEM="IRIX 6.2"
CGAL_COMPILER="CGAL_SGI_MIPSPRO_CC_71"
CGAL_CXX="CC"
ADDITIONAL_CXXFLAGS=
CGAL_LIB_CXXFLAGS=
CGAL_LIB_LDFLAGS=
CGAL_LIB_CREATE="ar cr"
CGAL_SHARED_LIB_CXXFLAGS=
CGAL_SHARED_LIB_LDFLAGS="-lm"
CGAL_SHARED_LIB_CREATE="CC -shared -o"
WINDOW_DIR="/usr/lib/X11"
RUNTIME_FLAG="-rpath "
_create_include_makefile;;
*IRIX*g++*)
#### settings for GNU compiler on irix
OPERATING_SYSTEM="IRIX ?.?"
CGAL_COMPILER="CGAL_GNU_GCC_272"
CGAL_CXX="g++"
ADDITIONAL_CXXFLAGS="-frtti"
CGAL_LIB_CXXFLAGS=
CGAL_LIB_LDFLAGS=
CGAL_LIB_CREATE="ar cr"
CGAL_SHARED_LIB_CXXFLAGS="-fpic"
CGAL_SHARED_LIB_LDFLAGS="-lm"
CGAL_SHARED_LIB_CREATE="g++ -shared -o"
WINDOW_DIR="/usr/lib/X11"
RUNTIME_FLAG=
_create_include_makefile;;
*SunOS*5.*CC*)
#### settings for sunpro compiler on solaris
OPERATING_SYSTEM="Sun Solaris 2.5"
CGAL_COMPILER="CGAL_SUNPRO_CC_41"
CGAL_CXX="CC"
ADDITIONAL_CXXFLAGS="-pto"
CGAL_LIB_CXXFLAGS=
CGAL_LIB_LDFLAGS=
CGAL_LIB_CREATE="CC -xar -o"
CGAL_SHARED_LIB_CXXFLAGS="-pic"
CGAL_SHARED_LIB_LDFLAGS=""
CGAL_SHARED_LIB_CREATE="CC -G -o"
WINDOW_DIR="/usr/openwin/lib"
RUNTIME_FLAG="-R "
_create_include_makefile;;
*SunOS*5.*g++*)
#### settings for GNU compiler on solaris
OPERATING_SYSTEM="Sun Solaris 2.5"
CGAL_COMPILER="CGAL_GNU_GCC_272"
CGAL_CXX="g++"
ADDITIONAL_CXXFLAGS="-frtti"
CGAL_LIB_CXXFLAGS=
CGAL_LIB_LDFLAGS=
CGAL_LIB_CREATE="ar cr"
CGAL_SHARED_LIB_CXXFLAGS="-fpic"
CGAL_SHARED_LIB_LDFLAGS=""
CGAL_SHARED_LIB_CREATE="g++ -G -o"
WINDOW_DIR="/usr/openwin/lib"
RUNTIME_FLAG="-R "
_create_include_makefile;;
*Linux*g++*)
#### settings for GNU compiler on linux
OPERATING_SYSTEM="Linux"
CGAL_COMPILER="CGAL_GNU_GCC_272"
CGAL_CXX="g++"
ADDITIONAL_CXXFLAGS="-frtti"
CGAL_LIB_CXXFLAGS=
CGAL_LIB_LDFLAGS=
CGAL_LIB_CREATE="ar cr"
CGAL_SHARED_LIB_CXXFLAGS="-fpic"
CGAL_SHARED_LIB_LDFLAGS=""
CGAL_SHARED_LIB_CREATE="g++ -G -o"
WINDOW_DIR="/usr/openwin/lib"
RUNTIME_FLAG=
_create_include_makefile;;
*)
#### settings for unknown compiler
OPERATING_SYSTEM="${SYST}"
CGAL_COMPILER="CGAL_UNKNOWN_COMPILER"
CGAL_CXX=${COMPILER}
ADDITIONAL_CXXFLAGS=
CGAL_LIB_CXXFLAGS=
CGAL_LIB_LDFLAGS=
CGAL_LIB_CREATE="ar cr"
CGAL_SHARED_LIB_CXXFLAGS="-fpic"
CGAL_SHARED_LIB_LDFLAGS=""
CGAL_SHARED_LIB_CREATE="${COMPILER} -G -o"
WINDOW_DIR="/usr/lib/X11"
RUNTIME_FLAG=
_create_include_makefile;;
esac
}
#---------------------------------------------------------------------------#
# replace_line <file> <string> <replacement>
# replaces all the lines in <file> that start with <string> with <replacement>
#---------------------------------------------------------------------------#
replace_line()
{
if [ ! -f $1 ] ; then
echo "Error: could not open file $1 in replace_line()"
return
fi
if eval '$_sed -e "/^$2/c\\
$3" $1 > $1.TEMP' ; then
/bin/mv $1.TEMP $1
else
echo "Error sed replacement failed in replace_line()"
fi
}
# log via $1
generatemakefiles()
{
replace_line $CGAL_DIRFILE CGAL_INCL_DIR "CGAL_INCL_DIR = $CGAL_INCL_DIR"
replace_line $CGAL_DIRFILE CGAL_LIB_DIR "CGAL_LIB_DIR = $CGAL_LIB_DIR"
# create ${CGAL_MAKEFILE}, if it does not exist
if [ ! -r ${CGAL_MAKEFILE} ]; then
$1 "remark: `$_basename ${CGAL_MAKEFILE}` does not exist, creating."
create_include_makefile
else
$1 "remark: `$_basename ${CGAL_MAKEFILE}` already exists, saving as \".bak\"."
/bin/mv ${CGAL_MAKEFILE} ${CGAL_MAKEFILE}.bak
create_include_makefile
fi
replace_line $CGAL_MAKEFILE CGAL_DIRECTORIES "CGAL_DIRECTORIES = ${CGAL_DIRFILE}"
replace_line $CGAL_MAKEFILE CGAL_OS_COMPILER \
"CGAL_OS_COMPILER = ${CGAL_OS_COMPILER}${GCC_RTTI_PATCH_EXT}${LEDA_EXT}"
if [ -n "$LEDA_INCL_DIR" ] ; then
replace_line $CGAL_MAKEFILE LEDA_INCL_DIR "LEDA_INCL_DIR = $LEDA_INCL_DIR"
fi
if [ -n "$LEDA_LIB_DIR" ] ; then
replace_line $CGAL_MAKEFILE LEDA_LIB_DIR "LEDA_LIB_DIR = $LEDA_LIB_DIR"
fi
replace_line $CGAL_MAKEFILE CGAL_STL_VERSION "CGAL_STL_VERSION = $CGAL_STL_VERSION"
if [ -z "$STL_DIR" ] ; then
replace_line $CGAL_MAKEFILE CGAL_STL_INCLUDE_DIRECTIVE "CGAL_STL_INCLUDE_DIRECTIVE ="
else
replace_line $CGAL_MAKEFILE CGAL_STL_INCLUDE_DIRECTIVE "CGAL_STL_INCLUDE_DIRECTIVE = -I$STL_DIR"
fi
if [ ! -z "$GCC_RTTI_PATCH_DIR" ] ; then
replace_line $CGAL_MAKEFILE GCC_RTTI_PATCH_DIR "GCC_RTTI_PATCH_DIR = $GCC_RTTI_PATCH_DIR"
fi
FILE=${CGAL_SRC_DIR}/makefile_lib
replace_line $FILE CGAL_MAKEFILE "CGAL_MAKEFILE = ${CGAL_MAKEFILE}"
FILE=${CGAL_SRC_DIR}/makefile_sharedlib
replace_line $FILE CGAL_MAKEFILE "CGAL_MAKEFILE = ${CGAL_MAKEFILE}"
FILE=${CGAL_EXAMPLE_DIR}/makefile
replace_line $FILE CGAL_MAKEFILE "CGAL_MAKEFILE = ${CGAL_MAKEFILE}"
FILE=${CGAL_TEST_DIR}/cgal_test
replace_line $FILE CGAL_MAKE_DIR "CGAL_MAKE_DIR=${CGAL_MAKE_DIR}"
$_chmod 744 $FILE
for FILE in `/bin/ls ${CGAL_TEST_DIR}/*/makefile` ; do
replace_line $FILE CGAL_MAKEFILE "CGAL_MAKEFILE = ${CGAL_MAKEFILE}"
done
}
#################### (end) from old cgal_install ############################
# compile $1 (= lib or sharedlib)
# return 0, iff success
_do_compile()
{
$_printf "${_LEFTSPACE}Building CGAL_$1 ..."
if [ -f ${COMPILE_LOGFILE} -a ! -w ${COMPILE_LOGFILE} ]; then
/bin/rm -f ${COMPILE_LOGFILE}
fi
if make -f makefile_$1 >${COMPILE_LOGFILE} 2>&1; then
log_print "Compilation of $1 ${_libname} succeeded."
$_printf " done.\n"
ANY_LIB_COMPILED='y'
return 0
else
log_print "Compilation of $1 ${_libname} failed."
$_printf "\n${_LEFTSPACE}Compilation of CGAL_$1 failed.\n"
$_printf "${_LEFTSPACE}You will be shown a log now ...\n"
print_filled_line
wait_for_enter
$_cat ${COMPILE_LOGFILE} | ${PAGER:-$_cat}
write_buffer "\n"
return 1
fi
}
# make lib dir
make_lib_dir()
{
_libname=${CGAL_LIB_DIR}/`full_ostype`
if [ ! -d ${_libname} ]; then
$_mkdir ${_libname}
fi
if [ ! -w ${_libname} ]; then
echo
echo "ERROR: Cannot write to ${_libname}, exiting."
exit 1
fi
_libname=`$_basename ${_libname}`
}
# create appropriate dirs and makefiles
make_makefiles()
{
# generate directoryfile and makefile:
$_printf "${_LEFTSPACE}Generating Makefiles ..."
CGAL_MAKEFILE=${CGAL_MAKE_DIR}/makefile_${_libname}
generatemakefiles log_print
$_printf " done.\n"
}
write_menu_information()
{
clear_screen
print_filled_line
print_empty_line
print_headline "$1 CGAL ${CGAL_VERSION}"
print_filled_line
write_buffer "\n"
flush_buffer
print_os_setting
$_printf "\n"
}
lib_menu()
{
write_menu_information "Compiling"
make_lib_dir
make_makefiles
# build the libs:
cd ${CGAL_SRC_DIR}
if _do_compile lib; then
LIB_COMPILED='ok'
$_printf "`print_os_setting`" >>${INSTALL_RIS_LOGFILE}
$_printf \
"\n${_LEFTSPACE}----------------------------------------------------------\n" \
>>${INSTALL_RIS_LOGFILE}
_do_compile sharedlib
fi
write_buffer "\n"
print_filled_line
wait_for_enter
cd ${CGAL_DIR}
}
# ------------------------------------------------------------
# test menu
#
test_menu()
{
write_menu_information "Testing"
$_printf "${_LEFTSPACE}Updating `$_basename ${CGAL_TESTFILE}` ..."
_check_write ${CGAL_TESTFILE}
replace_line ${CGAL_TESTFILE} PLATFORM "PLATFORM=`full_ostype`; testplatform"
$_chmod 744 ${CGAL_TESTFILE}
$_printf " done.\n"
$_printf "${_LEFTSPACE}Starting ${CGAL_TESTFILE} ...\n"
cd ${CGAL_TEST_DIR}
cgal_test
cleanup_after_compile
log_print "Test completed."
print_filled_line
print_empty_line
print_headline "Test completed."
print_center_line "You will be shown a log now ..."
wait_for_enter
$_cat ${TEST_LOGFILE} | ${PAGER:-$_cat}
write_buffer "\n"
print_filled_line
cd ${CGAL_DIR}
wait_for_enter
return
}
# ------------------------------------------------------------
# main menu
#
main_menu()
{
while [ 0 ]; do
clear_screen
print_filled_line
print_headline "CGAL $CGAL_VERSION Installation Main Menu"
print_line "$_bold_on<C>$_bold_off Choose Compiler"
if [ -n "${COMPILER}" ]; then
print_line "$_bold_on<D>$_bold_off Setup Directories"
fi
if [ -n "${SETUP_COMPLETE}" ]; then
print_line "$_bold_on<L>$_bold_off Make Libraries"
fi
if [ -n "${LIB_COMPILED}" ]; then
print_line "$_bold_on<T>$_bold_off Run Test Suite"
fi
print_empty_line
print_line "$_bold_on<Q>$_bold_off Quit"
print_empty_line
print_empty_line
print_empty_line
print_filled_line
go_up_lines 3
print_prompt "Your choice: "
read KEY
case $KEY in
c|C)
compiler_menu;;
d|D)
if [ -n "${COMPILER}" ]; then
dir_menu
fi
;;
l|L)
if [ -n "${SETUP_COMPLETE}" ]; then
lib_menu
fi
;;
t|T)
if [ -n "${LIB_COMPILED}" ]; then
test_menu
fi
;;
q|Q)
if [ -z "${ANY_LIB_COMPILED}" ]; then
go_down_lines 1
print_filled_line
print_line \
"WARNING: You did not build any libs during this session."
else
go_down_lines 3
flush_buffer
$_cat ${INSTALL_RIS_LOGFILE}
print_filled_line
print_center_line "`$_basename $0` completed."
fi
print_center_line "If something went wrong, (or maybe also, if not:)"
print_center_line "have a look at `$_basename ${INSTALL_LOGFILE}`."
print_filled_line
flush_buffer
return;;
esac
done
}
# ------------------------------------------------------------
# MAIN BODY
# check command line options:
_tmp=`basename $0`
case $* in
*--help*|-h)
# help
echo "This is the install script for CGAL ${CGAL_VERSION}."
echo "Just type \"${_tmp}\" and follow the menus."
echo
echo "usage: ${_tmp} [--help | --version | -os | -ni comp]"
echo
echo " --help gives this message"
echo " --version prints ${_tmp} version number"
echo " -os prints architecture/os"
echo " -ni comp runs the script in non-interactive mode"
echo " i.e. makefiles are generated for C++ compiler"
echo " specified by comp (full path, please)."
echo " For the rest you are on your own."
echo " (Have a look at the README file.)"
echo;;
*--version*|-V|-v)
# version
echo "This is ${_tmp} ${CGAL_INSTALL_VERSION}."
echo;;
*-os*)
# architecture/os key
_uname=uname
guess_os echo;;
*-ni*)
# non interactive mode:
echo "---------------------------------------------------"
echo "running non interactive mode ..."
shift
# check for spaces
case $* in
*" "*)
echo
echo "ERROR: Too many arguments, exiting."
echo "Try: `basename $0` --help"
exit 1;;
*)
INSTALL_LOGFILE_REDIRECTION=''
echo "---------------------------------------------------"
echo "locating utilities ..."
_check_for_sysutil printf y
check_for_utils
echo "---------------------------------------------------"
guess_os echo
_tmp=`${_basename} $* 2>/dev/null`
if [ -z "${_tmp}" ]; then
echo
echo "ERROR: basename returned empty string, exiting."
exit 1
elif [ -z "$*" ]; then
echo
echo "ERROR: Missing argument, exiting."
echo "Try: `basename $0` --help"
exit 1
elif [ ! -x $* ]; then
echo
echo "ERROR: Cannot execute $*, exiting."
echo "Try: `basename $0` --help"
exit 1
fi
COMPILER="`compiler_description ${_tmp}`"
compute_compiler_version "$*"
echo "compiler is \"${COMPILER}\"."
set_ostype
echo "CGAL_OS_COMPILER is \"${CGAL_OS_COMPILER}\"."
echo "---------------------------------------------------"
echo "creating directories and makefiles ..."
# all four combinations
make_lib_dir
# create the makefiles
CGAL_MAKEFILE=${CGAL_MAKE_DIR}/makefile_${_libname}
generatemakefiles echo
LEDA_EXT='_LEDA'
make_lib_dir
GCC_RTTI_PATCH_EXT='_rtti'
make_lib_dir
LEDA_EXT=''
make_lib_dir
;;
esac
;;
*)
# start interactive part
echo "initializing"
init_logfiles
$_printf "."
check_for_utils
$_printf "."
check_conf_dir
$_printf "."
set_expr
$_printf "."
set_menu_lines
$_printf "."
set_terminal_variables
$_printf "."
search_for_compilers
$_printf "."
# if there is only one compiler on this system,
# choose it
if [ ${_COMPILER_NUMBER} = 2 ]; then
log_print "Detected only one compiler, choosing it."
_set_compiler 1
_choose_compiler
$_printf "."
fi
main_menu
;;
esac