mirror of https://github.com/CGAL/cgal
5418 lines
157 KiB
Bash
Executable File
5418 lines
157 KiB
Bash
Executable File
#!/bin/sh
|
||
# ---------------------------------------------------------------------
|
||
# The CGAL Installation Script
|
||
# ---------------------------------------------------------------------
|
||
# $Id$
|
||
# ---------------------------------------------------------------------
|
||
#
|
||
# Copyright (c) 1997-2007 Utrecht University (The Netherlands),
|
||
# ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||
# INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||
# (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||
# and Tel-Aviv University (Israel). All rights reserved.
|
||
#
|
||
# This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||
# modify it under the terms of the GNU Lesser General Public License as
|
||
# published by the Free Software Foundation; version 2.1 of the License.
|
||
# See the file LICENSE.LGPL distributed with CGAL.
|
||
#
|
||
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||
#
|
||
# $URL$
|
||
# $Id$
|
||
# $Date$
|
||
#
|
||
# Author(s): various
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# some important global variables
|
||
# ---------------------------------------------------------------------
|
||
|
||
# ---------------------------------------------
|
||
# CGAL specific:
|
||
|
||
# ---------------------------------------------
|
||
CGAL_VERSION="version_to_be_determined"
|
||
# ---------------------------------------------
|
||
CGAL_INSTALL_CGAL="`basename \"${0}\"`"
|
||
# ---------------------------------------------
|
||
CGAL_INSTALL_VERSION='$Revision$'
|
||
# ---------------------------------------------
|
||
CGAL_DIR="$PWD"
|
||
# ---------------------------------------------
|
||
CGAL_INSTALL_DIR=''
|
||
|
||
# ---------------------------------------------
|
||
# set to non-empty, if you want to view the logs of
|
||
# ALL failed tests
|
||
INSTALL_VERBOSE=''
|
||
|
||
# ---------------------------------------------
|
||
# try to autofind as many 3rd party libraries as possible.
|
||
# Set to empty, if you want to disable autofinding.
|
||
CGAL_AUTOFIND_PKGS=y
|
||
|
||
# ---------------------------------------------
|
||
# prefix of CGAL compiler specific configuration flags
|
||
CGAL_CONFIG_PREFIX='CGAL_CFG_'
|
||
|
||
# ---------------------------------------------
|
||
# set to non-empty string, if MIPSPRO 64 compiler
|
||
# is to be supported
|
||
SUPPORT_MIPSPRO_64='y'
|
||
|
||
# ---------------------------------------------
|
||
# the directory of an existing CGAL installation
|
||
# we want to upgrade
|
||
UPGRADE_FROM=''
|
||
|
||
# ---------------------------------------------
|
||
# the config name we want to [re]build one
|
||
BUILD_ONE_CONFIG=''
|
||
|
||
# ---------------------------------------------
|
||
# set to empty to disable building of shared libraries.
|
||
ENABLE_SHARED='y'
|
||
|
||
# ---------------------------------------------
|
||
# set to empty to disable building of static libraries.
|
||
ENABLE_STATIC='y'
|
||
|
||
# ---------------------------------------------
|
||
# indicate whether there is a "long name problem" on the current platform
|
||
LONG_NAME_PROBLEM=''
|
||
|
||
# ---------------------------------------------
|
||
# Support for 3rd party Libraries: (feature tags)
|
||
SUPPORT_FEATURES=''
|
||
|
||
# ---------------------------------------------
|
||
# Support for 3rd party Libraries: (package tags)
|
||
SUPPORT_PKGS=''
|
||
# reverse list
|
||
R_SUPPORT_PKGS=''
|
||
|
||
# ---------------------------------------------
|
||
# Required support options
|
||
SUPPORT_REQUIRED='BOOST'
|
||
|
||
# ---------------------------------------------------------------------
|
||
# internal variables
|
||
# ---------------------------------------------------------------------
|
||
|
||
# width of menu screen / 10 (in characters)
|
||
_MENU_WIDTH=6
|
||
|
||
# left indentation of menu
|
||
_LEFTSPACE=' '
|
||
|
||
# installation logfile (verbose)
|
||
INSTALL_LOGFILE_REDIRECTION='>/dev/null'
|
||
|
||
|
||
# compiler to be used
|
||
# This is a string defined as follows:
|
||
# <BASENAME>@<DESCRIPTION>@<CC_EXECUTABLE>@<CXX_EXECUTABLE>@<VERSION_ID>@<CUSTOM_TAG>
|
||
# The components can be accessed using the functions:
|
||
# compiler_basename, (extended_)compiler_description,
|
||
# c_compiler_bin, compiler_bin and compiler_version
|
||
# The strings are set in search_for_compilers resp. compiler_absolute
|
||
COMPILER=''
|
||
|
||
# indicates whether the compiler is supported by CGAL or not
|
||
# empty <=> unsupported
|
||
CGAL_SUPPORT_COMPILER=''
|
||
|
||
# string defining OS and compiler
|
||
# (used for naming makefiles and lib directories)
|
||
CGAL_OS_COMPILER=''
|
||
|
||
# this is woven into CGAL_OS_COMPILER; allows to run different installations
|
||
# for the same os/compiler combination
|
||
CUSTOM_OSTYPE_TAG=''
|
||
|
||
# can we start building the libs?
|
||
SETUP_COMPLETE=''
|
||
|
||
# has compiler config test been run ('' - no, 'y' - yep)
|
||
CONFIG_TEST_PASSED=''
|
||
|
||
# does there exist a CGALlib for this compiler?
|
||
LIB_COMPILED=''
|
||
|
||
# Was there any successfull compile run during this session?
|
||
ANY_LIB_COMPILED=''
|
||
|
||
# custom options for compiler/linker:
|
||
CUSTOM_CXXFLAGS=''
|
||
CUSTOM_LDFLAGS=''
|
||
|
||
# LGPL License header to be used in some generated files.
|
||
LGPL_LICENSE_HEADER=\
|
||
"// Copyright (c) 1996-2004 Utrecht University (The Netherlands),
|
||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||
// and Tel-Aviv University (Israel). All rights reserved.
|
||
//
|
||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||
// modify it under the terms of the GNU Lesser General Public License as
|
||
// published by the Free Software Foundation; version 2.1 of the License.
|
||
// See the file LICENSE.LGPL distributed with CGAL.
|
||
//
|
||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE."
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# How to use this script
|
||
# ---------------------------------------------------------------------
|
||
|
||
print_usage_information()
|
||
{
|
||
${_printf} "%s\n" \
|
||
"Usage: ${CGAL_INSTALL_CGAL} [OPTION]"
|
||
${_printf} "\n%s\n" \
|
||
"Basic options:
|
||
--help gives this message.
|
||
--prefix <dir>
|
||
Specify an installation directory.
|
||
--disable-shared
|
||
Do not build shared libraries, only the static archives.
|
||
--disable-static
|
||
Do not build static archives, only the shared libraries.
|
||
"
|
||
|
||
${_printf} "%s\n" \
|
||
"Environment variables:
|
||
CXX Use \$CXX as the compiler instead of searching for one.
|
||
CPPFLAGS,CXXFLAGS
|
||
The values of these two environment variables are combined
|
||
and passed as command line arguments to the compiler.
|
||
LDFLAGS \$LDFLAGS are passed as command line arguments to the linker.
|
||
|
||
The environment variables can be overridden using
|
||
--CXX <comp>,
|
||
--CXXFLAGS <flags> (for both CPPFLAGS and CXXFLAGS) and
|
||
--LDFLAGS <flags>.
|
||
"
|
||
|
||
${_printf} "%s" \
|
||
"External library management options:
|
||
--without-autofind
|
||
Disable support for all external dependencies not explicitly
|
||
specified using --with-PACKAGE.
|
||
--with-PACKAGENAME
|
||
When using --without-autofind, use package PACKAGENAME.
|
||
|
||
PACKAGENAME is one of"
|
||
for i in ${SUPPORT_PKGS}; do
|
||
${_printf} " %s" "$i"
|
||
done
|
||
|
||
${_printf} "\n\n%s\n" \
|
||
"Advanced options:
|
||
--interactive or -i
|
||
runs the script in interactive mode. Interactive mode
|
||
can only be used for in place installations (ones where
|
||
the library is left in the lib directory below install_cgal)
|
||
except on Mac OS.
|
||
--PACKAGENAME_INCL_DIR <dir>
|
||
Add \"-I<dir>\" to CPPFLAGS. The valid PACKAGENAMEs in this
|
||
context are BOOST, BOOST_PROGRAM_OPTIONS, BOOST_BIMAP, X11,
|
||
GMP, GMPXX, MPFR, ZLIB, BLAS, LAPACK, LEDA, LEDAWIN, OPENGL,
|
||
QT, TAUCS
|
||
--PACKAGENAME_LIB_DIR <dir>
|
||
Add \"-L<dir>\" to LDFLAGS.
|
||
--upgrade <dir> or -u <dir>
|
||
runs the script in upgrade mode. Use this option, if
|
||
you upgrade from a previously installed CGAL and supply
|
||
the directory where the old source is found on your
|
||
system. The config/install files are copied from there.
|
||
--build-all
|
||
builds libraries for all compilers for which a
|
||
config/install file exists.
|
||
--rebuild-all
|
||
(re)builds compiler configuration files and libraries
|
||
for all compilers for which a config/install file exists.
|
||
--build <config>
|
||
builds libraries for the compiler specified by its
|
||
configuration file config/install/<config>.
|
||
--rebuild <config>
|
||
(re)builds the compiler configuration file and libraries
|
||
for the compiler specified by its configuration file
|
||
config/install/<config>.
|
||
--ostype_tag <tag>
|
||
Add this tag to the architecture/os/compiler specification.
|
||
-os <compiler>
|
||
prints the identifier for the configuration which uses
|
||
the specified compiler.
|
||
--CGAL_DIR <dir>
|
||
Specify an explicit path to use for the CGAL
|
||
directory. This is useful if \`pwd\` does not return
|
||
the desired path to the CGAL source.
|
||
--verbose Give report for each test that fails
|
||
(not generally recommended).
|
||
"
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# exit with error message "$*"
|
||
# ---------------------------------------------------------------------
|
||
exit_on_error()
|
||
{
|
||
${_printf} "\n%s\n" "==================================================="
|
||
${_printf} "%s" "ERROR: ${1}"
|
||
shift
|
||
while [ ${#} -gt 0 ]; do
|
||
${_printf} "\n\t%s" "${1}"
|
||
shift
|
||
done
|
||
${_printf} "%s\n" ", exiting."
|
||
${_printf} "%s\n" "==================================================="
|
||
exit 1
|
||
}
|
||
|
||
warn_deprecated()
|
||
{
|
||
${_printf} "\n%s\n" "Warning: Option ${1} is deprecated and ignored."
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# system related functions:
|
||
# ---------------------------------------------------------------------
|
||
|
||
# print the value of variable $1
|
||
value_of()
|
||
{
|
||
_value="`eval ${_printf} \"'$'$1\"`"
|
||
eval "${_printf} \"%s\" \"${_value}\""
|
||
}
|
||
|
||
# print the value of variable $1, except for the first occurrence
|
||
# of the regexps $2 - $n
|
||
value_of_without()
|
||
{
|
||
_tmp="`value_of \"$1\"`"
|
||
while [ $# -gt 1 ]; do
|
||
_tmp="`${_printf} \"${_tmp}\n\" | ${_sed} \"s/${2}//1\"`"
|
||
shift
|
||
done
|
||
${_printf} "%s" "${_tmp}"
|
||
}
|
||
|
||
# (/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()
|
||
{
|
||
for i in `echo ${PATH} | ${_sed} 's/ //g' | ${_awk} 'BEGIN {RS=":"}{print $0}'`
|
||
do
|
||
i=`echo $i | ${_sed} 's// /g'`
|
||
if [ -x "${i}/$1" -a ! -d "${i}/$1" ]; then
|
||
echo ${i}/$1
|
||
return
|
||
fi
|
||
done
|
||
}
|
||
|
||
# basename/dirname is somewhat nasty when having options like:
|
||
# /<path>/<cmd> -<opt1> ... -<optn>
|
||
_real_basename()
|
||
{
|
||
${_basename} "`${_printf} \"${*}\" | ${_awk} '{ printf \"%s\",$1; for (i=2; i<=NF; ++i) if (substr($i,0,1) != \"-\") printf \"%s\",$i }'`"
|
||
}
|
||
|
||
_real_dirname()
|
||
{
|
||
${_dirname} "`${_printf} \"${*}\" | ${_awk} '{ printf \"%s\",$1; for (i=2; i<=NF; ++i) if (substr($i,0,1) != \"-\") printf \"%s\",$i }'`"
|
||
}
|
||
|
||
_real_options()
|
||
{
|
||
${_printf} "${*}" | ${_awk} '{ for (i=2; i<=NF; ++i) if (substr($i,0,1) == "-") printf "%s",$i }'
|
||
}
|
||
|
||
EXTRABUFFER='essai'
|
||
# auxiliary function for log_to_file_and_extra_buffer
|
||
save_to_extra_buffer()
|
||
{
|
||
_read
|
||
${_printf} "${KEY}\n" >> ${EXTRA_INSTALL_LOGFILE}
|
||
${_printf} "${KEY}\n"
|
||
}
|
||
|
||
flush_extra_buffer()
|
||
{
|
||
${_cat} "${EXTRA_INSTALL_LOGFILE}" >> "${INSTALL_LOGFILE}"
|
||
${_rm} -f "${EXTRA_INSTALL_LOGFILE}"
|
||
}
|
||
|
||
# log_print writes to logfile only
|
||
log_to_file()
|
||
{
|
||
INSTALL_LOGFILE_REDIRECTION=">>\"${INSTALL_LOGFILE}\""
|
||
}
|
||
|
||
# log_print writes to logfile only
|
||
log_to_file_and_extra_buffer()
|
||
{
|
||
INSTALL_LOGFILE_REDIRECTION="|save_to_extra_buffer | ${_tee} -a >>\"${INSTALL_LOGFILE}\""
|
||
}
|
||
|
||
# log_print writes to screen only
|
||
log_to_screen()
|
||
{
|
||
INSTALL_LOGFILE_REDIRECTION="| print_with_indent"
|
||
}
|
||
|
||
# log_print writes to both logfile and screen
|
||
log_to_file_and_screen()
|
||
{
|
||
INSTALL_LOGFILE_REDIRECTION="|print_with_indent | ${_tee} -a \"${INSTALL_LOGFILE}\""
|
||
}
|
||
|
||
log_print()
|
||
{
|
||
eval "${_printf} \"%s\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)
|
||
# (if $2 is 'q', do not warn if it is not existent)
|
||
_check_for_util()
|
||
{
|
||
_tmp="`${_which} $1`"
|
||
if [ -x "${_tmp}" ]; then
|
||
eval "${3:-_$1}=\"${_tmp}\""
|
||
elif [ "$2" = "y" ]; then
|
||
exit_on_error "Couldn't find \"${1}\""
|
||
else
|
||
[ "$2" = "q" ] || log_print "WARNING: Couldn't find $1."
|
||
return 1
|
||
fi
|
||
log_print "$1 is `value_of ${3:-_$1}`."
|
||
return 0
|
||
}
|
||
|
||
# same as _check_for_util above except that it searches
|
||
# in several directories first.
|
||
_check_for_sysutil()
|
||
{
|
||
if [ -n "`value_of NO_${3:-$1}`" ]; then
|
||
log_print "NO_${3:-$1} under effect."
|
||
return 1
|
||
fi
|
||
|
||
if [ -n "`value_of USE_${3:-$1}`" ]; then
|
||
eval "${3:-_$1}=\"`value_of USE_${3:-$1}`\""
|
||
log_print "USE_${3:-$1} under effect: $1 is set to `value_of ${3:-_$1}`."
|
||
return 0
|
||
fi
|
||
|
||
_tmp2=''
|
||
for _path in ${POSIX_UTILITIES_PATH} /bin /usr/bin /opt/sfw/bin /usr/sfw/bin; do
|
||
if [ -x "${_path}/$1" ]; then
|
||
eval "${3:-_$1}=\"${_path}/$1\""
|
||
_tmp2=${_path}
|
||
break
|
||
fi
|
||
done
|
||
if [ -z "${_tmp2}" ]; then
|
||
_check_for_util "${@}"
|
||
return $?
|
||
fi
|
||
log_print "$1 is `value_of ${3:-_$1}`."
|
||
return 0
|
||
}
|
||
|
||
# exit, if we have no read permission for $1
|
||
_check_read()
|
||
{
|
||
if [ ! -r "$1" ]; then
|
||
exit_on_error "Cannot read \"$1\""
|
||
fi
|
||
}
|
||
|
||
# exit, if we have no execute permission for $1
|
||
_check_execute()
|
||
{
|
||
if [ ! -x "$1" ]; then
|
||
exit_on_error "Cannot execute \"$1\""
|
||
fi
|
||
}
|
||
|
||
# exit, if we have no write permission for $1
|
||
_check_write()
|
||
{
|
||
if [ ! -w "$1" ]; then
|
||
exit_on_error "Cannot write to \"$1\""
|
||
fi
|
||
}
|
||
|
||
# exit, if there is no directory $1 or it is not readable and executable
|
||
_check_dir_exists()
|
||
{
|
||
if [ ! -d "$1" ]; then
|
||
exit_on_error "Directory \"$1\" does not exist"
|
||
fi
|
||
_check_read "${1}"
|
||
_check_execute "${1}"
|
||
}
|
||
|
||
# check, whether there is a directory $1 (if not create it)
|
||
# and make sure, you have read/write/execute permission
|
||
_check_dir_exists_create()
|
||
{
|
||
if [ ! -d "${1}" ]; then
|
||
log_print "WARNING: Directory ${1} does not exist, it will be created."
|
||
${_mkdir} -p "${1}"
|
||
fi
|
||
_check_read "${1}"
|
||
_check_write "${1}"
|
||
_check_execute "${1}"
|
||
}
|
||
|
||
# check some very basic stuff
|
||
initial_check()
|
||
{
|
||
_check_dir_exists "${CGAL_DIR}"
|
||
_check_write "${CGAL_DIR}"
|
||
for i in "${TMP_LOGFILE}" "${TMPTMP_LOGFILE}" "${TMP_CXX_FILE}" "${INSTALL_LOGFILE}"; do
|
||
if [ -f "${i}" ]; then
|
||
${_rm} -f "${i}"
|
||
fi
|
||
done
|
||
init_logfiles
|
||
}
|
||
|
||
parse_support_options()
|
||
{
|
||
# set SUPPORT_FEATURES and SUPPORT_PKGS
|
||
|
||
# first cleanup
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
eval "SUPPORT_PKG_${i}=''"
|
||
eval "PROVIDE_PKG_${i}=''"
|
||
done
|
||
SUPPORT_FEATURES=''
|
||
SUPPORT_PKGS=''
|
||
R_SUPPORT_PKGS=''
|
||
|
||
#INSTALL_LOGFILE_REDIRECTION_BAK="${INSTALL_LOGFILE_REDIRECTION}"
|
||
#log_to_file_and_screen
|
||
_no_indent
|
||
log_print "Parsing support specfiles for 3rd party libraries:"
|
||
_set_indent
|
||
${_printf} "%s" "Loading support for 3rd party libraries..."
|
||
#INSTALL_LOGFILE_REDIRECTION="${INSTALL_LOGFILE_REDIRECTION_BAK}"
|
||
|
||
# read all specfiles at once
|
||
_tmp="`${_awk} -f "${CGAL_SUPPORT_DIR}"/parse_files.awk "${CGAL_SUPPORT_DIR}"/S*`"
|
||
eval "${_tmp}"
|
||
for i in ${SUPPORT_PKGS}; do
|
||
log_print "${i}"
|
||
#${_printf} "%s" "${i}, "
|
||
# is PROVIDES already among SUPPORT_FEATURES?
|
||
for j in `value_of "${i}_PROVIDES"`; do
|
||
if [ -z "`value_of \"SUPPORT_PKG_${j}\"`" ]; then
|
||
SUPPORT_FEATURES="${SUPPORT_FEATURES} ${j}"
|
||
eval "PROVIDE_PKG_${j}=''"
|
||
eval "${j}_INCL_DIR=''"
|
||
eval "${j}_LIB_DIR=''"
|
||
eval "${j}_VERSION=''"
|
||
fi
|
||
_append_to "SUPPORT_PKG_${j}" "${i}" " "
|
||
done
|
||
eval "${i}_SUPPORT=''"
|
||
eval "${i}_TEST_PASSED=''"
|
||
eval "${i}_REQUIRED_BY=''"
|
||
done
|
||
for i in ${SUPPORT_PKGS}; do
|
||
for j in `value_of "${i}_REQUIRES"`; do
|
||
_append_to "${j}_REQUIRED_BY" "${i}" " "
|
||
done
|
||
done
|
||
${_printf} "%s\n" "done."
|
||
}
|
||
|
||
# fetch CGAL version id from ${CGAL_DIR}/VERSION
|
||
get_cgal_version()
|
||
{
|
||
# this file is assumed to contain one line being the version number,
|
||
# without final carriage return
|
||
FILE="${CGAL_DIR}/VERSION"
|
||
_check_read "${FILE}"
|
||
CGAL_VERSION="`${_cat} "${FILE}"`"
|
||
log_print "CGAL version is ${CGAL_VERSION}."
|
||
}
|
||
|
||
# initialize the logfiles
|
||
init_logfiles()
|
||
{
|
||
log_to_file
|
||
_check_printf
|
||
${_printf} "%s\n" \
|
||
"----------------------------------------------------------" \
|
||
>${INSTALL_LOGFILE}
|
||
log_print "log of $0 $ARGS"
|
||
log_print "called by $LOGNAME on `date`"
|
||
log_print "CGAL_DIR is ${CGAL_DIR}"
|
||
log_print "----------------------------------------------------------"
|
||
${_printf} "${_LEFTSPACE}%s\n" \
|
||
"----------------------------------------------------------" \
|
||
>"${INSTALL_RIS_LOGFILE}"
|
||
${_printf} "%s\n" \
|
||
"${_LEFTSPACE}You built CGAL on:" \
|
||
>>"${INSTALL_RIS_LOGFILE}"
|
||
${_printf} "${_LEFTSPACE}%s\n" \
|
||
"----------------------------------------------------------" \
|
||
>>"${INSTALL_RIS_LOGFILE}"
|
||
log_print "This is ${CGAL_INSTALL_CGAL} version ${CGAL_INSTALL_VERSION}."
|
||
}
|
||
|
||
# check ${CGAL_INSTALL_CONF_DIR}: create it, if not existent
|
||
check_conf_dir()
|
||
{
|
||
_check_dir_exists "${CGAL_MAKE_DIR}"
|
||
_check_dir_exists "${CGAL_SRC_DIR}"
|
||
_check_dir_exists "${CGAL_INCL_DIR}"
|
||
_check_dir_exists_create "${CGAL_INCL_CONF_DIR}"
|
||
_check_dir_exists "${CGAL_LIB_DIR}"
|
||
_check_dir_exists "${CGAL_CONF_DIR}"
|
||
_check_dir_exists "${CGAL_SUPPORT_DIR}"
|
||
_check_dir_exists "${CGAL_TEST_CONF_DIR}"
|
||
_check_dir_exists_create "${CGAL_INSTALL_CONF_DIR}"
|
||
}
|
||
|
||
# print the version number of this file
|
||
# (in an RCS Revision string this is field nr two)
|
||
_install_version_number()
|
||
{
|
||
${_printf} "%s\n" "${CGAL_INSTALL_VERSION}" | ${_awk} '{print $2}'
|
||
}
|
||
|
||
# on some systems, like FreeBSD, printf handles options, that's why
|
||
# the first options should be --
|
||
#
|
||
# printf to use on some systems
|
||
printf_dash_dash()
|
||
{
|
||
${_printf_bin} -- "$@"
|
||
}
|
||
|
||
# check if printf handles options
|
||
# $1 indicates verbosity
|
||
_check_printf()
|
||
{
|
||
if [ x`${_printf} "-I%s" CGAL 2>/dev/null` != "x-ICGAL" ]; then
|
||
_printf_bin=${_printf}
|
||
_printf=printf_dash_dash
|
||
if [ x`${_printf} "-I%s" CGAL 2>/dev/null` != "x-ICGAL" ]; then
|
||
exit_on_error "Cannot find a working printf."
|
||
fi
|
||
if [ -n "$1" ]; then
|
||
log_print "REMARK: printf handles options: printf='printf --'"
|
||
fi
|
||
fi
|
||
}
|
||
|
||
# check, if all needed utility programs are available
|
||
# (they should be on a unix system, but ...)
|
||
check_for_utils()
|
||
{
|
||
log_print "Looking for POSIX utilities..."
|
||
${_printf} "%s" "Looking for POSIX utilities..."
|
||
|
||
_which=real_which
|
||
|
||
_check_for_util getconf n
|
||
if [ -n "${_getconf}" ]; then
|
||
# Set ${GETCONF} to /bin/true if you do not want to use it.
|
||
POSIX_UTILITIES_PATH="`${GETCONF:-${_getconf}} PATH`"
|
||
if [ -n "${POSIX_UTILITIES_PATH}" ]; then
|
||
POSIX_UTILITIES_PATH="`echo ${POSIX_UTILITIES_PATH} | ${_sed} -e 's/:/ /g'`"
|
||
log_print "Path for Posix utilities: ${POSIX_UTILITIES_PATH}"
|
||
fi
|
||
fi
|
||
|
||
_check_for_sysutil basename y
|
||
_check_for_sysutil dirname y
|
||
_check_for_sysutil uname y
|
||
# _check_for_sysutil printf y
|
||
|
||
_check_printf $INSTALL_VERBOSE
|
||
|
||
_check_for_sysutil cat y
|
||
_check_for_sysutil touch y
|
||
_check_for_sysutil cp y
|
||
_check_for_sysutil mv y
|
||
_check_for_sysutil rm y
|
||
_check_for_sysutil ln y
|
||
_check_for_sysutil ls y
|
||
# ls should have a -1 option to list files line-by-line
|
||
if ${_ls} -1 >/dev/null 2>&1; then
|
||
_lsone="${_ls} -1"
|
||
else
|
||
_lsone="${_ls}"
|
||
fi
|
||
_check_for_sysutil chmod y
|
||
_check_for_sysutil mkdir y
|
||
_check_for_sysutil sed y
|
||
_check_for_sysutil grep y
|
||
_check_for_sysutil tr y
|
||
_check_for_sysutil awk y
|
||
_check_for_sysutil tee y
|
||
_check_for_sysutil find y
|
||
_check_for_sysutil tar y
|
||
|
||
# test whether sed respects newline (I have seen at least one
|
||
# Darwin version that does not...)
|
||
case `${_printf} '1\n2\n' | ${_sed} '/^1/c\\
|
||
2'` in
|
||
22) log_print "sed does not respect newline."
|
||
_EXTRA_NEWLINE='
|
||
';;
|
||
*) log_print "sed respects newline."
|
||
_EXTRA_NEWLINE='';;
|
||
esac
|
||
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
if [ -n "${PAGER}" -a ! -x "${PAGER}" ]; then
|
||
_check_for_sysutil `$_basename "${PAGER}"` y
|
||
PAGER=`eval "echo \$\_$PAGER"`
|
||
PAGER=`eval "echo ${PAGER}"`
|
||
fi
|
||
else
|
||
PAGER="${_cat}"
|
||
fi
|
||
|
||
${_printf} "%s\n" " done."
|
||
}
|
||
|
||
# tests if $1 is a path to an executable GNU/make.
|
||
# teturn 1 if not.
|
||
test_gmake()
|
||
{
|
||
if [ -z "`$MAKE -v | ${_grep} GNU`" ]; then
|
||
return 1;
|
||
fi
|
||
return 0;
|
||
}
|
||
|
||
# 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 | ${_sed} 's/_/-/g' 2>/dev/null`
|
||
if [ -z "${_tmp}" -o "${_tmp}" = 'unknown' -o "`${_uname}`" = "Linux" ]; then
|
||
_tmp=`${_uname} -m | ${_sed} 's/_/-/g' 2>/dev/null`
|
||
fi
|
||
if [ -n "${_tmp}" ]; then
|
||
_tmp=${_tmp}"_"
|
||
else
|
||
$1 "WARNING: Could not determine architecture."
|
||
fi
|
||
_tmpx="`${_uname} -s | ${_sed} 's/_//g'`"
|
||
# if there is already a minus in `uname -s` (as, e.g., on Cygwin)
|
||
# we don't append `uname -r`
|
||
case "${_tmpx}" in
|
||
*-*) SYST="${_tmp}${_tmpx}";;
|
||
*) SYST="${_tmp}${_tmpx}-`${_uname} -r | ${_awk} 'BEGIN {FS=\".\"}{printf \"%d.%d\n\",$1,$2}' | ${_sed} -e 's/(.*)//g' -e 's/_/-/g' | ${_awk} '{print $1}'`";;
|
||
esac
|
||
$1 "OS is \"${SYST}\"."
|
||
}
|
||
|
||
# the old version, used for transition...
|
||
# to be removed at some point
|
||
old_guess_os()
|
||
{
|
||
_tmp=`${_uname} -p | ${_sed} 's/_/-/g' 2>/dev/null`
|
||
if [ -z "${_tmp}" -o "${_tmp}" = 'unknown' -o "`${_uname}`" = "Linux" ]; then
|
||
_tmp=`${_uname} -m | ${_sed} 's/_/-/g' 2>/dev/null`
|
||
fi
|
||
if [ -n "${_tmp}" ]; then
|
||
_tmp=${_tmp}"_"
|
||
fi
|
||
OLD_SYST="${_tmp}`${_uname} -s | ${_sed} 's/_//g'`-`${_uname} -r | ${_sed} -e 's/(.*)//g' -e 's/_/-/g' | ${_awk} '{print $1}'`"
|
||
}
|
||
|
||
# -------------------------------------------------------
|
||
# several directories depend on the setting of CGAL_DIR
|
||
# we put these into a function that can be called in case
|
||
# that CGAL_DIR is changed later
|
||
# -------------------------------------------------------
|
||
set_dirs_dependant_on_cgal_dir()
|
||
{
|
||
CGAL_EXAMPLE_DIR="${CGAL_DIR}/examples"
|
||
CGAL_INCL_DIR="${CGAL_DIR}/include"
|
||
CGAL_INCL_CONF_DIR="${CGAL_INCL_DIR}/CGAL/config"
|
||
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_SUPPORT_DIR="${CGAL_CONF_DIR}/support"
|
||
CGAL_INSTALL_CONF_DIR="${CGAL_CONF_DIR}/install"
|
||
CGAL_TEST_CONF_DIR="${CGAL_CONF_DIR}/testfiles"
|
||
CGAL_TESTFILE="${CGAL_TEST_DIR}/run_testsuite"
|
||
|
||
# ---------------------------------------------
|
||
# logfile for testsuite:
|
||
TEST_LOGFILE="${CGAL_TEST_DIR}/error.txt"
|
||
|
||
# ---------------------------------------------
|
||
# internal variables
|
||
# ---------------------------------------------
|
||
|
||
# installation logfile (verbose)
|
||
INSTALL_LOGFILE_BASE="${CGAL_DIR}/install.log"
|
||
INSTALL_LOGFILE=${INSTALL_LOGFILE_BASE}
|
||
|
||
# installation logfile (only completed compile/test runs)
|
||
# (Really Important Stuff)
|
||
INSTALL_RIS_LOGFILE="${CGAL_DIR}/install.completed"
|
||
|
||
# compilation logfile
|
||
COMPILE_LOGFILE="${CGAL_DIR}/compile.log"
|
||
|
||
# logfile for temporary use (e.g. compiler tests)
|
||
TMP_LOGFILE="${CGAL_DIR}/tmptmp.log"
|
||
# yet another logfile for temporary use (e.g. compiler tests)
|
||
TMPTMP_LOGFILE="${CGAL_DIR}/tmptmptmp.log"
|
||
|
||
# temporary file for confidence tests
|
||
TMP_CXX_FILE=./tmp_test
|
||
}
|
||
|
||
# initialize once
|
||
set_dirs_dependant_on_cgal_dir
|
||
|
||
# -------------------------------------------------------------------
|
||
# compiler related functions:
|
||
# -------------------------------------------------------------------
|
||
|
||
# return the cmdline-switch to add directory $1
|
||
# to the runtime linker path
|
||
rpath_directive()
|
||
{
|
||
if [ -n "${RUNTIME_LINKER_FLAG}" -a -n "${1}" ]; then
|
||
${_printf} "%s" "${RUNTIME_LINKER_FLAG}"
|
||
os_path "${1}"
|
||
fi
|
||
}
|
||
|
||
# --------------------------------------------------------------------
|
||
# Now the new function to create the include makefile
|
||
# for compiler/os combination CGAL_OS_COMPILER
|
||
set_compiler_flags()
|
||
{
|
||
# set some compiler/os specific variables
|
||
|
||
# defaults:
|
||
ADDITIONAL_CXXFLAGS=""
|
||
ADDITIONAL_LDFLAGS=""
|
||
LONG_NAME_PROBLEM_CXXFLAGS=""
|
||
LONG_NAME_PROBLEM_LDFLAGS=""
|
||
CGAL_LIBS_OPTFLAGS="-O2"
|
||
CGAL_LIB_CXXFLAGS=""
|
||
CGAL_LIB_LDFLAGS=""
|
||
CGAL_STATIC_LIB_CREATE="${CGAL_STATIC_LIB_CREATE:-ar cr ''}"
|
||
CGAL_OBJ_PREFIX=""
|
||
CGAL_SHARED_LIB_CXXFLAGS="-fPIC"
|
||
CGAL_SHARED_LIB_LDFLAGS=
|
||
CGAL_SHARED_LIB_CREATE="\$(CGAL_CXX) -shared"
|
||
CGAL_SHARED_LIB_INSTALL_NAME=""
|
||
CGAL_SHARED_LIB_SONAME=""
|
||
CGAL_SHARED_LIBNAME_WITH_SOVERSION="\$(CGAL_SHARED_LIBNAME)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOMAJOR="\$(CGAL_SHARED_LIBNAME)"
|
||
RUNTIME_LINKER_FLAG=''
|
||
PRINT_STACKTRACE_PROGRAM="gdb"
|
||
WINDOWS_COMPILER=""
|
||
CYGWIN_COMPILER=""
|
||
DARWIN_COMPILER=""
|
||
SUNCC_COMPILER=""
|
||
SUFFIX_LIST=
|
||
OBJ_EXT=".o"
|
||
OBJ_OPT="-c"
|
||
LIB_SUFFIX=""
|
||
CGAL_STATIC_LIBNAME="lib\$(LIB_NAME_BASE).a"
|
||
CGAL_SHARED_LIBNAME="lib\$(LIB_NAME_BASE)\$(CGAL_SHARED_LIB_EXT)"
|
||
CGAL_SHARED_LIB_EXT=".so"
|
||
REMOVE_EXT_LIST=".o"
|
||
LIB_OPT=" -l"
|
||
LIBPATH_OPT="-L"
|
||
DEBUG_OPT="-g"
|
||
EXE_OPT="-o "
|
||
SAVE_THE_BLANK="\$(SAVESTHEBLANK)"
|
||
EXE_EXT=""
|
||
MATH_LIB="m"
|
||
SEPARATE_LIBPATH=""
|
||
START_LD_OPT=""
|
||
CGAL_CXX="`compiler_bin`"
|
||
RANLIB="${RANLIB:-${_cat} >/dev/null}"
|
||
|
||
case ${CGAL_OS_COMPILER} in
|
||
*bcc32.exe*|*BCC32*)
|
||
#### settings Borland C++ compiler
|
||
ADDITIONAL_CXXFLAGS="-P -vi- -w-inl -DCGAL_NO_AUTOLINK"
|
||
CGAL_LIB_CXXFLAGS="-P"
|
||
CGAL_STATIC_LIB_CREATE="tlib /C /P512 ''"
|
||
CGAL_OBJ_PREFIX="+"
|
||
WINDOWS_COMPILER="y"
|
||
CYGWIN_COMPILER="y"
|
||
SUFFIX_LIST=".obj .exe"
|
||
OBJ_EXT=".obj"
|
||
LIB_SUFFIX=".lib"
|
||
REMOVE_EXT_LIST=".obj .tds"
|
||
LIB_OPT=""
|
||
DEBUG_OPT=""
|
||
EXE_OPT="-e"
|
||
SAVE_THE_BLANK=""
|
||
EXE_EXT=".exe"
|
||
CGAL_STATIC_LIBNAME="\$(LIB_NAME_BASE).lib"
|
||
MATH_LIB=""
|
||
SEPARATE_LIBPATH="y"
|
||
;;
|
||
*ICL*|*icl*)
|
||
#### settings Intel C++ compiler
|
||
WINDOWS_COMPILER="y"
|
||
CYGWIN_COMPILER="y"
|
||
ADDITIONAL_CXXFLAGS="-Op -TP -GR -EHsc -Zm900 -nologo -Zc:wchar_t -Zc:forScope -MD -DCGAL_NO_AUTOLINK"
|
||
ADDITIONAL_LDFLAGS="-nologo"
|
||
# CGAL_LIB_CXXFLAGS="-TP"
|
||
CGAL_STATIC_LIB_CREATE="LIB /OUT:"
|
||
CGAL_SHARED_LIB_CXXFLAGS=
|
||
CGAL_SHARED_LIB_CREATE=
|
||
SUFFIX_LIST=".obj .exe"
|
||
OBJ_EXT=".obj"
|
||
LIB_SUFFIX=".lib"
|
||
REMOVE_EXT_LIST=".obj"
|
||
LIB_OPT=""
|
||
LIBPATH_OPT="-LIBPATH:"
|
||
DEBUG_OPT="-Z7"
|
||
EXE_OPT="-Fe"
|
||
SAVE_THE_BLANK=""
|
||
EXE_EXT=".exe"
|
||
CGAL_STATIC_LIBNAME="\$(LIB_NAME_BASE).lib"
|
||
MATH_LIB=
|
||
START_LD_OPT="-link "
|
||
CGAL_LIBS_OPTFLAGS="-Od"
|
||
;;
|
||
*CL*|*cl*)
|
||
#### settings Microsoft Visual C++ compiler
|
||
WINDOWS_COMPILER="y"
|
||
CYGWIN_COMPILER="y"
|
||
ADDITIONAL_CXXFLAGS="-TP -GR -EHsc -Zm900 -nologo -MD -DCGAL_NO_AUTOLINK"
|
||
ADDITIONAL_LDFLAGS="-nologo"
|
||
# CGAL_LIB_CXXFLAGS="-TP"
|
||
CGAL_STATIC_LIB_CREATE="LIB /OUT:"
|
||
CGAL_SHARED_LIB_CXXFLAGS=
|
||
CGAL_SHARED_LIB_CREATE=
|
||
SUFFIX_LIST=".obj .exe"
|
||
OBJ_EXT=".obj"
|
||
LIB_SUFFIX=".lib"
|
||
REMOVE_EXT_LIST=".obj"
|
||
LIB_OPT=""
|
||
LIBPATH_OPT="-LIBPATH:"
|
||
DEBUG_OPT="-Z7"
|
||
EXE_OPT="-Fe"
|
||
SAVE_THE_BLANK=""
|
||
EXE_EXT=".exe"
|
||
CGAL_STATIC_LIBNAME="\$(LIB_NAME_BASE).lib"
|
||
MATH_LIB=
|
||
START_LD_OPT="-link "
|
||
;;
|
||
*SunOS*5.*CC*)
|
||
#### settings for sunpro compiler on solaris
|
||
SUNCC_COMPILER="y"
|
||
ADDITIONAL_CXXFLAGS="-features=extensions -D_RWSTD_ALLOCATOR -Qoption ccfe -abiopt=mangle6"
|
||
CGAL_STATIC_LIB_CREATE="\$(CGAL_CXX) -xar -o ''"
|
||
CGAL_SHARED_LIB_CXXFLAGS="-PIC"
|
||
CGAL_SHARED_LIB_CREATE="\$(CGAL_CXX) -G"
|
||
RUNTIME_LINKER_FLAG="-R "
|
||
PRINT_STACKTRACE_PROGRAM="dbx"
|
||
CGAL_SHARED_LIB_SONAME="-h\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOVERSION="\$(CGAL_SHARED_LIBNAME).\$(SOVERSION)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOMAJOR="\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
CGAL_LIBS_OPTFLAGS="-O"
|
||
;;
|
||
*SunOS*5.*g++*)
|
||
#### settings for gcc on solaris
|
||
LONG_NAME_PROBLEM_CXXFLAGS="-g"
|
||
LONG_NAME_PROBLEM_LDFLAGS="-z nodefs -s"
|
||
CGAL_SHARED_LIB_CREATE="\$(CGAL_CXX) -G"
|
||
RUNTIME_LINKER_FLAG="-R "
|
||
CGAL_SHARED_LIB_SONAME="-h \$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOVERSION="\$(CGAL_SHARED_LIBNAME).\$(SOVERSION)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOMAJOR="\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
;;
|
||
*alpha*Linux*g++*)
|
||
#### settings for g++ on alpha-linux (special FPU handling)
|
||
#### LONG_NAME_PROBLEM is cured by disabling debugging
|
||
ADDITIONAL_CXXFLAGS="-Wall -mieee -mfp-rounding-mode=d"
|
||
RUNTIME_LINKER_FLAG='-Wl,-R'
|
||
CGAL_SHARED_LIB_SONAME="-Wl,-soname,\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOVERSION="\$(CGAL_SHARED_LIBNAME).\$(SOVERSION)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOMAJOR="\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
;;
|
||
*Linux*g++*)
|
||
#### settings for g++ on linux
|
||
ADDITIONAL_CXXFLAGS="-Wall"
|
||
RUNTIME_LINKER_FLAG='-Wl,-R'
|
||
CGAL_SHARED_LIB_SONAME="-Wl,-soname,\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOVERSION="\$(CGAL_SHARED_LIBNAME).\$(SOVERSION)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOMAJOR="\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
;;
|
||
*Linux*icc*|*Linux*icpc*)
|
||
#### settings for icc on linux
|
||
# -mp is required for correct enough floating point operations
|
||
# necessary for interval arithmetic.
|
||
ADDITIONAL_CXXFLAGS="-mp"
|
||
RUNTIME_LINKER_FLAG='-Wl,-R'
|
||
PRINT_STACKTRACE_PROGRAM="idb"
|
||
;;
|
||
*Linux*pgCC*|*Linux*pgcpp*)
|
||
#### settings for Portland Group Compiler on linux
|
||
RUNTIME_LINKER_FLAG='-Wl,-R'
|
||
# PGCC has long name problems with "-g".
|
||
DEBUG_OPT=""
|
||
;;
|
||
*Linux*sunCC*|*Linux*CC*)
|
||
#### settings for sunpro compiler on linux
|
||
SUNCC_COMPILER="y"
|
||
ADDITIONAL_CXXFLAGS="-features=extensions -library=stlport4 -D_GNU_SOURCE"
|
||
ADDITIONAL_LDFLAGS="-library=stlport4"
|
||
CGAL_STATIC_LIB_CREATE="\$(CGAL_CXX) -xar -o ''"
|
||
CGAL_SHARED_LIB_CXXFLAGS="-PIC"
|
||
CGAL_SHARED_LIB_CREATE="\$(CGAL_CXX) -G"
|
||
RUNTIME_LINKER_FLAG="-R "
|
||
PRINT_STACKTRACE_PROGRAM="dbx"
|
||
CGAL_SHARED_LIB_SONAME="-h\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOVERSION="\$(CGAL_SHARED_LIBNAME).\$(SOVERSION)"
|
||
CGAL_SHARED_LIBNAME_WITH_SOMAJOR="\$(CGAL_SHARED_LIBNAME).\$(SOMAJOR)"
|
||
CGAL_LIBS_OPTFLAGS="-O"
|
||
;;
|
||
*CYGWIN*g++*)
|
||
#### settings for gcc on Cygwin
|
||
ADDITIONAL_CXXFLAGS="-Wall"
|
||
SUFFIX_LIST=".obj .exe"
|
||
EXE_EXT=".exe"
|
||
;;
|
||
*MINGW*g++*)
|
||
#### settings for gcc on mingw
|
||
ADDITIONAL_CXXFLAGS="-Wall"
|
||
SUFFIX_LIST=".obj .exe"
|
||
EXE_EXT=".exe"
|
||
;;
|
||
*Darwin*g++*)
|
||
#### settings for gcc on Darwin (MacOSX)
|
||
DARWIN_COMPILER="y"
|
||
ADDITIONAL_CXXFLAGS="-Wall"
|
||
CGAL_SHARED_LIB_CXXFLAGS="-fno-common"
|
||
CGAL_SHARED_LIB_CREATE="\$(CGAL_CXX) -dynamiclib"
|
||
CGAL_SHARED_LIB_INSTALL_NAME="-install_name \$(CGAL_LIB_DESTINATION)/\$(CGAL_SHARED_LIBNAME)"
|
||
CGAL_SHARED_LIB_EXT=".dylib"
|
||
RANLIB="ranlib"
|
||
;;
|
||
*mwcc.exe*|*MWCC*)
|
||
#### settings Metrowerks C++ compiler
|
||
ADDITIONAL_CXXFLAGS="-gccincludes -lang c++ -msgstyle gcc "
|
||
CGAL_LIB_CXXFLAGS=""
|
||
CGAL_STATIC_LIB_CREATE="mwld -library -o "
|
||
CYGWIN_COMPILER="y"
|
||
SUFFIX_LIST=".obj .exe"
|
||
OBJ_EXT=".obj"
|
||
REMOVE_EXT_LIST=".obj"
|
||
DEBUG_OPT=""
|
||
EXE_OPT="-o "
|
||
EXE_EXT=".exe"
|
||
MATH_LIB=""
|
||
SEPARATE_LIBPATH="y"
|
||
;;
|
||
*)
|
||
#### settings for unknown compiler
|
||
CGAL_SHARED_LIB_CREATE="`compiler_bin` -G"
|
||
;;
|
||
esac
|
||
|
||
#log_print "CGAL name is " ${CGAL_SHARED_LIBNAME}
|
||
|
||
# Remove *.moc files too, on all platforms
|
||
REMOVE_EXT_LIST="${REMOVE_EXT_LIST} .moc"
|
||
# version specific adjustments for gcc
|
||
case `compiler_description` in
|
||
*GNU*)
|
||
case `compiler_version` in
|
||
3.*) : ;;
|
||
4.2*) ADDITIONAL_CXXFLAGS="${ADDITIONAL_CXXFLAGS} -frounding-math"
|
||
# At some point before g++ 4.2.0 we have been hit by this bug:
|
||
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31268
|
||
# The workaround seems still needed.
|
||
CGAL_LIBS_OPTFLAGS="${CGAL_LIBS_OPTFLAGS} -fno-strict-aliasing"
|
||
;;
|
||
*) ADDITIONAL_CXXFLAGS="${ADDITIONAL_CXXFLAGS} -frounding-math";;
|
||
# g++-4.x and after: we need -frounding-math to avoid FPU rounding mode optimisations
|
||
esac
|
||
;;
|
||
esac
|
||
}
|
||
|
||
# --------------------------------------------------------------------------
|
||
# Following code is taken from make_redirection_headers
|
||
# (by Geert-Jan <geert@cs.uu.nl>)
|
||
|
||
#
|
||
# internal variables from make_redirection_headers
|
||
#
|
||
|
||
tmp_code_file=redirect_tmpfile.cpp
|
||
tmp_header_file=redirect_tmpfile
|
||
|
||
# this function is used to add symbols to namespace std
|
||
# (that should be present, but are not due to compiler/stdlib bugs)
|
||
print_using()
|
||
{
|
||
_tmp=${1}
|
||
shift
|
||
${_printf} "\n%s\n" \
|
||
"#if defined(CGAL_CFG_NO_STD${_tmp}_NAMESPACE) && !defined(CGAL_NO_STD${_tmp}_NAMESPACE)"
|
||
${_printf} "\n%s\n" "namespace std {"
|
||
for i in ${*}; do
|
||
${_printf} "\t%s\n" "using ::${i};"
|
||
done
|
||
${_printf} "%s\n" "}"
|
||
${_printf} "\n%s\n" \
|
||
"#endif // CGAL_CFG_NO_STD${_tmp}_NAMESPACE && !CGAL_NO_STD${_tmp}_NAMESPACE"
|
||
}
|
||
|
||
quote()
|
||
{
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
${_printf} "%s\n" "${*}"
|
||
else
|
||
${_printf} "%s\n" "\"${*}\""
|
||
fi
|
||
}
|
||
|
||
create_replacement_header()
|
||
#
|
||
# Create one header as a replacement for a standard header, if necessary.
|
||
# Should be invoked as
|
||
# create_replacement_header standard_header_name suffix replacements...
|
||
#
|
||
{
|
||
replacement_header=rh
|
||
header_name=$1
|
||
header_suffix=$2
|
||
shift 2
|
||
_final_file="${CGAL_INCL_CONF_DIR}/${CGAL_OS_COMPILER}/${header_name}${header_suffix}"
|
||
#
|
||
# Test if the standard header exists. Return if it does.
|
||
#
|
||
${_printf} "%s\n" "#include <$header_name>" > ${tmp_code_file}
|
||
${_printf} "%s\n" "int main() {return 0;}" >> ${tmp_code_file}
|
||
|
||
if eval "`quote \`compiler_bin\`` ${ADDITIONAL_CXXFLAGS} ${CUSTOM_CXXFLAGS} ${tmp_code_file} >/dev/null 2>&1"; then
|
||
${_printf} "%s\n" " ok."
|
||
return;
|
||
fi
|
||
${_printf} "%s\n" " no."
|
||
#
|
||
# The standard header does not exist.
|
||
# If some of the replacement headers exist, they are included in a
|
||
# newly created replacement header.
|
||
#
|
||
${_rm} -f ${replacement_header}
|
||
${_touch} ${replacement_header}
|
||
for arg in $* ; do
|
||
${_printf} "%s\n" "#include <$arg>" > ${tmp_code_file}
|
||
${_printf} "%s\n" "int main() {return 0;}" >> ${tmp_code_file}
|
||
if eval "`quote \`compiler_bin\`` ${ADDITIONAL_CXXFLAGS} ${CUSTOM_CXXFLAGS} ${tmp_code_file} >/dev/null 2>&1"; then
|
||
${_cat} <<EOF3 >>${replacement_header}
|
||
$LGPL_LICENSE_HEADER
|
||
//
|
||
// Author(s): install_cgal script
|
||
|
||
// This file was automatically generated during installation.
|
||
// It wraps a C++98 standard header file that did not exist for this compiler
|
||
// and adds its symbols to namespace std.
|
||
// The existence of this file indicates that your compiler does not
|
||
// conform to the ISO/IEC standard 14882 for C++ (C++98).
|
||
|
||
EOF3
|
||
${_printf} "%s\n" "#include <$arg>" >> ${replacement_header}
|
||
fi
|
||
done
|
||
|
||
|
||
|
||
#
|
||
# Move the replacement header to the platform specific config directory.
|
||
# This directory should be created first.
|
||
#
|
||
if [ -s ${replacement_header} ]
|
||
then
|
||
#
|
||
# this is just an ugly list of additions to namespace std
|
||
#
|
||
case ${header_name} in
|
||
iosfwd|ios)
|
||
print_using IO ios >> ${replacement_header};;
|
||
fstream) print_using IO filebuf ifstream ofstream fstream >> ${replacement_header};;
|
||
streambuf) print_using IO streampos streamoff streambuf >> ${replacement_header};;
|
||
iomanip) print_using IO setbase resetiosflags setiosflags setfill setprecision setw >> ${replacement_header};;
|
||
iostream) print_using IO cin cout cerr clog endl ends flush ios streampos streamoff streambuf ostream istream iostream istream_withassign ostream_withassign iostream_withassign >> ${replacement_header};;
|
||
# those do not exist e.g. on mipspro: wcin wcout wcerr wclog
|
||
istream) print_using IO istream istream_withassign >> ${replacement_header};;
|
||
ostream) print_using IO ostream ostream_withassign >> ${replacement_header};;
|
||
strstream) print_using IO strstream istrstream ostrstream >> ${replacement_header};;
|
||
csetjmp) print_using C longjmp jmp_buf >> ${replacement_header};;
|
||
cstdarg) print_using C va_list >> ${replacement_header};;
|
||
ctime) print_using C size_t time_t clock_t tm asctime ctime clock difftime gmtime localtime mktime time strftime >> ${replacement_header};;
|
||
csignal) print_using C sig_atomic_t raise signal >> ${replacement_header};;
|
||
cstdlib) print_using C abort atexit exit getenv system calloc malloc free realloc atof atoi atol mblen mbstowcs mbtowc strtod strtol strtoul wcstombs wctomb bsearch qsort div_t ldiv_t abs div labs ldiv rand srand >> ${replacement_header};;
|
||
cctype) print_using C isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit >> ${replacement_header};;
|
||
cwctype) print_using C wctrans_t wctype_t wint_t iswalnum iswalpha iswcntrl iswctype iswdigit iswgraph iswlower iswprint iswpunct iswspace iswupper iswxdigit towctrans towlower towupper wctrans wctype >> ${replacement_header};;
|
||
cstring) print_using C size_t memchr memcmp memcpy memmove memset strcat strchr strcmp strcoll strcpy strcspn strerror strlen strncat strncmp strncpy strpbrk strrchr strspn strstr strtok strxfrm >> ${replacement_header};;
|
||
cwchar) print_using C wint_t size_t fgetwc fgetws fputwc fputws getwc getwchar putwc putwchar ungetwc wcscat wcschr wcscmp wcscoll wcscpy wcscspn wcsftime wcslen wcsncat wcsncmp wcsncpy wcspbrk wcsrchr wcsspn wcstod wcstok wcstol wcstoul wcsxfrm >> ${replacement_header};;
|
||
cstdio) print_using C FILE fpos_t size_t clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell fwrite getc getchar gets perror printf putc putchar puts remove rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ungetc vfprintf vprintf vsprintf >> ${replacement_header};;
|
||
cmath) print_using C acos asin atan2 atan ceil cos cosh exp fabs floor fmod frexp ldexp log10 log modf pow sin sinh sqrt tan tanh >> ${replacement_header};;
|
||
cstddef) print_using C ptrdiff_t size_t >> ${replacement_header};;
|
||
esac
|
||
#
|
||
# end of ugly list of additions to namespace std :)
|
||
#
|
||
${_printf} "\n%s\n" "// EOF //" >> ${replacement_header}
|
||
mv ${replacement_header} "${_final_file}"
|
||
log_print "Created replacement header for ${header_name}."
|
||
fi
|
||
}
|
||
|
||
create_standard_header_replacements()
|
||
{
|
||
${_printf} "%s\n" "${_LEFTSPACE}Checking for C++98 standard header files"
|
||
|
||
#
|
||
# A global test for all std header files at once, to speed up the rest
|
||
# if a compiler is compliant.
|
||
# Note : <ciso646> is excluded as it is useless and not provided by PGCC 7.
|
||
${_cat} <<EOF6 >${TMP_CXX_FILE}.cpp
|
||
#include <algorithm>
|
||
#include <ostream>
|
||
#include <numeric>
|
||
#include <new>
|
||
#include <memory>
|
||
#include <map>
|
||
#include <locale>
|
||
#include <list>
|
||
#include <limits>
|
||
#include <iterator>
|
||
#include <istream>
|
||
#include <iostream>
|
||
#include <iosfwd>
|
||
#include <ios>
|
||
#include <iomanip>
|
||
#include <functional>
|
||
#include <fstream>
|
||
#include <exception>
|
||
#include <deque>
|
||
#include <cwctype>
|
||
#include <cwchar>
|
||
#include <ctime>
|
||
#include <cstring>
|
||
#include <cstdlib>
|
||
#include <cstdio>
|
||
#include <cstddef>
|
||
#include <cstdarg>
|
||
#include <csignal>
|
||
#include <csetjmp>
|
||
#include <complex>
|
||
#include <cmath>
|
||
#include <clocale>
|
||
#include <climits>
|
||
#include <cfloat>
|
||
#include <cerrno>
|
||
#include <cctype>
|
||
#include <cassert>
|
||
#include <bitset>
|
||
#include <queue>
|
||
#include <vector>
|
||
#include <valarray>
|
||
#include <utility>
|
||
#include <typeinfo>
|
||
#include <string>
|
||
#include <streambuf>
|
||
#include <strstream>
|
||
#include <stdexcept>
|
||
#include <stack>
|
||
#include <sstream>
|
||
#include <set>
|
||
int main() { return 0; }
|
||
EOF6
|
||
if eval "`quote \`compiler_bin\`` ${ADDITIONAL_CXXFLAGS} ${CUSTOM_CXXFLAGS} ${TMP_CXX_FILE}.cpp >/dev/null 2>&1"; then
|
||
${_printf} "%s\n" " All headers at once : ok."
|
||
return;
|
||
fi
|
||
${_printf} "%s\n" " All headers at once : no."
|
||
|
||
#
|
||
# Decide if a .h suffix is needed for header files.
|
||
#
|
||
${_printf} "%s\n" "typedef int CGAL_nt;" > ${tmp_header_file}
|
||
${_printf} "%s\n" "#include <${tmp_header_file}>" > ${tmp_code_file}
|
||
${_printf} "%s\n" \
|
||
"int main() { CGAL_nt result = 0; return result;}" >> ${tmp_code_file}
|
||
if eval "`quote \`compiler_bin\`` ${ADDITIONAL_CXXFLAGS} -I. ${CUSTOM_CXXFLAGS} ${tmp_code_file} >/dev/null 2>&1"; then
|
||
header_suffix=""
|
||
else
|
||
header_suffix=".h"
|
||
fi
|
||
#
|
||
# Now create the necessary replacement files from the list below.
|
||
#
|
||
while read a b; do
|
||
${_printf} "%s" "${_LEFTSPACE}$a ..."
|
||
create_replacement_header $a "$header_suffix" $b
|
||
done <<EOF2
|
||
algorithm algobase.h algo.h
|
||
ostream ostream.h
|
||
numeric numeric.h
|
||
new new.h
|
||
memory alloc.h algobase.h
|
||
map map.h multimap.h
|
||
locale locale.h
|
||
list list.h
|
||
limits
|
||
iterator iterator.h
|
||
istream istream.h
|
||
iostream iostream.h
|
||
iosfwd iostream.h
|
||
ios ios.h
|
||
iomanip iomanip.h
|
||
functional function.h
|
||
fstream fstream.h
|
||
exception exception.h
|
||
deque deque.h
|
||
cwctype wctype.h
|
||
cwchar wchar.h
|
||
ctime time.h
|
||
cstring string.h
|
||
cstdlib stdlib.h
|
||
cstdio stdio.h
|
||
cstddef stddef.h
|
||
cstdarg stdarg.h
|
||
csignal signal.h
|
||
csetjmp setjmp.h
|
||
complex complex.h
|
||
cmath math.h
|
||
clocale locale.h
|
||
climits limits.h
|
||
ciso646 iso646.h
|
||
cfloat float.h
|
||
cerrno errno.h
|
||
cctype ctype.h
|
||
cassert assert.h
|
||
bitset bitset.h
|
||
queue stack.h
|
||
vector vector.h
|
||
valarray valarray.h
|
||
utility function.h pair.h
|
||
typeinfo typeinfo.h
|
||
string
|
||
streambuf streambuf.h
|
||
strstream strstream.h
|
||
stdexcept stdexcept.h
|
||
stack stack.h
|
||
sstream sstream.h
|
||
set set.h multiset.h
|
||
EOF2
|
||
}
|
||
|
||
#
|
||
# end of code segment from make_redirection_headers
|
||
# --------------------------------------------------------------------------
|
||
|
||
# COMPILER SPECS TEST:
|
||
# set some compiler specific flags needed for CGAL
|
||
# these flags are determined by the corresponding test-sources
|
||
# in CGAL_CONF_DIR
|
||
# ($1 nonzero indicates verbosity)
|
||
test_compiler_specifica()
|
||
{
|
||
log_print "Running configuration tests..."
|
||
${_cat} <<EOF5 >"${_file}"
|
||
$LGPL_LICENSE_HEADER
|
||
//
|
||
// Author(s): the install_cgal script
|
||
|
||
// Compiler specific configuration file for CGAL ${CGAL_VERSION}
|
||
// System: ${CGAL_OS_COMPILER}
|
||
// generated by ${CGAL_INSTALL_CGAL} ${CGAL_INSTALL_VERSION}
|
||
EOF5
|
||
|
||
# test for other compiler features/bugs
|
||
LONG_NAME_PROBLEM=''
|
||
for i in "${CGAL_TEST_CONF_DIR}"/CGAL*.cpp; do
|
||
${_cat} "${i}" > ${TMP_CXX_FILE}.cpp
|
||
${_printf} "%s%s\n" \
|
||
"//+----------------------------------------------------------" \
|
||
"----------------" \
|
||
>> "${_file}"
|
||
${_cat} "${i}" | ${_awk} '/\/\/\|/ {print $0}' >> "${_file}"
|
||
${_printf} "%s%s\n" \
|
||
"//+----------------------------------------------------------" \
|
||
"----------------" \
|
||
>> "${_file}"
|
||
_test_name="`${_basename} \"${i}\"`"
|
||
_test_name="`value_of_without \"_test_name\" \"${CGAL_CONFIG_PREFIX}\" \"\.cpp\"`"
|
||
_tmp_name="`value_of_without \"_test_name\" \"^NO_\"`"
|
||
if [ "${_tmp_name}" = "${_test_name}" ]; then
|
||
_NO='unfortunately.'
|
||
else
|
||
_NO='no.'
|
||
fi
|
||
if _compile_test \
|
||
"${_tmp_name}" \
|
||
"`compiler_test_cxxflags` " \
|
||
"$1" \
|
||
"${_NO}" \
|
||
&& _link_run_test \
|
||
"${_tmp_name}" \
|
||
"`compiler_test_libpathflags` " \
|
||
"`compiler_test_ldflags` `math_ldflags`" \
|
||
"$1" \
|
||
"${_NO}"
|
||
then
|
||
${_printf} "%s" "//" >> "${_file}"
|
||
elif [ "`${_basename} \"${i}\"`" = "CGAL_CFG_LONGNAME_BUG.cpp" ]; then
|
||
LONG_NAME_PROBLEM=y
|
||
elif [ "`${_basename} \"${i}\"`" = "CGAL_CFG_NO_STL.cpp" ]; then
|
||
log_print "`extended_compiler_description` does NOT seem to have an STL."
|
||
fi
|
||
${_printf} "%s\n\n" \
|
||
"#define ${CGAL_CONFIG_PREFIX}${_test_name} 1" \
|
||
>> "${_file}"
|
||
cleanup_after_compile
|
||
done
|
||
}
|
||
|
||
|
||
#---------------------------------------------------------
|
||
# flags for compiler/linker and utitlities
|
||
|
||
# escape spaces in filenames
|
||
escape_special()
|
||
{
|
||
echo "${*}" | ${_sed} 's/ /\\\ /g'
|
||
}
|
||
|
||
# double-escape spaces in filenames
|
||
multi_escape_special()
|
||
{
|
||
echo "${*}" | ${_sed} 's/ /\\\\\\\ /g'
|
||
}
|
||
|
||
posix_path()
|
||
{
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
${_printf} "%s" "`escape_special \"${*}\"`"
|
||
else
|
||
${_printf} "%s" "`${_cygpath} -u \"$*\"`"
|
||
fi
|
||
}
|
||
|
||
os_path_escape()
|
||
{
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
${_printf} "%s" "`escape_special \"${*}\"`"
|
||
else
|
||
${_printf} "%s" "`${_cygpath} -m \"$*\"`"
|
||
fi
|
||
}
|
||
|
||
os_path()
|
||
{
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
${_printf} "%s" "${*}"
|
||
else
|
||
${_printf} "%s" "`${_cygpath} -m \"$*\"`"
|
||
fi
|
||
}
|
||
|
||
include_dir_option()
|
||
{
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
${_printf} "-I%s " "`escape_special \"${*}\"`"
|
||
else
|
||
${_printf} "'-I%s' " "`${_cygpath} -m \"${*}\"`"
|
||
fi
|
||
}
|
||
|
||
libpath_option()
|
||
{
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
${_printf} "${LIBPATH_OPT}%s " "`escape_special \"${*}\"`"
|
||
else
|
||
${_printf} "'${LIBPATH_OPT}%s' " "`${_cygpath} -m \"${*}\"`"
|
||
fi
|
||
}
|
||
|
||
libpath_option_pure()
|
||
{
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
${_printf} "'${LIBPATH_OPT}%s' " "`escape_special \"${*}\"`"
|
||
else
|
||
${_printf} "'${LIBPATH_OPT}%s' " "$*"
|
||
fi
|
||
}
|
||
|
||
lib_option()
|
||
{
|
||
${_printf} "${LIB_OPT}%s${LIB_SUFFIX} " "$*"
|
||
}
|
||
|
||
object_file_name()
|
||
{
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
${_printf} "%s" "`escape_special \"${*}\"`${OBJ_EXT}"
|
||
else
|
||
${_printf} "%s" "'`${_cygpath} -m \"${*}\"`${OBJ_EXT}'"
|
||
fi
|
||
}
|
||
|
||
to_object_file_option()
|
||
{
|
||
if [ -z "${WINDOWS_COMPILER}" ]; then
|
||
${_printf} "%s" "-o `escape_special \"${*}\"`.o"
|
||
else
|
||
${_printf} "%s" "'-o`${_cygpath} -m \"${*}\"`'"
|
||
fi
|
||
}
|
||
|
||
output_file_option()
|
||
{
|
||
if [ -z "${WINDOWS_COMPILER}" ]; then
|
||
${_printf} "%s" "${EXE_OPT}`escape_special \"${*}\"`"
|
||
else
|
||
${_printf} "%s" "'${EXE_OPT}`${_cygpath} -m \"${*}\"`'"
|
||
fi
|
||
}
|
||
|
||
concat_path()
|
||
{
|
||
if [ $# != 0 ] ; then
|
||
${_printf} "%s" "$1"
|
||
shift
|
||
# it seems ms tools can also handle slashed paths...
|
||
# if [ -n "${CYGWIN_COMPILER}" ]; then
|
||
# for elem in "$@"
|
||
# do
|
||
# ${_printf} "%s%s" '\' "${elem}"
|
||
#This character ' is just to please font-lock-mode under (x)emacs
|
||
# done
|
||
# else
|
||
for elem in "$@"
|
||
do
|
||
${_printf} "/%s" "${elem}"
|
||
done
|
||
# fi
|
||
fi
|
||
}
|
||
|
||
#---------------------------------------------------------
|
||
# flags for the math library
|
||
|
||
math_ldflags()
|
||
{
|
||
if [ -n "${MATH_LIB}" ] ; then
|
||
lib_option "${MATH_LIB}"
|
||
fi
|
||
}
|
||
|
||
#---------------------------------------------------------
|
||
# flags for the compiler tests
|
||
|
||
compiler_test_cxxflags()
|
||
{
|
||
${_printf} "%s" \
|
||
"${ADDITIONAL_CXXFLAGS} `include_dir_option ${CGAL_INCL_CONF_DIR}/${CGAL_OS_COMPILER}` ${CUSTOM_CXXFLAGS}"
|
||
}
|
||
|
||
compiler_test_libpathflags()
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
compiler_test_ldflags()
|
||
{
|
||
${_printf} "%s" "${CUSTOM_LDFLAGS} ${ADDITIONAL_LDFLAGS}"
|
||
}
|
||
|
||
#---------------------------------------------------------
|
||
# support for 3rd party libraries
|
||
|
||
# ${1} is a variable
|
||
# append ${2} to it, separate several entries by ${3}
|
||
_append_to()
|
||
{
|
||
if [ -n "${2}" ]; then
|
||
if [ -z "`value_of \"${1}\"`" ]; then
|
||
eval ${1}=\"${2}\"
|
||
else
|
||
eval ${1}=\"`value_of "${1}"`${3}${2}\"
|
||
fi
|
||
fi
|
||
}
|
||
|
||
# ${1} is a variable
|
||
# prepend ${2} to it, separate several entries by ${3}
|
||
_prepend_to()
|
||
{
|
||
if [ -n "${2}" ]; then
|
||
if [ -z "`value_of \"${1}\"`" ]; then
|
||
eval ${1}=\"${2}\"
|
||
else
|
||
eval ${1}=\"${2}${3}`value_of "${1}"`\"
|
||
fi
|
||
fi
|
||
}
|
||
|
||
# $1 is a list of items separated by '', replace '' by $2
|
||
split_up()
|
||
{
|
||
${_printf} "%s\n" "`value_of \"${1}\"`" | ${_sed} "s//${2}/g"
|
||
}
|
||
|
||
# enable support for package $1
|
||
# USES: iii
|
||
enable_support()
|
||
{
|
||
if [ -n "${1}" -a -z "`value_of ${1}_SUPPORT`" ]; then
|
||
eval "${1}_SUPPORT=y"
|
||
SETUP_COMPLETE=''
|
||
for iii in `value_of ${1}_PROVIDES`; do
|
||
if [ -n "`value_of PROVIDE_PKG_${iii}`" ]; then
|
||
exit_on_error "`value_of PROVIDE_PKG_${iii}` and ${1} are in conflict"
|
||
fi
|
||
eval "PROVIDE_PKG_${iii}=${1}"
|
||
done
|
||
fi
|
||
}
|
||
|
||
# enable support for package $1
|
||
# USES: iii
|
||
disable_support()
|
||
{
|
||
if [ -n "${1}" -a -n "`value_of ${1}_SUPPORT`" ]; then
|
||
eval "${1}_SUPPORT=''"
|
||
SETUP_COMPLETE=''
|
||
for iii in `value_of ${1}_PROVIDES`; do
|
||
if [ "`value_of PROVIDE_PKG_${iii}`" != "${1}" ]; then
|
||
exit_on_error "Inconsistent support settings (disable_support)"
|
||
fi
|
||
eval "PROVIDE_PKG_${iii}=''"
|
||
done
|
||
for iii in `value_of ${1}_REQUIRED_BY`; do
|
||
eval "${iii}_TEST_PASSED=''"
|
||
done
|
||
fi
|
||
}
|
||
|
||
# test for 3rd party package $1 ($2 != '' indicates verbosity)
|
||
# The test program is $3 and the variables
|
||
# tmp_cxxflags, tmp_libpathflags, and tmp_ldflags have to be preset.
|
||
# $4 provides a literal description for the test.
|
||
# The variable ${4}_VERSION is set according to the version information provided
|
||
# by the test program; if necessary, the variables ${4}_INCL/LIB_DIR are modified
|
||
# to take into account the standard directory where the package was found.
|
||
# Return 1, if test succeeds; otherwise, return 0.
|
||
# USES: ii _ok kk _ii _kk _no_include_location _print_link_result
|
||
_test_support()
|
||
{
|
||
if [ ! -r "${3}" ]; then
|
||
log_print "OK: There is no test program ${3}."
|
||
return 1
|
||
fi
|
||
${_cp} "${3}" ${TMP_CXX_FILE}.cpp
|
||
if [ -n "`value_of \"${1}_DESCRIPTION\"`" ]; then
|
||
DESCRIPTION="${4} (`value_of \"${1}_DESCRIPTION\"`)"
|
||
else
|
||
DESCRIPTION="${4}"
|
||
fi
|
||
while [ 0 ]; do
|
||
# a) try with current flags
|
||
log_print " Testing with default flags."
|
||
if _compile_test "${DESCRIPTION}" "${tmp_cxxflags} ${tmp_compiletestflags}" "${2}" && \
|
||
_link_run_test "${DESCRIPTION}" \
|
||
"${tmp_libpathflags} `rpath_directive \"${tmp_runtimepath}\"`" \
|
||
"${tmp_ldflags} " \
|
||
"${2}" \
|
||
"no." \
|
||
"${4}_VERSION"
|
||
then
|
||
break
|
||
fi
|
||
cleanup_after_compile_leave_source
|
||
# b) try standard locations specifically specified
|
||
# (the strange processing is to handle spaces in filenames;
|
||
# what a great invention!)
|
||
log_print " Looking for ${DESCRIPTION} in standard locations..."
|
||
_ok=''
|
||
_no_include_location=y # assume STDINCLDIRS or INCLTHING is empty
|
||
for ii in `echo \`value_of ${1}_STDINCLDIRS\` | \
|
||
${_sed} 's/ //g' | ${_awk} 'BEGIN {RS=":"}{print $0}'`
|
||
do
|
||
ii="`echo ${ii} | ${_sed} 's// /g'`"
|
||
log_print " - Looking for includes in ${ii} ..."
|
||
# we need two evals: the first one strips off the escape from wildchars,
|
||
# the second one expands it. otoh, this means we have to heavily escape
|
||
# potential spaces
|
||
ii="`multi_escape_special \"${ii}\"`/`value_of ${1}_INCLTHING`"
|
||
for kk in `eval eval ${_lsone} -d "${ii}" 2>/dev/null | ${_sed} 's/ //g'`
|
||
do
|
||
_no_include_location='' # note that STDINCLDIRS and INCLTHING aren't empty
|
||
kk="`echo ${kk} | ${_sed} 's// /g'`"
|
||
kk="`${_dirname} \"${kk}\"`"
|
||
if [ ! -r "${kk}" ]; then continue; fi
|
||
log_print " - Trying ${kk}."
|
||
if _compile_test "${DESCRIPTION} with include ${kk}" \
|
||
"${tmp_cxxflags} ${tmp_compiletestflags} `include_dir_option \"${kk}\"`" \
|
||
"${2}"
|
||
then
|
||
# first try without additional libdir flags, maybe its headers only...
|
||
${_printf} "%s\n%s" " ok." \
|
||
"${_LEFTSPACE}Linking $1 without extra libdir ..."
|
||
if _link_run_test \
|
||
"${DESCRIPTION}" \
|
||
"${tmp_libpathflags} `rpath_directive \"${tmp_runtimepath}\"`" \
|
||
"${tmp_ldflags} " \
|
||
"${2}" \
|
||
"no." \
|
||
"${4}_VERSION"
|
||
then
|
||
log_print " Found ${1} with INCL_DIR ${kk}."
|
||
_append_to "${4}_INCL_DIR" "${kk}" ":"
|
||
_ok=y
|
||
break
|
||
fi
|
||
# it seems we need libs also...
|
||
for _ii in `echo \`value_of ${1}_STDLIBDIRS\` | \
|
||
${_sed} 's/ //g' | ${_awk} 'BEGIN {RS=":"}{print $0}'`
|
||
do
|
||
_ii="`echo ${_ii} | ${_sed} 's// /g'`"
|
||
log_print " --- Looking for libs in ${_ii} ..."
|
||
_ii="`multi_escape_special \"${_ii}\"`/`value_of ${1}_LIBTHING`"
|
||
for _kk in `eval eval ${_lsone} -d "${_ii}" 2>/dev/null | ${_sed} 's/ //g'`
|
||
do
|
||
_kk="`echo ${_kk} | ${_sed} 's// /g'`"
|
||
_kk="`${_dirname} \"${_kk}\"`"
|
||
if [ ! -r "${_kk}" ]; then continue; fi
|
||
log_print " ---- Trying ${_kk}."
|
||
runtimepath="${tmp_runtimepath}"
|
||
_append_to runtimepath "`os_path \"${_kk}\"`" ":"
|
||
${_printf} "%s" "${_LEFTSPACE}Linking $1 with ${_kk} ..."
|
||
if _link_run_test \
|
||
"${DESCRIPTION}" \
|
||
"${tmp_libpathflags} `libpath_option \"${_kk}\"` `rpath_directive \"${runtimepath}\"`" \
|
||
"${tmp_ldflags} " \
|
||
"${2}" \
|
||
"no." \
|
||
"${4}_VERSION"
|
||
then
|
||
log_print " Found ${DESCRIPTION} with INCL_DIR ${kk} and LIB_DIR ${_kk}."
|
||
_append_to "${4}_INCL_DIR" "${kk}" ":"
|
||
_append_to "${4}_LIB_DIR" "${_kk}" ":"
|
||
_ok=y
|
||
break
|
||
fi
|
||
done
|
||
if [ -n "${_ok}" ]; then break; fi
|
||
done
|
||
fi
|
||
cleanup_after_compile_leave_source
|
||
if [ -n "${_ok}" ]; then break; fi
|
||
done
|
||
if [ -n "${_ok}" ]; then break; fi
|
||
done
|
||
if [ -n "${_ok}" ]; then break; fi
|
||
cleanup_after_compile_leave_source
|
||
# c) try standard *library* locations specifically specified
|
||
# if no include location is specified.
|
||
_ok=''
|
||
if [ -n "${_no_include_location}" \
|
||
-a -n "`value_of ${1}_STDLIBDIRS`" -a -n "`value_of ${1}_LIBTHING`" ]
|
||
then
|
||
if _compile_test "${DESCRIPTION}" "${tmp_cxxflags} ${tmp_compiletestflags}" "${2}"
|
||
then
|
||
${_printf} "%s\n" " ok."
|
||
_print_link_result=y # assume that we have to print the link result
|
||
for _ii in `echo \`value_of ${1}_STDLIBDIRS\` | \
|
||
${_sed} 's/ //g' | ${_awk} 'BEGIN {RS=":"}{print $0}'`
|
||
do
|
||
_ii="`echo ${_ii} | ${_sed} 's// /g'`"
|
||
log_print " --- Looking for libs in ${_ii} ..."
|
||
_ii="`multi_escape_special \"${_ii}\"`/`value_of ${1}_LIBTHING`"
|
||
for _kk in `eval eval ${_lsone} -d "${_ii}" 2>/dev/null | ${_sed} 's/ //g'`
|
||
do
|
||
_kk="`echo ${_kk} | ${_sed} 's// /g'`"
|
||
_kk="`${_dirname} \"${_kk}\"`"
|
||
if [ ! -r "${_kk}" ]; then continue; fi
|
||
log_print " ---- Trying ${_kk}."
|
||
runtimepath="${tmp_runtimepath}"
|
||
_append_to runtimepath "`os_path \"${_kk}\"`" ":"
|
||
_print_link_result='' # we are about to print the link result
|
||
${_printf} "%s" "${_LEFTSPACE}Linking $1 with ${_kk} ..."
|
||
if _link_run_test \
|
||
"${DESCRIPTION}" \
|
||
"${tmp_libpathflags} `libpath_option \"${_kk}\"` `rpath_directive \"${runtimepath}\"`" \
|
||
"${tmp_ldflags} " \
|
||
"${2}" \
|
||
"no." \
|
||
"${4}_VERSION"
|
||
then
|
||
log_print " Found ${DESCRIPTION} LIB_DIR ${_kk}."
|
||
_append_to "${4}_LIB_DIR" "${_kk}" ":"
|
||
_ok=y
|
||
break
|
||
fi
|
||
done
|
||
if [ -n "${_ok}" ]; then break; fi
|
||
done
|
||
# print the link result if not yet done
|
||
if [ -n "${_print_link_result}" ]
|
||
then
|
||
${_printf} "%s\n" "${_LEFTSPACE}Linking $1 ... no."
|
||
fi
|
||
fi
|
||
fi
|
||
if [ -n "${_ok}" ]; then break; fi
|
||
log_print "Failed: ${4} test program."
|
||
cleanup_after_compile
|
||
return 0
|
||
done
|
||
log_print "OK: ${4} test program."
|
||
cleanup_after_compile
|
||
return 1
|
||
}
|
||
|
||
# test if all requirements of pkg $1 are met.
|
||
# If any missing requirement is found, the function returns 0 and outputs it.
|
||
# Otherwise, the function returns 1.
|
||
# USES: _tmp jj
|
||
_check_requirements()
|
||
{
|
||
for jj in `value_of ${1}_REQUIRES`; do
|
||
case ${jj} in
|
||
DOLLAR_*)
|
||
_tmp="`echo ${jj} | ${_sed} 's/^DOLLAR_//'`"
|
||
if [ -z "`value_of ${_tmp}`" ]; then
|
||
echo ${1} requires variable ${_tmp}
|
||
return 0
|
||
fi;;
|
||
*)
|
||
if [ -z "`value_of PROVIDE_PKG_${jj}`" ]; then
|
||
echo ${1} requires feature ${jj}
|
||
return 0
|
||
fi;;
|
||
esac
|
||
done
|
||
return 1
|
||
}
|
||
|
||
# test if no incompatibilities w.r.t. pkg $1 are present.
|
||
# If any incompatibility is found, the function returns 0 and outputs it.
|
||
# Otherwise, the function returns 1.
|
||
# USES: _tmp jj
|
||
_check_incompatibilities()
|
||
{
|
||
for jj in `value_of ${1}_PROVIDES`; do
|
||
_tmp="`value_of PROVIDE_PKG_${jj}`"
|
||
if [ -n "${_tmp}" -a "${_tmp}" != "${1}" ]; then
|
||
echo ${1} is incompatible with package `value_of PROVIDE_PKG_${jj}`
|
||
return 0
|
||
fi
|
||
done
|
||
for jj in `value_of ${1}_INCOMPATIBLE`; do
|
||
case ${jj} in
|
||
DOLLAR_*)
|
||
_tmp="`echo ${jj} | ${_sed} 's/^DOLLAR_//'`"
|
||
if [ -n "`value_of ${_tmp}`" ]; then
|
||
echo ${1} is incompatible with variable ${_tmp}
|
||
return 0
|
||
fi;;
|
||
*)
|
||
if [ -n "`value_of PROVIDE_PKG_${jj}`" ]; then
|
||
echo ${1} is incompatible with feature ${jj}
|
||
return 0
|
||
fi;;
|
||
esac
|
||
done
|
||
return 1
|
||
}
|
||
|
||
# set the variable tmp_cxxflags for package $1
|
||
set_package_cxxflags()
|
||
{
|
||
tmp_cxxflags="`value_of \"${1}_CXXFLAGS\"`"
|
||
tmp_compiletestflags="`value_of \"${1}_COMPILETESTFLAGS\"`"
|
||
}
|
||
|
||
# set the variable tmp_cxxflags for feature $1
|
||
# USES: ii
|
||
set_feature_cxxflags()
|
||
{
|
||
tmp_cxxflags=''
|
||
for ii in `echo \`value_of "${1}_INCL_DIR"\` | \
|
||
${_sed} 's/ //g' | ${_awk} 'BEGIN {RS=":"}{print $0}'`
|
||
do
|
||
ii="`echo ${ii} | ${_sed} 's// /g'`"
|
||
if [ -n "${ii}" ]; then
|
||
_append_to tmp_cxxflags "`include_dir_option \"${ii}\"`" ""
|
||
fi
|
||
done
|
||
}
|
||
|
||
# set the variables tmp_libpathflags and tmp_runtimepath for feature $1.
|
||
# Attention: The linker option for the runtime-linker path is not set,
|
||
# only the path is built up in tmp_runtimepath. (Allows for adding
|
||
# additional dirs in _test_support.)
|
||
# USES: ii
|
||
set_feature_libpathflags()
|
||
{
|
||
tmp_libpathflags=''
|
||
tmp_runtimepath=''
|
||
for ii in `echo \`value_of "${1}_LIB_DIR"\` | \
|
||
${_sed} 's/ //g' | ${_awk} 'BEGIN {RS=":"}{print $0}'`
|
||
do
|
||
ii="`echo ${ii} | ${_sed} 's// /g'`"
|
||
if [ -n "${ii}" ]; then
|
||
_append_to tmp_libpathflags "`libpath_option \"${ii}\"`" ""
|
||
_append_to tmp_runtimepath "`os_path \"${ii}\"`" ""
|
||
fi
|
||
done
|
||
}
|
||
|
||
# set the variable tmp_ldflags for package $1
|
||
# USES: ii
|
||
set_package_ldflags()
|
||
{
|
||
tmp_ldflags="`value_of \"${1}_LDFLAGS\"`"
|
||
for ii in `value_of "${1}_LIBS"`; do
|
||
_append_to tmp_ldflags "`lib_option \"${ii}\"`" ""
|
||
done
|
||
}
|
||
|
||
# Test package $1 ($2 nonzero indicates verbosity)
|
||
# If successful, return 1; otherwise, return 0.
|
||
# USES: _tmp _ok ii jj kk _ii _kk
|
||
test_support_pkg()
|
||
{
|
||
if [ -n "`value_of \"${1}_SUPPORT\"`" -a -n "`value_of \"${1}_TEST_PASSED\"`" ]; then
|
||
${_printf} "%s\n" "${_LEFTSPACE}${1} test has already been passed."
|
||
return 1
|
||
fi
|
||
log_print "Testing support for ${1} ..."
|
||
# check requirements and incompatibilities
|
||
_tmp=`_check_requirements "${1}" || _check_incompatibilities "${1}"`
|
||
if [ ${?} = 0 ]; then
|
||
log_print "Failed: ${_tmp}."
|
||
return 0
|
||
fi
|
||
log_print " OK: requirements and incompatibilities."
|
||
# --------------------------
|
||
# try to build test programs
|
||
# --------------------------
|
||
real_cxxflags="`compiler_test_cxxflags`"
|
||
real_libpathflags="`compiler_test_libpathflags`"
|
||
real_ldflags="`compiler_test_ldflags`"
|
||
real_runtimepath=''
|
||
|
||
# pull in flags for required packages and features
|
||
for jj in ${SUPPORT_FEATURES}; do eval TMP_SUPPORT_${jj}=''; done
|
||
for jj in ${SUPPORT_PKGS}; do eval TMP_SUPPORT_${jj}=''; done
|
||
eval "TMP_SUPPORT_${1}=y"
|
||
for jj in ${R_SUPPORT_PKGS}; do
|
||
if [ -n "`value_of \"TMP_SUPPORT_${jj}\"`" ]; then
|
||
for kk in `value_of "${jj}_REQUIRES"`; do
|
||
case "${kk}" in
|
||
DOLLAR_*) _tmp=thisisnotused;;
|
||
*)
|
||
eval TMP_SUPPORT_${kk}=y
|
||
# also pull in the providing package
|
||
_tmp="`value_of \"PROVIDE_PKG_${kk}\"`"
|
||
if [ -z "${_tmp}" ]; then
|
||
# this should have been caught in _check_requirements
|
||
exit_on_error \
|
||
"Inconsistent support settings (test_support_pkg)"
|
||
fi
|
||
eval TMP_SUPPORT_${_tmp}=y
|
||
;;
|
||
esac
|
||
done
|
||
fi
|
||
done
|
||
# generate flags
|
||
for jj in ${SUPPORT_FEATURES}; do
|
||
if [ -n "`value_of \"PROVIDE_PKG_${jj}\"`" ]; then
|
||
set_feature_cxxflags "${jj}"
|
||
_append_to real_cxxflags "${tmp_cxxflags}" ""
|
||
set_feature_libpathflags "${jj}"
|
||
_append_to real_libpathflags "${tmp_libpathflags}" ""
|
||
_append_to real_runtimepath "${tmp_runtimepath}" ""
|
||
fi
|
||
done
|
||
for jj in ${SUPPORT_PKGS}; do
|
||
if [ -n "`value_of \"TMP_SUPPORT_${jj}\"`" ]; then
|
||
set_package_cxxflags "${jj}"
|
||
_append_to real_cxxflags "${tmp_cxxflags}" ""
|
||
set_package_ldflags "${jj}"
|
||
_prepend_to real_ldflags "${tmp_ldflags}" ""
|
||
fi
|
||
done
|
||
tmp_ldflags="${real_ldflags}"
|
||
_append_to tmp_ldflags "`math_ldflags`" ""
|
||
# this does not change below, hence split it here already
|
||
tmp_ldflags="`split_up \"tmp_ldflags\" \" \"`"
|
||
|
||
# now test all provided features
|
||
for jj in `value_of "${1}_PROVIDES"`; do
|
||
set_feature_cxxflags "${jj}"
|
||
_prepend_to tmp_cxxflags "${real_cxxflags}" ""
|
||
set_feature_libpathflags "${jj}"
|
||
_prepend_to tmp_libpathflags "${real_libpathflags}" ""
|
||
_prepend_to tmp_runtimepath "${real_runtimepath}" ""
|
||
|
||
# split flags up
|
||
tmp_cxxflags="`split_up \"tmp_cxxflags\" \" \"`"
|
||
tmp_libpathflags="`split_up \"tmp_libpathflags\" \" \"`"
|
||
tmp_runtimepath="`split_up \"tmp_runtimepath\" \":\"`"
|
||
|
||
if _test_support "${1}" \
|
||
"${2}" \
|
||
"${CGAL_SUPPORT_DIR}/test_${jj}.cpp" \
|
||
"${jj}"
|
||
then
|
||
return 0
|
||
fi
|
||
done
|
||
|
||
eval "${1}_TEST_PASSED=y"
|
||
return 1
|
||
}
|
||
|
||
|
||
# test the current selection for their requirements and incompatibilities
|
||
# If any incompatibility or any missing requirement is found,
|
||
# the function returns 0 and outputs it; otherwise, the function returns 1.
|
||
# USES: i jj _tmp
|
||
test_requirements_and_incompatibilities()
|
||
{
|
||
for i in ${SUPPORT_REQUIRED}; do
|
||
if [ -z "`value_of \"PROVIDE_PKG_${i}\"`" ]; then
|
||
echo "Support for ${i} is required"
|
||
return 0
|
||
fi
|
||
done
|
||
for i in ${SUPPORT_PKGS}; do
|
||
if [ -n "`value_of ${i}_SUPPORT`" ]; then
|
||
if _check_requirements "${i}" || _check_incompatibilities "${i}"; then
|
||
return 0
|
||
fi
|
||
fi
|
||
done
|
||
return 1
|
||
}
|
||
|
||
#---------------------------------------------------------
|
||
# all flags
|
||
|
||
# print compiler description/version of compiler $1 (executable)
|
||
# in the format DESCRIPTION@VERSION
|
||
get_compiler_description()
|
||
{
|
||
${_cat} <<EOF4 >${TMP_CXX_FILE}.cpp
|
||
// We need the following lines, since MIPSPRO only knows <iostream>,
|
||
// if it is called with -LANG:std (as of Rel 7.3)
|
||
// and I do not want to check for this before compiling ...
|
||
#if defined(__sgi) && defined(_COMPILER_VERSION) && !defined(_STANDARD_C_PLUS_PLUS)
|
||
#include <iostream.h>
|
||
#define CGAL_STDCOUT cout
|
||
#define CGAL_STDENDL endl
|
||
#else
|
||
#include <iostream>
|
||
#define CGAL_STDCOUT std::cout
|
||
#define CGAL_STDENDL std::endl
|
||
#endif
|
||
|
||
void output_first_ciff_separate(int x, int base)
|
||
{
|
||
int j = 1;
|
||
while (x / (base * j) >= 1) j *= base;
|
||
CGAL_STDCOUT << x/j << "." << x - j * (x/j);
|
||
}
|
||
|
||
int main()
|
||
{
|
||
#if defined(__INTEL_COMPILER)
|
||
// Intel Compiler
|
||
// it has to be checked before the g++ and VC++ compilers since it also
|
||
// defines __GNUC__ or _MSC_VER
|
||
int intel_version_major = __INTEL_COMPILER / 100;
|
||
int intel_version_minor = (__INTEL_COMPILER - intel_version_major * 100) / 10;
|
||
CGAL_STDCOUT << "Intel@" << intel_version_major << "." << intel_version_minor;
|
||
CGAL_STDCOUT << CGAL_STDENDL;
|
||
#elif defined(__GNUC__)
|
||
// GNU cc
|
||
CGAL_STDCOUT << "GNU@" << __GNUC__ << "." << __GNUC_MINOR__;
|
||
# ifdef __GNUC_PATCHLEVEL__
|
||
CGAL_STDCOUT << "." << __GNUC_PATCHLEVEL__;
|
||
# endif
|
||
CGAL_STDCOUT << CGAL_STDENDL;
|
||
#elif defined(__sgi) && defined(_COMPILER_VERSION)
|
||
// SGI mipspro
|
||
CGAL_STDCOUT << "MIPSPRO";
|
||
# if (_MIPS_SIM == _OABI32)
|
||
CGAL_STDCOUT << " (o32)";
|
||
# elif (_MIPS_SIM == _NABI32)
|
||
CGAL_STDCOUT << " (n32)";
|
||
# elif (_MIPS_SIM == _ABI64)
|
||
CGAL_STDCOUT << " (64)";
|
||
# endif // _MIPS_SIM
|
||
CGAL_STDCOUT << "@";
|
||
output_first_ciff_separate(_COMPILER_VERSION, 10);
|
||
CGAL_STDCOUT << CGAL_STDENDL;
|
||
#elif defined(__SUNPRO_CC)
|
||
// SUN workshop
|
||
CGAL_STDCOUT << "SUNPRO";
|
||
# ifdef __sparcv9
|
||
CGAL_STDCOUT << " (v9)";
|
||
# endif // __sparcv9
|
||
CGAL_STDCOUT << "@" << std::hex;
|
||
output_first_ciff_separate(__SUNPRO_CC, 16);
|
||
CGAL_STDCOUT << CGAL_STDENDL;
|
||
#elif defined(__PGI)
|
||
// Portland Group Compiler
|
||
// There does not seem to be a way to find the compiler version from
|
||
// within the translation unit. So we cheat by passing it as a macro
|
||
// defined on the command line (based on "pgCC -V").
|
||
CGAL_STDCOUT << "PGCC@" << CGAL_PGCC_VERSION << CGAL_STDENDL;
|
||
#elif defined(_MSC_VER)
|
||
// Microsoft Visual C++
|
||
CGAL_STDCOUT << "VC++@" << _MSC_VER << CGAL_STDENDL;
|
||
#else
|
||
// we do not know this compiler --> add specs if supported
|
||
CGAL_STDCOUT << "unknown" << CGAL_STDENDL;
|
||
#endif
|
||
// this pleases (x)emacs font-lock-mode << e;
|
||
|
||
return 0;
|
||
}
|
||
EOF4
|
||
# set flags
|
||
EXE_OPT="-o "
|
||
case $1 in
|
||
*bcc32.exe*|*BCC32*) EXE_OPT="-P -e";;
|
||
*CL.*-1300*|*cl.*-1300*|*CL.*-1400*|*cl.*-1400*) EXE_OPT="-TP -GR -nologo -Fe";;
|
||
*ICL*|*icl*) EXE_OPT="-TP -GR -nologo -Fe";;
|
||
*CL*|*cl*) EXE_OPT="-TP -GR -nologo -Fe";;
|
||
*mwcc.exe*|*MWCC*) EXE_OPT="-gccincludes -lang c++ -msgstyle gcc -o ";;
|
||
*pgCC*|*pgcpp*) PGCC_VERSION=`$1 -V | ${_grep} -i pgc | ${_sed} -e 's/ (.*)//g' | cut -d' ' -f2`
|
||
EXE_OPT="-DCGAL_PGCC_VERSION='\"$PGCC_VERSION\"' -o ";;
|
||
esac
|
||
_flags="${CUSTOM_CXXFLAGS} ${CUSTOM_LDFLAGS} ${EXE_OPT}${TMP_CXX_FILE} ${TMP_CXX_FILE}.cpp"
|
||
|
||
# compile
|
||
${_printf} "%s\n%s\n" "Compiler call:" "--------------" >"${TMP_LOGFILE}"
|
||
${_printf} "%s" "$1 ${_flags}" >>"${TMP_LOGFILE}"
|
||
${_printf} "\n\n%s\n" "Got the following error messages:" >>"${TMP_LOGFILE}"
|
||
${_printf} "%s\n" "---------------------------------" >>"${TMP_LOGFILE}"
|
||
eval "`quote $1` ${_flags} >>\"${TMP_LOGFILE}\" 2>&1"
|
||
if [ $? = 0 ]; then
|
||
log_print "Compiler version test compiled."
|
||
${_printf} "\n\n%s\n" "Execution:" >>"${TMP_LOGFILE}"
|
||
${_printf} "%s\n" "---------------------------------" >>"${TMP_LOGFILE}"
|
||
${TMP_CXX_FILE} >>"${TMP_LOGFILE}" 2>&1
|
||
if [ $? = 0 ]; then
|
||
_tmp3=`eval "\"${TMP_CXX_FILE}\" 2>&1"`
|
||
cleanup_after_compile
|
||
cleanup_after_link_run
|
||
return 0
|
||
elif [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
log_print "ERROR: Compiler version test execution failed."
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
print_empty_line
|
||
print_headline " Compiler version test execution failed"
|
||
print_center_line "You will be shown a log now ..."
|
||
wait_for_enter
|
||
${PAGER:-${_cat}} "${TMP_LOGFILE}"
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
wait_for_enter
|
||
else
|
||
${_printf} "%s\n\n" " execution failed."
|
||
${_cat} "${TMP_LOGFILE}"
|
||
${_printf} "%s\n\n" \
|
||
"--------------------------------------------------------"
|
||
fi
|
||
cleanup_after_compile
|
||
cleanup_after_link_run
|
||
return 1
|
||
else
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
log_print "ERROR: Compiler version test did NOT compile."
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
print_empty_line
|
||
print_headline "Compiler version test compilation failed"
|
||
print_center_line "You will be shown a log now ..."
|
||
wait_for_enter
|
||
${PAGER:-${_cat}} "${TMP_LOGFILE}"
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
wait_for_enter
|
||
else
|
||
${_printf} "%s\n\n" " compilation failed."
|
||
${_cat} "${TMP_LOGFILE}"
|
||
${_printf} "%s\n\n" \
|
||
"--------------------------------------------------------"
|
||
fi
|
||
cleanup_after_compile
|
||
cleanup_after_link_run
|
||
return 1
|
||
fi
|
||
}
|
||
|
||
# $1 is a compiler string
|
||
# print compiler basenam
|
||
compiler_basename()
|
||
{
|
||
${_printf} "%s\n" "${*:-${COMPILER}}" | \
|
||
${_awk} 'BEGIN {FS="@"} {printf "%s",$1}'
|
||
}
|
||
|
||
# $1 is a compiler string
|
||
# print compiler description
|
||
compiler_description()
|
||
{
|
||
${_printf} "%s\n" "${*:-${COMPILER}}" | \
|
||
${_awk} 'BEGIN {FS="@"} {printf "%s",$2}'
|
||
}
|
||
|
||
# $1 is a compiler string
|
||
# print compiler executable
|
||
c_compiler_bin()
|
||
{
|
||
${_printf} "%s\n" "${*:-${COMPILER}}" | \
|
||
${_awk} 'BEGIN {FS="@"} {printf "%s",$3}'
|
||
}
|
||
|
||
# $1 is a compiler string
|
||
# print compiler executable
|
||
compiler_bin()
|
||
{
|
||
${_printf} "%s\n" "${*:-${COMPILER}}" | \
|
||
${_awk} 'BEGIN {FS="@"} {printf "%s",$4}'
|
||
}
|
||
|
||
# $1 is a compiler string
|
||
# print compiler executable
|
||
compiler_version()
|
||
{
|
||
${_printf} "%s\n" "${*:-${COMPILER}}" | \
|
||
${_awk} 'BEGIN {FS="@"} {printf "%s",$5}'
|
||
}
|
||
|
||
# $1 is a compiler string
|
||
# print custom os tag
|
||
custom_ostype_tag()
|
||
{
|
||
# the tag should not start with underscore
|
||
# (consistent treatment of old _LEDA suffix)
|
||
${_printf} "%s\n" "${*:-${COMPILER}}" | \
|
||
${_awk} 'BEGIN {FS="@"} {printf "%s",$6}' | \
|
||
${_sed} 's/^_//'
|
||
}
|
||
|
||
# reassemble compiler string, i.e. adjust to CUSTOM_OSTYPE_TAG
|
||
reassemble_compiler()
|
||
{
|
||
COMPILER="`compiler_basename`@`compiler_description`@`c_compiler_bin`@`compiler_bin`@`compiler_version`@${CUSTOM_OSTYPE_TAG}"
|
||
}
|
||
|
||
# $1 is a compiler string
|
||
# print extended compiler description
|
||
extended_compiler_description()
|
||
{
|
||
${_printf} "%s\n" "${*:-${COMPILER}}" | \
|
||
${_awk} 'BEGIN {FS="@"} {printf "%s %s",$2,$5}'
|
||
_tmp4="`custom_ostype_tag \"${*:-${COMPILER}}\"`"
|
||
if [ -n "${_tmp4}" ]; then ${_printf} " (%s)" "${_tmp4}"; fi
|
||
${_printf} "\n"
|
||
}
|
||
|
||
|
||
# register compiler with description $*,
|
||
# iff there is no corresponding config file in CGAL_INSTALL_CONF_DIR
|
||
# (since in this case it already has been registered)
|
||
_check_and_register_compiler()
|
||
{
|
||
_ORIG_COMPILER="${COMPILER}"
|
||
COMPILER="${*}"
|
||
set_ostype
|
||
file="${CGAL_INSTALL_CONF_DIR}/${CGAL_OS_COMPILER}"
|
||
if [ -r "${file}" ]; then
|
||
try_to_get_var_from_config_file COMPILER "${file}"
|
||
if [ ${?} != 0 ]; then
|
||
log_print "${CGAL_OS_COMPILER} has already been registered."
|
||
else
|
||
_register_compiler "${*}"
|
||
fi
|
||
else
|
||
_register_compiler "${*}"
|
||
fi
|
||
COMPILER="${_ORIG_COMPILER}"
|
||
}
|
||
|
||
# register compiler with description $*
|
||
_register_compiler()
|
||
{
|
||
log_print \
|
||
"Found compiler `extended_compiler_description \"${*}\"`."
|
||
eval "_COMPILER_${_COMPILER_NUMBER}=\"${*}\""
|
||
eval "${_EXPR} ${_COMPILER_NUMBER} + 1"
|
||
_COMPILER_NUMBER=${_result}
|
||
}
|
||
|
||
# search for compiler and set COMPILER correspondingly
|
||
# $1 is the basename of the C compiler executable (e.g. cc)
|
||
# $2 is the basename of the C++ compiler executable (e.g. CC)
|
||
# if $3 is non-zero, don't register compiler
|
||
# return 0, iff found
|
||
_search_compiler()
|
||
{
|
||
if _check_for_util "$2" n _tmp1; then
|
||
_check_for_util "$1" n _tmp2
|
||
get_compiler_description "$2"
|
||
COMPILER="$2@`compiler_basename \"${_tmp3}\"`@${_tmp2}@${_tmp1}@`compiler_description \"${_tmp3}\"`@"
|
||
if [ -z "$3" ]; then
|
||
_check_and_register_compiler "${COMPILER}"
|
||
fi
|
||
return 0
|
||
fi
|
||
return 1
|
||
}
|
||
|
||
# $1 is a compiler string
|
||
# append $2 to basename $3 to the description field
|
||
# and $4 to the executable fields
|
||
_add_flags()
|
||
{
|
||
compiler_basename "$1"
|
||
${_printf} "%s" "$2@"
|
||
compiler_description "$1"
|
||
${_printf} "%s" "$3@"
|
||
c_compiler_bin "$1"
|
||
${_printf} "%s" "$4@"
|
||
compiler_bin "$1"
|
||
${_printf} "%s" "$4@"
|
||
compiler_version "$1"
|
||
}
|
||
|
||
# search for supported compilers
|
||
search_for_compilers()
|
||
{
|
||
_COMPILER_NUMBER=1
|
||
|
||
# first check, which config files exist
|
||
for i in `${_ls} "${CGAL_INSTALL_CONF_DIR}"/${SYST}* 2>/dev/null | ${_sed} 's/ //g'`
|
||
do
|
||
i="`echo ${i} | ${_sed} 's// /g'`"
|
||
try_to_get_var_from_config_file COMPILER "${i}"
|
||
if [ ${?} != 0 ]; then
|
||
_register_compiler "${COMPILER}"
|
||
fi
|
||
done
|
||
|
||
CUSTOM_OSTYPE_TAG=''
|
||
_search_compiler gcc g++ ''
|
||
case ${SYST} in
|
||
*SunOS*)
|
||
_search_compiler cc CC ''
|
||
;;
|
||
*CYGWIN*)
|
||
_search_compiler CL.EXE CL.EXE ''
|
||
_search_compiler ICL.EXE ICL.EXE ''
|
||
_search_compiler bcc32.exe bcc32.exe ''
|
||
_search_compiler mwcc.exe mwcc.exe ''
|
||
;;
|
||
esac
|
||
if [ ${_COMPILER_NUMBER} = 1 ]; then
|
||
exit_on_error "Couldn't find any compiler"
|
||
fi
|
||
_set_compiler 1
|
||
write_buffer "\n\n${_LEFTSPACE}Choosing compiler `extended_compiler_description`.\n"
|
||
flush_buffer
|
||
_choose_compiler
|
||
}
|
||
|
||
# our compiler shall be ${*} (absolute path)
|
||
# (used in non-interactive mode)
|
||
compiler_absolute()
|
||
{
|
||
_args="${*}"
|
||
_tmp="`_real_basename \"${*}\"`"
|
||
shift
|
||
${_printf} "%s" "${_tmp}"
|
||
# concat options - replace space by "-":
|
||
_tmp1=`${_printf} "%s\n" "${*}" | ${_sed} 's/"//g;s/ -/-/g' | \
|
||
${_sed} "s/'//g;s/ /-/g;s#/#-#g"`
|
||
if [ -n "${_tmp1}" ]; then
|
||
${_printf} "%s" "${_tmp1}"
|
||
fi
|
||
${_printf} "%s" "@"
|
||
get_compiler_description "${_args}"
|
||
compiler_basename "${_tmp3}"
|
||
${_printf} "%s" "@"
|
||
_tmp1=`_real_dirname "${_args}"`
|
||
if [ "${_tmp1}" != "." ]; then
|
||
${_printf} "%s" "${_tmp1}/"
|
||
fi
|
||
# guess C compiler:
|
||
case ${_tmp} in
|
||
g++) ${_printf} "%s" "gcc";;
|
||
xlC) ${_printf} "%s" "xlc";;
|
||
*) ${_printf} "%s" "cc";;
|
||
esac
|
||
_tmp1=`_real_options "${_args}"`
|
||
if [ -n "${_tmp1}" ]; then
|
||
${_printf} "%s" " ${_tmp1}"
|
||
fi
|
||
${_printf} "%s" "@${_args}@"
|
||
compiler_description "${_tmp3}"
|
||
${_printf} "%s" "@${CUSTOM_OSTYPE_TAG}"
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# 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
|
||
exit_on_error "Cannot evaluate \"${1}${2}${3}\" in _let_expr()"
|
||
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=`${_expr} ${1} \"${2}\" ${3}`"
|
||
if [ $? != 0 ]; then
|
||
exit_on_error "Cannot evaluate \"${1}\" in _expr_expr()"
|
||
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 | ${_bc}`"
|
||
if [ $? != 0 ]; then
|
||
exit_on_error "Cannot evaluate \"${1}\" in _bc_expr()"
|
||
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
|
||
elif _check_for_sysutil expr n; then
|
||
_EXPR=_expr_expr
|
||
elif _check_for_sysutil bc n; then
|
||
_EXPR=_bc_expr
|
||
else
|
||
exit_on_error "Cannot find either of \"expr\" or \"bc\"" \
|
||
"nor does /bin/sh support \"let\""
|
||
fi
|
||
log_print "use $_EXPR() for evaluating arithmetic expressions."
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# terminal related functions
|
||
# ---------------------------------------------------------------------
|
||
|
||
# ---------------------------------------------------------------------
|
||
# read an input string
|
||
# (since 'read' breaks its input according to field separator IFS
|
||
# (normally including space), we have to change IFS to be able
|
||
# to read multiword strings like needed for the custom compiler options)
|
||
# USES: _tmp
|
||
_read()
|
||
{
|
||
_tmp=${IFS}
|
||
IFS='
|
||
'
|
||
read KEY
|
||
IFS=${_tmp}
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# BUFFERED OUTPUT:
|
||
# for the sake of efficiency we buffer all output
|
||
|
||
clear_buffer()
|
||
{
|
||
_BUF=''
|
||
}
|
||
|
||
# print buffer
|
||
flush_buffer()
|
||
{
|
||
${_printf} "${_BUF}"
|
||
clear_buffer
|
||
}
|
||
|
||
# write $* to buffer
|
||
write_buffer()
|
||
{
|
||
_BUF="$_BUF$*"
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# STRING FUNCTIONS:
|
||
|
||
# USES: _tmp
|
||
remove_special_chars()
|
||
{
|
||
_read
|
||
echo "$KEY" | ${_tr} -d '\\!@#$%^&*()_|~";?<>{}\[\]\`/ '"'"
|
||
}
|
||
|
||
_set_indent()
|
||
{
|
||
_LEFTSPACE=' '
|
||
}
|
||
|
||
_full_indent()
|
||
{
|
||
_LEFTSPACE=' '
|
||
}
|
||
|
||
_no_indent()
|
||
{
|
||
_LEFTSPACE=''
|
||
}
|
||
|
||
# USES: _tmp
|
||
print_with_indent()
|
||
{
|
||
if [ -z "$*" ]; then
|
||
_read
|
||
${_printf} "${_LEFTSPACE}${KEY}\n"
|
||
else
|
||
${_printf} "${_LEFTSPACE}${*}\n"
|
||
fi
|
||
}
|
||
|
||
# USES: _tmp
|
||
print_as_shell_comment()
|
||
{
|
||
if [ -z "$*" ]; then
|
||
_read
|
||
${_printf} "# ${KEY}\n"
|
||
else
|
||
${_printf} "# ${*}\n"
|
||
fi
|
||
}
|
||
|
||
# print $2 times string $1 ($1 must not contain '@'!)
|
||
string_n_print()
|
||
{
|
||
_tmp=`eval "${_printf} \"\`${_printf} \"$1@$2\" | ${_awk} 'BEGIN {FS=\"@\"}
|
||
{ for ( i=0; i<$2; ++i) printf $1}'\`\""`
|
||
write_buffer "${_tmp}"
|
||
}
|
||
|
||
# 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} "%s" "$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()
|
||
{
|
||
string_n_print '\\\\\\n' $1
|
||
}
|
||
|
||
# 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 string $1 on possibly several lines
|
||
# bounded by two stars on each side
|
||
# (the lines are indented by 5 more chars, since this
|
||
# is only used for displaying the custom options)
|
||
print_multi_line()
|
||
{
|
||
_tmp=`${_printf} "%s" "$1" | \
|
||
eval "${_awk} \`${_printf} \"${_MULTILINE_LAYOUT_AWK_PROG}\"\`"`
|
||
write_buffer "${_tmp}"
|
||
}
|
||
|
||
# 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 "${_LEFTSPACE}**"
|
||
string_n_print " " $_result
|
||
write_buffer "$1"
|
||
lb=$_result
|
||
eval "$_EXPR $_MENU_WIDTH \* 10"
|
||
eval "$_EXPR $_result - $l"
|
||
eval "$_EXPR $_result - $lb"
|
||
string_n_print " " $_result
|
||
write_buffer "**\n"
|
||
}
|
||
|
||
# print a headline with text $1
|
||
print_headline()
|
||
{
|
||
print_center_line "$1"
|
||
length "`echo "$1"`"
|
||
l=$?
|
||
eval "$_EXPR $_MENU_WIDTH \* 10"
|
||
eval "$_EXPR $_result - $l"
|
||
eval "$_EXPR $_result / 2"
|
||
write_buffer "${_LEFTSPACE}**"
|
||
string_n_print " " $_result
|
||
string_n_print "=" $l
|
||
lb=$_result
|
||
eval "$_EXPR $_MENU_WIDTH \* 10"
|
||
eval "$_EXPR $_result - $l"
|
||
eval "$_EXPR $_result - $lb"
|
||
string_n_print " " $_result
|
||
write_buffer "**\n"
|
||
print_empty_line
|
||
}
|
||
|
||
# wait until enter is pressed
|
||
wait_for_enter()
|
||
{
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
print_center_line "Please press <ENTER> to continue."
|
||
print_filled_line
|
||
flush_buffer
|
||
read dummy
|
||
else
|
||
print_center_line "D O N E"
|
||
print_filled_line
|
||
flush_buffer
|
||
fi
|
||
}
|
||
|
||
# setup two strings for printing the menu
|
||
set_menu_lines()
|
||
{
|
||
# save buffer
|
||
_tmp3=${_BUF}
|
||
_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
|
||
eval "${_EXPR} ${_MENU_WIDTH} \* 10"
|
||
eval "${_EXPR} ${_result} - 10"
|
||
_MULTILINE_LAYOUT_AWK_PROG="'{ for (i=1; i <= length(\$0); i+=${_result}) printf \"${_MENU_LINE_EMPTY}"'\\r'"${_LEFTSPACE}** "'%%s''\\''\\n'"\",substr(\$0,i,${_result})}'"
|
||
_BUF=${_tmp3}
|
||
}
|
||
|
||
# set some variables for output
|
||
set_terminal_variables()
|
||
{
|
||
if _check_for_sysutil tput n; then
|
||
${_tput} smcup # turn on cup (see man terminfo)
|
||
_line_up=`${_tput} cuu1`"\r"
|
||
_bold_on=`${_tput} bold`
|
||
_bold_off=`${_tput} sgr0`
|
||
_clear_screen=`${_tput} clear`
|
||
_clear_end_of_display=`${_tput} ed`
|
||
eval "${_EXPR} ${_MENU_WIDTH} \* 10"
|
||
length "${_LEFTSPACE}"
|
||
eval "${_EXPR} ${_result} + $?"
|
||
# for two-star('**') border
|
||
eval "${_EXPR} ${_result} + 4"
|
||
if [ `${_tput} cols` -lt ${_result} ]; then
|
||
print_filled_line
|
||
print_line \
|
||
"${_bold_on}WARNING${_bold_off}: Your terminal screen is too narrow."
|
||
print_line "It should have at least ${_result} columns."
|
||
print_filled_line
|
||
wait_for_enter
|
||
fi
|
||
else
|
||
eval "${_EXPR} ${_MENU_WIDTH} \* 10"
|
||
length "${_LEFTSPACE}"
|
||
eval "${_EXPR} ${_result} + $?"
|
||
# for two-star('**') border
|
||
eval "${_EXPR} ${_result} + 4"
|
||
fi
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# FILE / DIR FUNCTIONS:
|
||
|
||
# try to read variable $1 from file $2
|
||
# return 0, iff something went wrong
|
||
try_to_get_var_from_config_file()
|
||
{
|
||
_awkprg="/ ${1}/"'{printf "%s=",$2; for (i=4; i<NF-1; ++i) printf "%s ",$(i); \
|
||
printf "%s\n",$(NF-1)}'
|
||
if try_to_get_var_from_file_aux "${_awkprg}" "${2}"; then
|
||
#log_print \
|
||
# "WARNING: cannot find field ${1} in file `${_basename} \"${2}\"`."
|
||
return 0
|
||
else
|
||
log_print "Cached ${1}... " `value_of ${1}`
|
||
return 1
|
||
fi
|
||
return 0
|
||
}
|
||
|
||
# try to read variable $1 from file $2
|
||
# $1 can be a list of variable names separated by | (example: "VAR1|VAR2|VAR3")
|
||
# return 0, iff something went wrong
|
||
try_to_get_var_from_file()
|
||
{
|
||
# Change the line into the shell syntax.
|
||
# Note: the line may contain several '=' characters.
|
||
_awkprg='BEGIN{ FS=" *= *" } /('"${1}"') *=/ {printf "%s=\"",$1; for (i=2; i<NF; i++) printf "%s=",$(i); printf "%s\"\n",$(NF)}'
|
||
if try_to_get_var_from_file_aux "${_awkprg}" "${2}"; then
|
||
#log_print \
|
||
#"WARNING: cannot find field ${1} in file `${_basename} \"${2}\"`."
|
||
return 0
|
||
else
|
||
return 1
|
||
fi
|
||
return 0
|
||
}
|
||
|
||
# apply the awk script $1 on file $2
|
||
# if the result is non empty, call the shell builtin eval on it and return 1
|
||
# else return 0
|
||
try_to_get_var_from_file_aux()
|
||
{
|
||
if [ -r "${2}" ]; then
|
||
_tmp2=`${_awk} "${1}" "${2}"`
|
||
# debug trace
|
||
if [ -n "$CGAL_DEBUG_GET_VAR_FROM_FILE" ]; then
|
||
${_printf} "\nawk '%s' %s\n%s\n" "${1}" "${2}" "${_tmp2}" >&2
|
||
fi
|
||
if [ -n "${_tmp2}" ]; then
|
||
eval "${_tmp2}"
|
||
return 1
|
||
fi
|
||
#else
|
||
#log_print "WARNING: cannot find file ${2}."
|
||
fi
|
||
return 0
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# THE MENUS:
|
||
# ---------------------------------------------------------------------
|
||
|
||
# ---------------------------------------------------------------------
|
||
# compiler menu
|
||
#
|
||
|
||
# cleanup after compilation
|
||
cleanup_after_compile_leave_source()
|
||
{
|
||
# remove sunpro template database
|
||
${_rm} -rf Templates.DB
|
||
# remove irix mipspro template database
|
||
${_rm} -rf ii_files
|
||
# remove tmp object file
|
||
${_rm} -f "${TMP_CXX_FILE}${OBJ_EXT}"
|
||
# remove log file
|
||
${_rm} -f "${TMP_LOGFILE}" "${TMPTMP_LOGFILE}"
|
||
# remove moc file
|
||
${_rm} -f "${TMP_CXX_FILE}.moc"
|
||
}
|
||
|
||
# cleanup after compilation
|
||
# (this is not called by _compile_test but has to be called
|
||
# by the caller of _compile_test,
|
||
# since it is not clear whether the files are still needed
|
||
# for linking or not)
|
||
cleanup_after_compile()
|
||
{
|
||
cleanup_after_compile_leave_source
|
||
# remove tmp C++ file
|
||
${_rm} -f "${TMP_CXX_FILE}.cpp"
|
||
}
|
||
|
||
# run a compiler test named $1, return 0, iff ok
|
||
# if $2 is empty, use standard compiler flags
|
||
# if $2 is non-empty, use it as compiler flags
|
||
# if $3 is non-empty, inform about eventually occurring problems
|
||
# if $4 is non-empty, it is the message to give
|
||
# in case compilation fails (defaults to 'no.')
|
||
# USES: _flags
|
||
_compile_test()
|
||
{
|
||
# add newlines to ${TMP_CXX_FILE}.cpp (ANSI)
|
||
${_printf} "\n\n" >> ${TMP_CXX_FILE}.cpp
|
||
${_printf} "%s" "${_LEFTSPACE}Testing for $1 ..."
|
||
|
||
# set flags
|
||
_flags="$2"
|
||
# _flags="${_flags} -c '`os_path ${TMP_CXX_FILE}.cpp`' `to_object_file_option ${TMP_CXX_FILE}`"
|
||
_flags="${_flags} -c '`os_path ${TMP_CXX_FILE}.cpp`'"
|
||
|
||
# compile
|
||
${_printf} "%s\n%s\n" "Compiler call:" "--------------" >"${TMP_LOGFILE}"
|
||
${_printf} "%s" "`compiler_bin` ${_flags}" >>"${TMP_LOGFILE}"
|
||
${_printf} "\n\n%s\n" "Got the following error messages:" >>"${TMP_LOGFILE}"
|
||
${_printf} "%s\n" "---------------------------------" >>"${TMP_LOGFILE}"
|
||
eval "`quote \`compiler_bin\`` ${_flags} >>\"${TMP_LOGFILE}\" 2>&1"
|
||
if [ $? = 0 ]; then
|
||
log_print " $1 test compiled."
|
||
return 0
|
||
else
|
||
if [ -n "$3" ]; then
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
log_print "ERROR: $1 test did NOT compile."
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
print_empty_line
|
||
print_headline "Compilation failed"
|
||
print_center_line "You will be shown a log now ..."
|
||
wait_for_enter
|
||
${PAGER:-${_cat}} "${TMP_LOGFILE}"
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
wait_for_enter
|
||
else
|
||
${_printf} "%s\n\n" " compilation failed."
|
||
${_cat} "${TMP_LOGFILE}"
|
||
${_printf} "%s\n\n" \
|
||
"--------------------------------------------------------"
|
||
fi
|
||
else
|
||
${_printf} "%s\n" " ${4:-no.}"
|
||
fi
|
||
log_print " remark: $1 test did not compile."
|
||
log_print " vvvvvvvvvvvv compiler messages below vvvvvvvvvvvv"
|
||
eval ${_awk} \'{print \"" "\",\$0}\' \"${TMP_LOGFILE}\" ${INSTALL_LOGFILE_REDIRECTION}
|
||
log_print " ^^^^^^^^^^^^ compiler messages above ^^^^^^^^^^^^"
|
||
return 1
|
||
fi
|
||
}
|
||
|
||
# cleanup after compilation
|
||
cleanup_after_link_run()
|
||
{
|
||
# remove executable and core
|
||
${_rm} -f "${TMP_CXX_FILE}" core
|
||
}
|
||
|
||
# run a link&run test named $1, return 0, iff ok
|
||
# $2 is libpath flags
|
||
# $3 is linker flags
|
||
# if $4 is non-zero, inform about eventually occurring problems
|
||
# $5 is message to print ("no" or "unfortunately") in case of failure.
|
||
# The program output is scanned for a line starting with the string
|
||
# version=
|
||
# and whatever comes after this is assigned to $6.
|
||
_link_run_test()
|
||
{
|
||
# set flags
|
||
_flags="`output_file_option ${TMP_CXX_FILE}` `object_file_name ${TMP_CXX_FILE}` ${START_LD_OPT} ${2} ${3}"
|
||
# link
|
||
_link="`compiler_bin`"
|
||
${_printf} "%s\n%s\n" "Linker call:" "--------------" >"${TMP_LOGFILE}"
|
||
${_printf} "%s\n\n" "${_link} ${_flags}" >>"${TMP_LOGFILE}"
|
||
${_printf} "%s\n" "Got the following error messages:" >>"${TMP_LOGFILE}"
|
||
${_printf} "%s\n" "---------------------------------" >>"${TMP_LOGFILE}"
|
||
eval "`quote ${_link}` ${_flags} >>\"${TMP_LOGFILE}\" 2>&1"
|
||
i=$?
|
||
j=1
|
||
if [ $i = 0 ]; then
|
||
log_print " $1 test linking succeeded."
|
||
# run
|
||
${_printf} "%s\n" \
|
||
"Run program `${_basename} \"${TMP_CXX_FILE}\"`:" >>"${TMP_LOGFILE}"
|
||
${_printf} "%s\n\n" \
|
||
"----------------------" >>"${TMP_LOGFILE}"
|
||
${_printf} "%s\n" "Got the following output:" >>"${TMP_LOGFILE}"
|
||
${_printf} "%s\n" "---------------------------------" >>"${TMP_LOGFILE}"
|
||
"${TMP_CXX_FILE}" >"${TMPTMP_LOGFILE}" 2>&1
|
||
j=$?
|
||
_tmp=`${_cat} "${TMPTMP_LOGFILE}" | ${_tee} -a "${TMP_LOGFILE}" | ${_awk} 'BEGIN{FS="="} /^version=/{print $2}' | remove_special_chars`
|
||
if [ $j = 0 ]; then
|
||
log_print " $1 test execution succeeded."
|
||
if [ -n "${6}" ]; then
|
||
if [ -n "${_tmp}" ]; then
|
||
eval "$6=\"${_tmp}\""
|
||
else
|
||
eval "$6=0"
|
||
fi
|
||
fi
|
||
else
|
||
if [ -n "${4}" ]; then
|
||
log_print "ERROR: $1 test execution FAILED."
|
||
else
|
||
log_print " remark: $1 test execution failed."
|
||
fi
|
||
fi
|
||
else
|
||
if [ -n "${4}" ]; then
|
||
log_print "ERROR: $1 test linking FAILED."
|
||
else
|
||
log_print " remark: $1 test linking failed."
|
||
fi
|
||
fi
|
||
if [ $j = 0 -a $i = 0 ]; then
|
||
${_printf} "%s\n" " ok."
|
||
cleanup_after_link_run
|
||
return 0
|
||
else
|
||
if [ -n "${4}" ]; then
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
log_print "ERROR: $1 test FAILED."
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
print_empty_line
|
||
print_headline "Linking or execution failed"
|
||
print_center_line "You will be shown a log now ..."
|
||
wait_for_enter
|
||
${PAGER:-${_cat}} "${TMP_LOGFILE}"
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
wait_for_enter
|
||
else
|
||
${_printf} "%s\n\n" " linking or execution failed."
|
||
${_cat} "${TMP_LOGFILE}"
|
||
${_printf} "%s\n\n" \
|
||
"--------------------------------------------------------"
|
||
fi
|
||
else
|
||
${_printf} "%s\n" " ${5:-no.}"
|
||
fi
|
||
log_print " vvvvvvvvvvvv linker/runtime messages below vvvvvvvvvvvv"
|
||
eval ${_awk} \'{print \"" "\",\$0}\' \"${TMP_LOGFILE}\" ${INSTALL_LOGFILE_REDIRECTION}
|
||
log_print " ^^^^^^^^^^^^ linker/runtime messages above ^^^^^^^^^^^^"
|
||
cleanup_after_link_run
|
||
return 1
|
||
fi
|
||
}
|
||
|
||
|
||
# set variable CGAL_OS_COMPILER according to the current
|
||
# compiler settings
|
||
set_ostype()
|
||
{
|
||
CGAL_OS_COMPILER="${SYST}_`compiler_basename`"
|
||
if [ -n "`compiler_version`" ]; then
|
||
CGAL_OS_COMPILER="${CGAL_OS_COMPILER}-`compiler_version`"
|
||
fi
|
||
if [ -n "${CUSTOM_OSTYPE_TAG}" ]; then
|
||
CGAL_OS_COMPILER="${CGAL_OS_COMPILER}_${CUSTOM_OSTYPE_TAG}"
|
||
fi
|
||
}
|
||
|
||
# print the current os/compiler in a readable fashion
|
||
# $1 is the print command
|
||
# USES: i l _tmp
|
||
print_os_setting()
|
||
{
|
||
${1} "OS:\t\t\t\t${SYST}"
|
||
${1} "COMPILER:\t\t\t`extended_compiler_description`"
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
if [ -z "`value_of PROVIDE_PKG_${i}`" ]; then
|
||
_tmp="not supported"
|
||
elif [ x`value_of ${i}_VERSION` = x0 ]; then
|
||
_tmp="supported (unknown version)"
|
||
else
|
||
_tmp="supported (`value_of ${i}_VERSION`)"
|
||
fi
|
||
length "${_LEFTSPACE}${i}:"
|
||
l=${?}
|
||
if [ ${l} -lt 8 ]; then
|
||
${1} "${i}:\t\t\t\t${_tmp}"
|
||
else
|
||
if [ ${l} -lt 16 ]; then
|
||
${1} "${i}:\t\t\t${_tmp}"
|
||
else
|
||
if [ ${l} -lt 24 ]; then
|
||
${1} "${i}:\t\t${_tmp}"
|
||
else
|
||
${1} "${i}:\t${_tmp}"
|
||
fi
|
||
fi
|
||
fi
|
||
done
|
||
}
|
||
|
||
set_lib_compiled_flag()
|
||
{
|
||
# does there exist a lib for this os/compiler?
|
||
if [ -r "${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}/libCGAL.a" ]; then
|
||
LIB_COMPILED='ok'
|
||
CGAL_LIBNAME=libCGAL.a
|
||
else if [ -r "${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}/libCGAL${CGAL_SHARED_LIB_EXT}" ]; then
|
||
LIB_COMPILED='ok'
|
||
CGAL_LIBNAME=libCGAL${CGAL_SHARED_LIB_EXT}
|
||
else if [ -r "${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}/CGAL.lib" ]; then
|
||
LIB_COMPILED='ok'
|
||
CGAL_LIBNAME=CGAL.lib
|
||
else
|
||
LIB_COMPILED=''
|
||
fi; fi; fi
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# compiler related functions
|
||
#
|
||
|
||
# try to retrieve the compiler specific settings from
|
||
# file ${CGAL_INSTALL_CONF_DIR}/${CGAL_OS_COMPILER}
|
||
# USES: i j
|
||
retrieve_compiler_settings()
|
||
{
|
||
_file="${CGAL_INSTALL_CONF_DIR}/${CGAL_OS_COMPILER}"
|
||
_tmp_version=${CGAL_INSTALL_VERSION}
|
||
if try_to_get_var_from_config_file CGAL_INSTALL_VERSION "${_file}"; then
|
||
SETUP_COMPLETE=''
|
||
CGAL_INSTALL_VERSION=${_tmp_version}
|
||
elif [ "${_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 ${CGAL_INSTALL_CGAL} version."
|
||
SETUP_COMPLETE=''
|
||
CGAL_INSTALL_VERSION=${_tmp_version}
|
||
else
|
||
SETUP_COMPLETE='y'
|
||
fi
|
||
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
for j in INCL_DIR LIB_DIR VERSION; do
|
||
if try_to_get_var_from_config_file "${i}_${j}" "${_file}"; then
|
||
eval "${i}_${j}=''"
|
||
SETUP_COMPLETE=''
|
||
fi
|
||
done
|
||
eval "PROVIDE_PKG_${i}=''"
|
||
done
|
||
for i in ${SUPPORT_PKGS}; do
|
||
for j in SUPPORT; do
|
||
if try_to_get_var_from_config_file "${i}_${j}" "${_file}"; then
|
||
eval "${i}_${j}=''"
|
||
SETUP_COMPLETE=''
|
||
fi
|
||
done
|
||
if [ -n "`value_of \"${i}_SUPPORT\"`" ]; then
|
||
eval "${i}_TEST_PASSED=y"
|
||
for j in `value_of "${i}_PROVIDES"`; do
|
||
eval "PROVIDE_PKG_${j}=\"${i}\""
|
||
done
|
||
else
|
||
eval "${i}_TEST_PASSED=''"
|
||
fi
|
||
done
|
||
|
||
if try_to_get_var_from_config_file CUSTOM_CXXFLAGS "${_file}"; then
|
||
#CUSTOM_CXXFLAGS=''
|
||
SETUP_COMPLETE=''
|
||
fi
|
||
if try_to_get_var_from_config_file CUSTOM_LDFLAGS "${_file}"; then
|
||
#CUSTOM_LDFLAGS=''
|
||
SETUP_COMPLETE=''
|
||
fi
|
||
if try_to_get_var_from_config_file LONG_NAME_PROBLEM "${_file}"; then
|
||
LONG_NAME_PROBLEM=''
|
||
SETUP_COMPLETE=''
|
||
fi
|
||
if try_to_get_var_from_config_file ENABLE_SHARED "${_file}"; then
|
||
ENABLE_SHARED='y'
|
||
SETUP_COMPLETE=''
|
||
fi
|
||
if try_to_get_var_from_config_file ENABLE_STATIC "${_file}"; then
|
||
ENABLE_STATIC='y'
|
||
SETUP_COMPLETE=''
|
||
fi
|
||
|
||
set_lib_compiled_flag
|
||
reassemble_compiler
|
||
}
|
||
|
||
# used by store_compiler_settings to store variable $1
|
||
# into the config file
|
||
_store_install_config_variable()
|
||
{
|
||
${_printf} "%s\n" "/* $1 = '`value_of $1`' */"
|
||
}
|
||
|
||
# store the actual compiler specific settings to the
|
||
# file ${CGAL_INSTALL_CONF_DIR}/${CGAL_OS_COMPILER}
|
||
store_compiler_settings()
|
||
{
|
||
_file="${CGAL_INSTALL_CONF_DIR}/${CGAL_OS_COMPILER}"
|
||
${_printf} "%s\n" "/*" >${_file}
|
||
${_printf} "%s\n" "** file: `$_basename \"${_file}\"`" >>${_file}
|
||
${_printf} "%s\n" "** Configuration file for CGAL ${CGAL_VERSION}" >>${_file}
|
||
${_printf} "%s\n" "** on `extended_compiler_description`" >>${_file}
|
||
${_printf} "%s%s\n" "** Automatically created by " \
|
||
"${CGAL_INSTALL_CGAL} ${CGAL_INSTALL_VERSION}." \
|
||
>>${_file}
|
||
${_printf} "%s\n" "** Please do not edit." >>${_file}
|
||
${_printf} "%s\n\n" "*/" >>${_file}
|
||
_store_install_config_variable COMPILER >>${_file}
|
||
_store_install_config_variable CGAL_INSTALL_VERSION >>${_file}
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
for j in INCL_DIR LIB_DIR VERSION; do
|
||
_store_install_config_variable "${i}_${j}" >>${_file}
|
||
done
|
||
done
|
||
for i in ${SUPPORT_PKGS}; do
|
||
for j in SUPPORT; do
|
||
_store_install_config_variable "${i}_${j}" >>${_file}
|
||
done
|
||
done
|
||
_store_install_config_variable CUSTOM_CXXFLAGS >>${_file}
|
||
_store_install_config_variable CUSTOM_LDFLAGS >>${_file}
|
||
_store_install_config_variable LONG_NAME_PROBLEM >>${_file}
|
||
_store_install_config_variable ENABLE_SHARED >>${_file}
|
||
_store_install_config_variable ENABLE_STATIC >>${_file}
|
||
|
||
${_printf} "\n%s\n" "/* EOF */" >>${_file}
|
||
log_print "Settings stored in ${_file}."
|
||
}
|
||
|
||
# test current setup and set SETUP_COMPLETE
|
||
# return 0, iff setup is ok
|
||
# USES: totest
|
||
test_setup()
|
||
{
|
||
SETUP_COMPLETE=''
|
||
make_lib_dir
|
||
|
||
cd "${CGAL_TEST_CONF_DIR}"
|
||
_check_dir_exists_create "${CGAL_INCL_CONF_DIR}/${CGAL_OS_COMPILER}"
|
||
_check_dir_exists_create "${CGAL_INCL_CONF_DIR}/${CGAL_OS_COMPILER}/CGAL"
|
||
_file="${CGAL_INCL_CONF_DIR}/${CGAL_OS_COMPILER}/CGAL/compiler_config.h"
|
||
|
||
if [ -z "${CONFIG_TEST_PASSED}" ]; then
|
||
print_filled_line
|
||
print_line "The following lines show results of configuration tests."
|
||
print_line "Some of the tests might fail, since many compilers are"
|
||
print_line "still not completely ISO standard compliant."
|
||
print_line "Since we worked around the arising problems,"
|
||
print_center_line "*** CGAL will work fine ***"
|
||
print_line "regardless of the outcome of these tests."
|
||
print_filled_line
|
||
flush_buffer
|
||
|
||
create_standard_header_replacements
|
||
test_compiler_specifica "${INSTALL_VERBOSE}"
|
||
|
||
for totest in ${SUPPORT_FEATURES}; do
|
||
${_printf} "%s%s\n" \
|
||
"//+----------------------------------------------------------" \
|
||
"----------------" \
|
||
>> ${_file}
|
||
${_printf} "%s\n" "//| Is CGAL compiled with support for ${totest}?" \
|
||
>> ${_file}
|
||
${_printf} "%s%s\n" \
|
||
"//+----------------------------------------------------------" \
|
||
"----------------" \
|
||
>> ${_file}
|
||
${_printf} "%s\n" "#ifndef CGAL_NO_${totest}" >> ${_file}
|
||
${_printf} "%s\n" "#define CGAL_${totest}_VERSION 0" >> ${_file}
|
||
${_printf} "%s\n" "//#define CGAL_USE_${totest} 1" >> ${_file}
|
||
${_printf} "%s\n\n" "#endif // ! CGAL_NO_${totest}" >> ${_file}
|
||
done
|
||
|
||
CONFIG_TEST_PASSED='y'
|
||
|
||
if [ -n "${CGAL_AUTOFIND_PKGS}" ]; then autofind_packages; fi
|
||
|
||
else
|
||
# try to autofind required features
|
||
for totest in ${SUPPORT_REQUIRED}; do
|
||
if [ -z "`value_of \"PROVIDE_PKG_${totest}\"`" ]; then
|
||
log_print "Remark: ${totest} is required, but not currently enabled."
|
||
autofind_feature "${totest}"
|
||
fi
|
||
done
|
||
fi
|
||
|
||
SETUP_COMPLETE='y'
|
||
|
||
# check requirements and incompatibilities
|
||
_tmp=`test_requirements_and_incompatibilities`
|
||
if [ $? = 0 ]; then
|
||
log_print "ERROR: ${_tmp}."
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
print_empty_line
|
||
print_headline "ERROR: ${_tmp}."
|
||
print_filled_line
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
wait_for_enter
|
||
else
|
||
flush_buffer
|
||
fi
|
||
SETUP_COMPLETE=''
|
||
return 1
|
||
fi
|
||
|
||
# check supported packages
|
||
cd "${CGAL_SUPPORT_DIR}"
|
||
for totest in ${SUPPORT_PKGS}; do
|
||
if [ -n "`value_of \"${totest}_SUPPORT\"`" ]; then
|
||
if test_support_pkg "${totest}" verbose; then
|
||
SETUP_COMPLETE=''
|
||
else
|
||
log_print "${totest} test passed."
|
||
fi
|
||
fi
|
||
done
|
||
|
||
# set CGAL_USE and VERSION tags in compiler_config file
|
||
for totest in ${SUPPORT_FEATURES}; do
|
||
_tmp2="#define CGAL_USE_${totest} 1"
|
||
_tmp3="//#define CGAL_USE_${totest} 1"
|
||
if [ -n "`value_of \"PROVIDE_PKG_${totest}\"`" ]; then
|
||
replace_line "${_file}" "${_tmp3}" "${_tmp2}"
|
||
else
|
||
replace_line "${_file}" "${_tmp2}" "${_tmp3}"
|
||
fi
|
||
_tmp2="${totest}_VERSION"
|
||
_tmp3="`value_of ${_tmp2}`"
|
||
replace_line "${_file}" "#define CGAL_${_tmp2}" \
|
||
"#define CGAL_${_tmp2} ${_tmp3:-0}"
|
||
done
|
||
|
||
cd "${CGAL_DIR}"
|
||
if [ -z "${SETUP_COMPLETE}" ]; then return 1; fi
|
||
|
||
${_printf} "%s" "${_LEFTSPACE}Saving current setup ..."
|
||
store_compiler_settings
|
||
${_printf} "%s\n" " done."
|
||
return 0
|
||
}
|
||
|
||
# called when the setup has been changed dramatically
|
||
# such that all previous test results are invalidated
|
||
# USES: ii
|
||
reset_all_test_variables()
|
||
{
|
||
CONFIG_TEST_PASSED=''
|
||
for ii in ${SUPPORT_PKGS}; do
|
||
eval "${ii}_TEST_PASSED=''"
|
||
done
|
||
}
|
||
|
||
# load the settings for ${COMPILER},
|
||
# if a config file exists, otherwise check for STL
|
||
# USES: ii
|
||
_choose_compiler()
|
||
{
|
||
log_print "Choosing `extended_compiler_description` as compiler."
|
||
CUSTOM_OSTYPE_TAG="`custom_ostype_tag`"
|
||
set_ostype
|
||
set_compiler_flags
|
||
retrieve_compiler_settings
|
||
if [ -z "${SETUP_COMPLETE}" ]; then
|
||
reset_all_test_variables
|
||
else
|
||
CONFIG_TEST_PASSED='y'
|
||
fi
|
||
}
|
||
|
||
# sets the CGAL_SUPPORT_COMPILER variable for CGAL_COMPILER to
|
||
# empty (unsupported) or 'y' (supported).
|
||
_set_support()
|
||
{
|
||
CGAL_SUPPORT_COMPILER=''
|
||
case `compiler_description` in
|
||
# *Borland*)
|
||
# case `compiler_version` in
|
||
# 5.5*) CGAL_SUPPORT_COMPILER='y';;
|
||
# esac
|
||
# ;;
|
||
# *SUNPRO*)
|
||
# case `compiler_version` in
|
||
# 5.5*) CGAL_SUPPORT_COMPILER='y';;
|
||
# esac
|
||
# ;;
|
||
# *MIPSPRO*n32*|*MIPSPRO*64*)
|
||
# case `compiler_version` in
|
||
# 7.[34]*) CGAL_SUPPORT_COMPILER='y';;
|
||
# esac
|
||
# ;;
|
||
*GNU*)
|
||
case `compiler_version` in
|
||
3.[34]*) CGAL_SUPPORT_COMPILER='y';;
|
||
[4567].*) CGAL_SUPPORT_COMPILER='y';;
|
||
esac
|
||
;;
|
||
*Intel*|*ICC*)
|
||
case `compiler_version` in
|
||
[789]*) CGAL_SUPPORT_COMPILER='y';;
|
||
esac
|
||
;;
|
||
*VC++*)
|
||
case `compiler_version` in
|
||
1310*) CGAL_SUPPORT_COMPILER='y';;
|
||
14*) CGAL_SUPPORT_COMPILER='y';;
|
||
esac
|
||
;;
|
||
esac
|
||
}
|
||
|
||
# set COMPILER to ${COMPILER}_$1 (for $1 in {1..${_COMPILER_NUMBER}-1})
|
||
_set_compiler()
|
||
{
|
||
if [ $1 -ge ${_COMPILER_NUMBER} ]; then
|
||
exit_on_error "Argument greater than expected" \
|
||
"(${1} >= ${_COMPILER_NUMBER}) in _set_compiler"
|
||
fi
|
||
_tmp=`eval "echo '$'_COMPILER_$1"`
|
||
_tmp=`eval "echo ${_tmp}"`
|
||
COMPILER=${_tmp}
|
||
_set_support
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# functions common to all menus
|
||
#
|
||
|
||
# used to build the string of supported third-party libraries
|
||
# $1 is supported, iff $2 is non-empty
|
||
_set_supported_library()
|
||
{
|
||
if [ -n "${2}" ]; then
|
||
if [ -n "${_SUPPORT}" ]; then
|
||
if [ -n "${_PRELASTSUPPORT}" ]; then
|
||
if [ -n "${_LASTSUPPORT}" ]; then
|
||
_SUPPORT="${_SUPPORT}, ${_PRELASTSUPPORT}"
|
||
_PRELASTSUPPORT="${_LASTSUPPORT}"
|
||
fi
|
||
_LASTSUPPORT="${1}"
|
||
else
|
||
_PRELASTSUPPORT="${1}"
|
||
fi
|
||
else
|
||
_SUPPORT="${1}"
|
||
fi
|
||
fi
|
||
}
|
||
|
||
# print current setup status, $1 is menu-name
|
||
# USES: i
|
||
menu_header()
|
||
{
|
||
_SUPPORT=''
|
||
_PRELASTSUPPORT=''
|
||
_LASTSUPPORT=''
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
_set_supported_library "${i}" "`value_of \"PROVIDE_PKG_${i}\"`"
|
||
done
|
||
if [ -n "${_LASTSUPPORT}" ]; then
|
||
_SUPPORT="${_SUPPORT}, ${_PRELASTSUPPORT}, and ${_LASTSUPPORT}"
|
||
elif [ -n "${_PRELASTSUPPORT}" ]; then
|
||
_SUPPORT="${_SUPPORT} and ${_PRELASTSUPPORT}"
|
||
elif [ -z "${_SUPPORT}" ]; then
|
||
_SUPPORT='no other library'
|
||
fi
|
||
_SUPPORT="Support for: ${_SUPPORT}."
|
||
clear_screen
|
||
print_filled_line
|
||
print_headline "CGAL $CGAL_VERSION Installation ${1} Menu"
|
||
print_line "OS: ${SYST}"
|
||
print_line "Compiler: `extended_compiler_description`"
|
||
flush_buffer
|
||
# print supported stuff nicely
|
||
echo "${_SUPPORT}" | ${_awk} "BEGIN {RS=\" \"; l=0; c=\"\" } {if (l+length(\$1) > 55) { printf \"${_MENU_LINE_EMPTY}\\r${_LEFTSPACE}** %s\\n\",c; c=\" \" \$1; l=13+length(\$1) } else { if (length(c)==0) { l+=length(\$1); c=\$1 } else { l+=length(\$1)+1; c=c \" \" \$1 } } } END { if (length(c)>0) { printf \"${_MENU_LINE_EMPTY}\\r${_LEFTSPACE}** %s\\n\",c } }"
|
||
print_empty_line
|
||
if [ -n "${CGAL_SUPPORT_COMPILER}" ]; then
|
||
print_line "Compiler is supported by CGAL."
|
||
else
|
||
print_line "Compiler is NOT supported by CGAL."
|
||
fi
|
||
if [ -z "${SETUP_COMPLETE}" ]; then
|
||
print_line "The setup has ${_bold_on}not${_bold_off} been tested."
|
||
else
|
||
print_line "The setup has been tested ${_bold_on}ok${_bold_off}."
|
||
fi
|
||
print_empty_line
|
||
}
|
||
|
||
# bottom lines for all menus, $1 is name of next-top menu
|
||
# USES: _tmp
|
||
menu_tailer()
|
||
{
|
||
print_empty_line
|
||
print_line "${_bold_on}<Q>${_bold_off} Back to ${1}"
|
||
print_empty_line
|
||
print_empty_line
|
||
print_empty_line
|
||
print_filled_line
|
||
go_up_lines 3
|
||
print_prompt "Your Choice: "
|
||
_read
|
||
}
|
||
|
||
# read a new value for variable $1
|
||
# USES: _tmp
|
||
change_value()
|
||
{
|
||
go_up_lines 1
|
||
print_prompt "New $1: "
|
||
_read
|
||
eval "$1=\"${KEY}\""
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# compiler_choose_menu to choose which compiler to use
|
||
# ($1 is the name of the next-higher menu)
|
||
|
||
compiler_choose_menu()
|
||
{
|
||
_OLD_COMPILER=${COMPILER}
|
||
while [ 0 ]; do
|
||
menu_header 'Choose Compiler'
|
||
i=1
|
||
while [ $i -lt ${_COMPILER_NUMBER} ]; do
|
||
_tmp=`eval "echo '$'_COMPILER_$i"`
|
||
_tmp=`eval "echo ${_tmp}"`
|
||
print_line \
|
||
"${_bold_on}<${i}>${_bold_off} `extended_compiler_description \"${_tmp}\"`"
|
||
eval "${_EXPR} ${i} + 1"
|
||
i=${_result}
|
||
done
|
||
print_line "${_bold_on}<R>${_bold_off} Register new compiler"
|
||
menu_tailer "$1"
|
||
|
||
case ${KEY} in
|
||
1|2|3|4|5|6|7|8|9)
|
||
if [ ${KEY} -lt ${_COMPILER_NUMBER} ]; then
|
||
_set_compiler ${KEY}
|
||
if [ "${_OLD_COMPILER}" != "${COMPILER}" ]; then
|
||
go_down_lines 3
|
||
flush_buffer
|
||
_choose_compiler
|
||
fi
|
||
return
|
||
fi
|
||
;;
|
||
r|R)
|
||
change_value COMPILER_NAME
|
||
# Reject if it's the name of an already registered compiler
|
||
i=1
|
||
while [ $i -lt ${_COMPILER_NUMBER} ]; do
|
||
_tmp=`eval "echo '$'_COMPILER_$i"`
|
||
_tmp=`eval "echo ${_tmp}"`
|
||
if [ "${COMPILER_NAME}" = "`compiler_bin ${_tmp}`" ]; then
|
||
return
|
||
fi
|
||
eval "${_EXPR} ${i} + 1"
|
||
i=${_result}
|
||
done
|
||
# Reject if it doesn't pass this test
|
||
if get_compiler_description ${COMPILER_NAME} ; then :
|
||
else
|
||
return
|
||
fi
|
||
COMPILER="`basename \"${COMPILER_NAME}\"`@`compiler_basename \"${_tmp3}\"`@${COMPILER_NAME}@${COMPILER_NAME}@`compiler_description \"${_tmp3}\"`@"
|
||
CUSTOM_OSTYPE_TAG=''
|
||
_check_and_register_compiler "${COMPILER}"
|
||
reset_all_test_variables
|
||
_choose_compiler
|
||
_set_support
|
||
SETUP_COMPLETE=''
|
||
return
|
||
;;
|
||
q|Q|b|B)
|
||
return
|
||
;;
|
||
esac
|
||
done
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# compiler_menu : setup compiler options.
|
||
#
|
||
|
||
compiler_menu()
|
||
{
|
||
while [ 0 ]; do
|
||
menu_header 'Compiler'
|
||
print_line "${_bold_on}<C>${_bold_off} Choose compiler"
|
||
print_line "${_bold_on}<F>${_bold_off} Set custom compiler flags"
|
||
print_multi_line "${CUSTOM_CXXFLAGS:-<none>}"
|
||
print_line "${_bold_on}<L>${_bold_off} Set custom linker flags"
|
||
print_multi_line "${CUSTOM_LDFLAGS:-<none>}"
|
||
print_line "${_bold_on}<S>${_bold_off} Toggle shared/static libraries building"
|
||
if [ -n "${ENABLE_SHARED}" ]; then
|
||
if [ -n "${ENABLE_STATIC}" ]; then
|
||
print_multi_line "<shared+static>"
|
||
else
|
||
print_multi_line "<shared>"
|
||
fi
|
||
else
|
||
print_multi_line "<static>"
|
||
fi
|
||
print_line "${_bold_on}<O>${_bold_off} Set custom ostype tag"
|
||
print_multi_line "${CUSTOM_OSTYPE_TAG:-<none>}"
|
||
print_line "${_bold_on}<T>${_bold_off} Test (and save) setup"
|
||
menu_tailer 'Main Menu'
|
||
|
||
case ${KEY} in
|
||
c|C)
|
||
compiler_choose_menu 'Compiler Menu'
|
||
;;
|
||
f|F)
|
||
change_value CUSTOM_CXXFLAGS
|
||
reset_all_test_variables
|
||
SETUP_COMPLETE=''
|
||
;;
|
||
l|L)
|
||
change_value CUSTOM_LDFLAGS
|
||
reset_all_test_variables
|
||
SETUP_COMPLETE=''
|
||
;;
|
||
o|O)
|
||
change_value CUSTOM_OSTYPE_TAG
|
||
CUSTOM_OSTYPE_TAG=`echo ${CUSTOM_OSTYPE_TAG} | remove_special_chars`
|
||
reassemble_compiler
|
||
_register_compiler "${COMPILER}"
|
||
_choose_compiler
|
||
reset_all_test_variables
|
||
SETUP_COMPLETE=''
|
||
;;
|
||
s|S)
|
||
if [ -n "${ENABLE_SHARED}" ]; then
|
||
if [ -n "${ENABLE_STATIC}" ]; then
|
||
ENABLE_SHARED=''
|
||
else
|
||
ENABLE_STATIC='y'
|
||
fi
|
||
else
|
||
ENABLE_SHARED='y'
|
||
ENABLE_STATIC=''
|
||
fi
|
||
#reset_all_test_variables
|
||
SETUP_COMPLETE=''
|
||
;;
|
||
t|T)
|
||
go_down_lines 3
|
||
flush_buffer
|
||
test_setup
|
||
;;
|
||
q|Q|b|B)
|
||
return
|
||
;;
|
||
esac
|
||
done
|
||
}
|
||
|
||
# $1 is the command to execute and $2 its description
|
||
# if the command fails, exit with an error message
|
||
_do_command()
|
||
{
|
||
${_printf} "%s" "${_LEFTSPACE}$2 ..."
|
||
if eval "$1 >\"${TMP_LOGFILE}\" 2>&1"; then
|
||
log_print "\"$2\" succeeded."
|
||
${_printf} "%s\n" " done."
|
||
${_rm} -f "${TMP_LOGFILE}"
|
||
else
|
||
log_print "ERROR: \"$2\" failed."
|
||
${PAGER:-${_cat}} "${TMP_LOGFILE}"
|
||
${_rm} -f "${TMP_LOGFILE}"
|
||
exit_on_error "\"$2\" failed"
|
||
fi
|
||
}
|
||
|
||
# $1 is the command to execute and $2 its description
|
||
# if the command fails, show the log and return 1,
|
||
# otherwise return 0
|
||
_do_command_may_fail()
|
||
{
|
||
${_printf} "%s" "${_LEFTSPACE}$2 ..."
|
||
if eval "$1 >\"${TMP_LOGFILE}\" 2>&1"; then
|
||
log_print "\"$2\" succeeded."
|
||
${_printf} "%s\n" " done."
|
||
${_rm} -f "${TMP_LOGFILE}"
|
||
return 0
|
||
else
|
||
log_print "ERROR: \"$2\" failed."
|
||
${_printf} "\n%s\n" "${_LEFTSPACE}\"$2\" failed."
|
||
${_printf} "%s\n" "${_LEFTSPACE}You will be shown a log now ..."
|
||
print_filled_line
|
||
wait_for_enter
|
||
${PAGER:-${_cat}} "${TMP_LOGFILE}"
|
||
${_rm} -f "${TMP_LOGFILE}"
|
||
return 1
|
||
fi
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# lib menu
|
||
#
|
||
|
||
leda_friend_injection_workaround() {
|
||
case `compiler_description` in
|
||
*GNU*)
|
||
if [ "${PROVIDE_PKG_LEDA}" != "" ] ; then
|
||
# NOTE: this is only needed for LEDA.
|
||
# rationale: currently, LEDA relies on the old g++ behaviour,
|
||
# where friend methods are injected in their surrounding namespace. this will probably
|
||
# be fixed in future versions. however, until then, this workaround is required.
|
||
case `compiler_version` in
|
||
# TODO: adjust to future versions of g++
|
||
4.[12345].*)
|
||
ADDITIONAL_CXXFLAGS="${ADDITIONAL_CXXFLAGS} -ffriend-injection";;
|
||
esac
|
||
fi
|
||
;;
|
||
esac
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# 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
|
||
# ---------------------------------------------------------------------
|
||
|
||
makefile_header()
|
||
{
|
||
${_printf} "\n%s\n" \
|
||
"#---------------------------------------------------------------------#"
|
||
${_printf} "%s\n" \
|
||
"# ${1}"
|
||
${_printf} "%s\n\n" \
|
||
"#---------------------------------------------------------------------#"
|
||
}
|
||
|
||
# print args, if string is not empty
|
||
# (empty strings on a line give problems with SGI make :()
|
||
makefile_print_line()
|
||
{
|
||
if [ -n "${*}" ]; then
|
||
${_printf} "\t%s \\\\\n" "${*}"
|
||
fi
|
||
}
|
||
|
||
# print args a s a continuation line, if not empty
|
||
makefile_print_continuationline()
|
||
{
|
||
if [ -n "${*}" ]; then
|
||
${_printf} " \\\\\n\t%s" "${*}"
|
||
fi
|
||
}
|
||
|
||
# print elements from variable $1 (separated by ) on a multiline
|
||
makefile_print_from_var()
|
||
{
|
||
_tmp="`value_of \"${1}\"`"
|
||
if [ -n "${_tmp}" ]; then
|
||
${_printf} "%s" "${_tmp}" | ${_awk} 'BEGIN {RS=""}{printf " \\\n\t%s",$0}'
|
||
fi
|
||
}
|
||
|
||
# USES: i _tmp
|
||
write_compiler_flags()
|
||
{
|
||
makefile_header "compiler flags" >> ${FILE}
|
||
print_as_shell_comment \
|
||
"For more information about the compiler flags see the installation guide.\n" \
|
||
>> ${FILE}
|
||
|
||
#
|
||
# CGAL_INCL_CONF_DIR
|
||
#
|
||
print_as_shell_comment "compiler specific configuration dir" >> ${FILE}
|
||
${_printf} "%s\\\\\n" "CGAL_INCL_CONF_DIR = " >> ${FILE}
|
||
${_printf} "\t" >>${FILE}
|
||
concat_path "\$(CGAL_INCL_DIR)" "CGAL" config "${CGAL_OS_COMPILER}" >> ${FILE}
|
||
${_printf} "\n\n" >>${FILE}
|
||
|
||
#
|
||
# CUSTOM_CXXFLAGS
|
||
#
|
||
print_as_shell_comment \
|
||
"*** Fill in any additional compiler flags you need ***" \
|
||
>> ${FILE}
|
||
${_printf} "%s\n\n" "CUSTOM_CXXFLAGS = ${CUSTOM_CXXFLAGS}" >> ${FILE}
|
||
${_printf} "%s\n\n" "CGAL_SHARED_LIB_EXT = ${CGAL_SHARED_LIB_EXT}" >> ${FILE}
|
||
|
||
#
|
||
# THIRD PARTY CXXFLAGS
|
||
#
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
if [ -n "`value_of \"PROVIDE_PKG_${i}\"`" ]; then
|
||
print_as_shell_comment "*** compiler flags for feature ${i} ***" >> ${FILE}
|
||
${_printf} "%s" "${i}_CXXFLAGS = " >> ${FILE}
|
||
set_feature_cxxflags "${i}"
|
||
makefile_print_from_var tmp_cxxflags >> ${FILE}
|
||
${_printf} "\n\n" >> ${FILE}
|
||
fi
|
||
done
|
||
for i in ${SUPPORT_PKGS}; do
|
||
if [ -n "`value_of \"${i}_SUPPORT\"`" ]; then
|
||
print_as_shell_comment "*** compiler flags for package ${i} ***" >> ${FILE}
|
||
${_printf} "%s" "${i}_PKG_CXXFLAGS = " >> ${FILE}
|
||
set_package_cxxflags "${i}"
|
||
makefile_print_from_var tmp_cxxflags >> ${FILE}
|
||
${_printf} "\n\n" >> ${FILE}
|
||
fi
|
||
done
|
||
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
if [ -n "`value_of \"PROVIDE_PKG_${i}\"`" ]; then
|
||
print_as_shell_comment "*** complete compiler flags for feature ${i} ***" >> ${FILE}
|
||
${_printf} "%s" "ALL_${i}_CXXFLAGS = " >> ${FILE}
|
||
${_printf} "\$(${i}_CXXFLAGS) \$(%s_PKG_CXXFLAGS)\n\n" "`value_of \"PROVIDE_PKG_${i}\"`" >> ${FILE}
|
||
fi
|
||
done
|
||
|
||
#
|
||
# LONG_NAME_PROBLEM_CXXFLAGS
|
||
#
|
||
print_as_shell_comment \
|
||
"*** to work around the long-name-problem with sun as/ld" >> ${FILE}
|
||
if [ -n "${LONG_NAME_PROBLEM}" ]; then
|
||
${_printf} "%s\n\n" "LONG_NAME_PROBLEM_CXXFLAGS = ${LONG_NAME_PROBLEM_CXXFLAGS}" \
|
||
>> ${FILE}
|
||
else
|
||
${_printf} "%s\n\n" "LONG_NAME_PROBLEM_CXXFLAGS =" >> ${FILE}
|
||
fi
|
||
|
||
#
|
||
# CGAL_CXXFLAGS
|
||
#
|
||
${_printf} "%s" "CGAL_CXXFLAGS = \$(strip" >> ${FILE}
|
||
makefile_print_continuationline "${ADDITIONAL_CXXFLAGS}" >> ${FILE}
|
||
makefile_print_continuationline "'-I\$(CGAL_INCL_CONF_DIR)'" >> ${FILE}
|
||
makefile_print_continuationline "'-I\$(CGAL_INCL_DIR)'" >> ${FILE}
|
||
makefile_print_continuationline "\$(CUSTOM_CXXFLAGS)" >> ${FILE}
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
if [ -n "`value_of \"PROVIDE_PKG_${i}\"`" ]; then
|
||
makefile_print_continuationline "\$(${i}_CXXFLAGS)" >> ${FILE}
|
||
fi
|
||
done
|
||
for i in ${SUPPORT_PKGS}; do
|
||
if [ -n "`value_of \"${i}_SUPPORT\"`" ]; then
|
||
makefile_print_continuationline "\$(${i}_PKG_CXXFLAGS)" >> ${FILE}
|
||
fi
|
||
done
|
||
makefile_print_continuationline ")" >> ${FILE}
|
||
${_printf} "\n\n" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_WINLIB_CXXFLAGS
|
||
#
|
||
${_printf} "%s\\\\\n" "CGAL_WINLIB_CXXFLAGS = " >> ${FILE}
|
||
${_printf} "\t%s\n\n" "\$(CGAL_LIB_CXXFLAGS)" >> ${FILE}
|
||
}
|
||
|
||
# write linker flags for a CGAL include makefile
|
||
# USES: i
|
||
write_linker_flags()
|
||
{
|
||
makefile_header "linker flags" >> ${FILE}
|
||
|
||
print_as_shell_comment \
|
||
"*** Flag to define the name of the produced executable ***" \
|
||
>> ${FILE}
|
||
${_printf} "%s%s\n\n" "EXE_OPT = " "${EXE_OPT}${SAVE_THE_BLANK}" >> ${FILE}
|
||
|
||
#
|
||
# THIRD PARTY LIBPATHFLAGS
|
||
#
|
||
RUNTIME_PATH=''
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
if [ -n "`value_of \"PROVIDE_PKG_${i}\"`" ]; then
|
||
print_as_shell_comment "*** libpath flags for feature ${i} ***" >> ${FILE}
|
||
${_printf} "%s" "${i}_LIBPATHFLAGS = " >> ${FILE}
|
||
set_feature_libpathflags "${i}"
|
||
_append_to RUNTIME_PATH "${tmp_runtimepath}" ""
|
||
makefile_print_from_var tmp_libpathflags >> ${FILE}
|
||
${_printf} "\n\n" >> ${FILE}
|
||
fi
|
||
done
|
||
|
||
#
|
||
# CGAL_LIBPATHFLAGS
|
||
#
|
||
print_as_shell_comment "*** libpath flags for CGAL ***" >> ${FILE}
|
||
${_printf} "%s\\\\\n\t" "CGAL_LIBPATHFLAGS = \$(strip " >> ${FILE}
|
||
libpath_option_pure `concat_path "\\\$(CGAL_LIB_DIR)" "\\\$(CGAL_OS_COMPILER)"` >> ${FILE}
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
if [ -n "`value_of \"PROVIDE_PKG_${i}\"`" ]; then
|
||
makefile_print_continuationline "\$(${i}_LIBPATHFLAGS)" >> ${FILE}
|
||
fi
|
||
done
|
||
if [ -n "${RUNTIME_LINKER_FLAG}" ]; then
|
||
if [ "${CGAL_DIR}" = "${CGAL_INSTALL_DIR}" ]; then
|
||
CGAL_FINAL_LIB_DIR="`concat_path \"\\\$(CGAL_LIB_DIR)\" \"\\\$(CGAL_OS_COMPILER)\"`"
|
||
else
|
||
CGAL_FINAL_LIB_DIR=`concat_path "${CGAL_INSTALL_DIR}" lib`
|
||
fi
|
||
RUNTIME_PATH="`split_up \"RUNTIME_PATH\" \":\"`"
|
||
if [ -z "${RUNTIME_PATH}" ]; then
|
||
makefile_print_continuationline \
|
||
"${RUNTIME_LINKER_FLAG}${CGAL_FINAL_LIB_DIR}" >> ${FILE}
|
||
else
|
||
makefile_print_continuationline \
|
||
"${RUNTIME_LINKER_FLAG}${CGAL_FINAL_LIB_DIR}:${RUNTIME_PATH}" >> ${FILE}
|
||
fi
|
||
fi
|
||
makefile_print_continuationline ")" >> ${FILE}
|
||
${_printf} "\n\n" >> ${FILE}
|
||
|
||
#
|
||
# CUSTOM_LDFLAGS
|
||
#
|
||
print_as_shell_comment \
|
||
"*** Fill in any additional linker flags you need ***" \
|
||
>> ${FILE}
|
||
${_printf} "%s\n\n" "CUSTOM_LDFLAGS = ${CUSTOM_LDFLAGS}" >> ${FILE}
|
||
|
||
#
|
||
# LONG_NAME_PROBLEM_LDFLAGS
|
||
#
|
||
print_as_shell_comment \
|
||
"*** to work around the long-name-problem with sun as/ld" >> ${FILE}
|
||
if [ -n "${LONG_NAME_PROBLEM}" ]; then
|
||
${_printf} "%s\n\n" "LONG_NAME_PROBLEM_LDFLAGS = ${LONG_NAME_PROBLEM_LDFLAGS}" \
|
||
>> ${FILE}
|
||
else
|
||
${_printf} "%s\n\n" "LONG_NAME_PROBLEM_LDFLAGS =" >> ${FILE}
|
||
fi
|
||
|
||
#
|
||
# CGAL_LIBPATH
|
||
#
|
||
if [ -n "${SEPARATE_LIBPATH}" ] ; then
|
||
${_printf} "%s\n\n" "CGAL_LD_LIBPATH =" >> ${FILE}
|
||
${_printf} "%s\n\n" "CGAL_LIBPATH = \$(CGAL_LIBPATHFLAGS)" >> ${FILE}
|
||
else
|
||
${_printf} "%s\n\n" "CGAL_LIBPATH =" >> ${FILE}
|
||
${_printf} "%s\n\n" "CGAL_LD_LIBPATH = \$(CGAL_LIBPATHFLAGS)" >> ${FILE}
|
||
fi
|
||
|
||
#
|
||
# THIRD PARTY LDFLAGS
|
||
#
|
||
for i in ${SUPPORT_PKGS}; do
|
||
if [ -n "`value_of \"${i}_SUPPORT\"`" ]; then
|
||
print_as_shell_comment "*** linker flags for package ${i} ***" >> ${FILE}
|
||
${_printf} "%s" "${i}_PKG_LDFLAGS = " >> ${FILE}
|
||
set_package_ldflags "${i}"
|
||
makefile_print_from_var tmp_ldflags >> ${FILE}
|
||
${_printf} "\n\n" >> ${FILE}
|
||
fi
|
||
done
|
||
|
||
#
|
||
# CGAL_CGAL_LDFLAGS
|
||
#
|
||
print_as_shell_comment "*** linker flags for CGAL ***" >> ${FILE}
|
||
${_printf} "%s" "CGAL_CGAL_LDFLAGS =" >> ${FILE}
|
||
makefile_print_continuationline "`lib_option \"CGAL\"`" >> ${FILE}
|
||
${_printf} "\n\n" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_LDFLAGS
|
||
#
|
||
${_printf} "%s" "CGAL_LDFLAGS = \$(strip" >> ${FILE}
|
||
makefile_print_continuationline "${START_LD_OPT}\$(CGAL_LD_LIBPATH) ${ADDITIONAL_LDFLAGS}" >> ${FILE}
|
||
makefile_print_continuationline "\$(CUSTOM_LDFLAGS)" >> ${FILE}
|
||
makefile_print_continuationline "\$(CGAL_CGAL_LDFLAGS)" >> ${FILE}
|
||
if [ -n "${libCGALCore_COMPILED}" ]; then
|
||
makefile_print_continuationline "`lib_option \"CGALcore++\"`" >> ${FILE}
|
||
fi
|
||
if [ -n "${libCGALQt_COMPILED}" ]; then
|
||
makefile_print_continuationline "`lib_option \"CGALQt\"`" >> ${FILE}
|
||
fi
|
||
if [ -n "${libCGALBenchmark_COMPILED}" ]; then
|
||
makefile_print_continuationline "`lib_option \"CGALBenchmark\"`" >> ${FILE}
|
||
fi
|
||
if [ -n "${libCGALimageIO_COMPILED}" ]; then
|
||
makefile_print_continuationline "`lib_option \"CGALimageIO\"`" >> ${FILE}
|
||
fi
|
||
if [ -n "${libCGALPDB_COMPILED}" ]; then
|
||
makefile_print_continuationline "`lib_option \"CGALPDB\"`" >> ${FILE}
|
||
fi
|
||
for i in ${R_SUPPORT_PKGS}; do
|
||
if [ -n "`value_of \"${i}_SUPPORT\"`" ]; then
|
||
makefile_print_continuationline "\$(${i}_PKG_LDFLAGS)" >> ${FILE}
|
||
fi
|
||
done
|
||
if [ -n "${CYGWIN_COMPILER}" ]; then
|
||
# Adding psapi.lib only for Windows needed for Memory_sizer
|
||
makefile_print_continuationline "`lib_option psapi`" >> ${FILE}
|
||
fi
|
||
if [ -n "${MATH_LIB}" ]; then
|
||
makefile_print_continuationline "`math_ldflags`" >> ${FILE}
|
||
fi
|
||
makefile_print_continuationline ")" >> ${FILE}
|
||
${_printf} "\n\n" >> ${FILE}
|
||
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
if [ -n "`value_of \"PROVIDE_PKG_${i}\"`" ]; then
|
||
print_as_shell_comment "*** linker flags for feature ${i} ***" >> ${FILE}
|
||
${_printf} "%s" "${i}_LDFLAGS = " >> ${FILE}
|
||
${_printf} "\$(%s_PKG_LDFLAGS)\n\n" "`value_of \"PROVIDE_PKG_${i}\"`" >> ${FILE}
|
||
fi
|
||
done
|
||
}
|
||
|
||
# create the include makefile for current configuration
|
||
# USES: i _tmp
|
||
create_include_makefile()
|
||
{
|
||
FILE=${CGAL_MAKEFILE}
|
||
|
||
print_as_shell_comment \
|
||
"This file contains CGAL makefile settings for the following platform:" \
|
||
> ${FILE}
|
||
print_os_setting 'print_as_shell_comment' >> ${FILE}
|
||
|
||
#
|
||
# CGAL_DIRECTORIES
|
||
#
|
||
makefile_header "include/lib directory settings" >> ${FILE}
|
||
${_printf} "%s\n" "CGAL_INCL_DIR = `os_path \"${CGAL_INCL_DIR}\"`" >> ${FILE}
|
||
${_printf} "%s\n" "CGAL_LIB_DIR = `os_path \"${CGAL_LIB_DIR}\"`" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_OS_COMPILER
|
||
#
|
||
makefile_header "os/compiler description" >> ${FILE}
|
||
${_printf} "%s\n" "CGAL_OS_COMPILER = ${CGAL_OS_COMPILER}" >> ${FILE}
|
||
|
||
#
|
||
# filename specific stuff
|
||
#
|
||
makefile_header "filename related flags" >> ${FILE}
|
||
${_printf} "%s\n" "OBJ_EXT = ${OBJ_EXT}" >> ${FILE}
|
||
${_printf} "%s\n" "EXE_EXT = ${EXE_EXT}" >> ${FILE}
|
||
${_printf} "%s\n" "LIB_SUFFIX = ${LIB_SUFFIX}" >> ${FILE}
|
||
|
||
#
|
||
# some specific compiler flags
|
||
#
|
||
makefile_header "some specific compiler flags" >> ${FILE}
|
||
${_printf} "%s\n" "OBJ_OPT = ${OBJ_OPT}" >> ${FILE}
|
||
${_printf} "%s\n" "DEBUG_OPT = ${DEBUG_OPT}" >> ${FILE}
|
||
${_printf} "%s\n" "START_LD_OPT = ${START_LD_OPT}" >> ${FILE}
|
||
${_printf} "%s\n" "LIBPATH_OPT = ${LIBPATH_OPT}" >> ${FILE}
|
||
${_printf} "%s\n" "LIB_OPT = ${LIB_OPT}" >> ${FILE}
|
||
${_printf} "%s\n" "RANLIB = ${RANLIB}" >> ${FILE}
|
||
|
||
#
|
||
# suffixes and rules
|
||
#
|
||
makefile_header "suffixes and rules" >> ${FILE}
|
||
${_printf} "%s\n" ".SUFFIXES: ${SUFFIX_LIST} .cpp .clean" >> ${FILE}
|
||
if [ -n "${EXE_EXT}" ]; then
|
||
${_printf} "\n.C:\n" >> ${FILE}
|
||
${_printf} "\t%s %s%s\n" "\$(MAKE)" '$*' "${EXE_EXT}" >> ${FILE}
|
||
${_printf} "\n.cpp:\n" >> ${FILE}
|
||
${_printf} "\t%s %s%s\n" "\$(MAKE)" '$*' "${EXE_EXT}" >> ${FILE}
|
||
fi
|
||
${_printf} "\n.C.clean:\n" >> ${FILE}
|
||
${_printf} "\trm -f \$*%s" "${EXE_EXT}" >> ${FILE}
|
||
if [ -n "${REMOVE_EXT_LIST}" ]; then
|
||
for extension in ${REMOVE_EXT_LIST}
|
||
do
|
||
${_printf} " \$*%s" "${extension}" >> ${FILE}
|
||
done
|
||
fi
|
||
${_printf} "\n\n" >> ${FILE}
|
||
|
||
|
||
${_printf} "\n.cpp.clean:\n" >> ${FILE}
|
||
${_printf} "\trm -f \$*%s" "${EXE_EXT}" >> ${FILE}
|
||
if [ -n "${REMOVE_EXT_LIST}" ]; then
|
||
for extension in ${REMOVE_EXT_LIST}
|
||
do
|
||
${_printf} " \$*%s" "${extension}" >> ${FILE}
|
||
done
|
||
fi
|
||
${_printf} "\n\n" >> ${FILE}
|
||
|
||
|
||
#
|
||
# CGAL_CXX
|
||
#
|
||
makefile_header "compiler" >> ${FILE}
|
||
${_printf} "%s\n" "CGAL_CXX = `quote ${CGAL_CXX}`" >> ${FILE}
|
||
|
||
write_compiler_flags
|
||
write_linker_flags
|
||
|
||
#
|
||
# QT_MOC
|
||
#
|
||
print_as_shell_comment "*** Qt meta object compiler executable ***" >> ${FILE}
|
||
if [ -n "`value_of \"PROVIDE_PKG_QT\"`" ]; then
|
||
${_printf} "%s\\\\\n" "QT_MOC = " >> ${FILE}
|
||
${_printf} "\t%s\n\n" "`posix_path \"${QTDIR}/bin/moc\"`" >> ${FILE}
|
||
else
|
||
print_as_shell_comment " (No Qt; therefore, we fake it...)" >> ${FILE}
|
||
${_printf} "%s\n\n" "QT_MOC = echo dummymoc" >> ${FILE}
|
||
fi
|
||
|
||
makefile_header "commands and flags for creating libraries" \
|
||
>> ${FILE}
|
||
|
||
#
|
||
# CGAL_(*)LIB
|
||
#
|
||
${_printf} "%s\n" "CGAL_STATIC_LIBNAME = ${CGAL_STATIC_LIBNAME}" >> ${FILE}
|
||
${_printf} "%s\n" "CGAL_SHARED_LIBNAME = ${CGAL_SHARED_LIBNAME}" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_LIB_CXXFLAGS
|
||
#
|
||
${_printf} "%s\\\\\n" "CGAL_LIB_CXXFLAGS = " >> ${FILE}
|
||
makefile_print_line "${CGAL_LIB_CXXFLAGS} ${CGAL_LIBS_OPTFLAGS}" >> ${FILE}
|
||
${_printf} "\t%s\n" "\$(CGAL_CXXFLAGS)" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_LIB_LDFLAGS
|
||
#
|
||
${_printf} "%s\n\n" "CGAL_LIB_LDFLAGS = ${CGAL_LIB_LDFLAGS}" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_STATIC_LIB_CREATE
|
||
#
|
||
${_printf} "%s\n" "CGAL_STATIC_LIB_CREATE = ${CGAL_STATIC_LIB_CREATE}" >> ${FILE}
|
||
${_printf} "%s\n" "CGAL_OBJ_PREFIX = ${CGAL_OBJ_PREFIX}" >> ${FILE}
|
||
${_printf} "%s\n" "CGAL_LIB_DESTINATION = '\$(CGAL_LIB_DIR)/\$(CGAL_OS_COMPILER)'" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_SHARED_LIB_CXXFLAGS
|
||
#
|
||
${_printf} "%s\\\\\n" "CGAL_SHARED_LIB_CXXFLAGS = " >> ${FILE}
|
||
makefile_print_line "${CGAL_SHARED_LIB_CXXFLAGS} ${CGAL_LIBS_OPTFLAGS}" >> ${FILE}
|
||
${_printf} "\t%s\n" "\$(CGAL_CXXFLAGS)" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_SHARED_LIB_LDFLAGS
|
||
#
|
||
${_printf} "CGAL_SHARED_LIB_LDFLAGS = \$(CGAL_LIBPATHFLAGS) \$(CUSTOM_LDFLAGS) %s" \
|
||
"${CGAL_SHARED_LIB_LDFLAGS}" >> ${FILE}
|
||
${_printf} "%s\n" >> ${FILE}
|
||
|
||
#
|
||
# CGAL_SHARED_LIB_CREATE
|
||
#
|
||
${_printf} "%s\n\n" \
|
||
"CGAL_SHARED_LIB_CREATE = ${CGAL_SHARED_LIB_CREATE} ${CGAL_SHARED_LIB_INSTALL_NAME} -o ''" \
|
||
>> ${FILE}
|
||
|
||
#
|
||
# CGAL_SHARED_LIBNAME_WITH_SOVERSION, CGAL_SHARED_LIBNAME_WITH_SOMAJOR, and CGAL_SHARED_LIB_SONAME
|
||
#
|
||
${_printf} "%s\n" \
|
||
"CGAL_SHARED_LIB_SONAME = ${CGAL_SHARED_LIB_SONAME}" >> ${FILE}
|
||
${_printf} "%s\n" \
|
||
"CGAL_SHARED_LIBNAME_WITH_SOMAJOR = ${CGAL_SHARED_LIBNAME_WITH_SOMAJOR}" >> ${FILE}
|
||
${_printf} "%s\n\n" \
|
||
"CGAL_SHARED_LIBNAME_WITH_SOVERSION = ${CGAL_SHARED_LIBNAME_WITH_SOVERSION}" >> ${FILE}
|
||
|
||
#
|
||
# PRINT_STACKTRACE_PROGRAM
|
||
#
|
||
print_as_shell_comment "*** only used for the testsuite" >> ${FILE}
|
||
print_as_shell_comment \
|
||
"*** program used to create stacktrace from coredump" >> ${FILE}
|
||
${_printf} "%s\n\n" \
|
||
"PRINT_STACKTRACE_PROGRAM = ${PRINT_STACKTRACE_PROGRAM}" \
|
||
>> ${FILE}
|
||
|
||
makefile_header "EOF" >> ${FILE}
|
||
}
|
||
|
||
|
||
#--------------------------------------------------------------------#
|
||
# replace_line <file> <string> <replacement>
|
||
# replaces all the lines in <file> that start with <string>
|
||
# with <replacement>
|
||
#--------------------------------------------------------------------#
|
||
|
||
replace_line()
|
||
{
|
||
if [ ! -f "$1" ] ; then
|
||
${_printf} "%s\n" "Error: could not open file $1 in replace_line()"
|
||
return
|
||
fi
|
||
if eval '${_sed} "\\^$2c\\
|
||
$3${_EXTRA_NEWLINE}" "$1" > "$1.TEMP"' ; then
|
||
${_rm} -f "$1"
|
||
${_mv} "$1.TEMP" "$1"
|
||
else
|
||
${_printf} "%s\n" "Error sed replacement failed in replace_line()"
|
||
fi
|
||
}
|
||
|
||
# log via $1
|
||
generatemakefiles()
|
||
{
|
||
_check_dir_exists "${CGAL_MAKE_DIR}"
|
||
_check_write "${CGAL_MAKE_DIR}"
|
||
# create ${CGAL_MAKEFILE}, if it does not exist
|
||
if [ ! -r "${CGAL_MAKEFILE}" ]; then
|
||
$1 "remark: `${_basename} \"${CGAL_MAKEFILE}\"` does not exist,"
|
||
$1 " creating."
|
||
else
|
||
$1 "remark: `${_basename} \"${CGAL_MAKEFILE}\"` already exists,"
|
||
$1 " saving as \".bak\"."
|
||
${_mv} "${CGAL_MAKEFILE}" "${CGAL_MAKEFILE}.bak"
|
||
fi
|
||
create_include_makefile
|
||
|
||
# for FILE in `${_ls} "${CGAL_EXAMPLE_DIR}"/*/makefile 2>/dev/null | ${_sed} 's/ //g'`; do
|
||
# FILE="`echo ${FILE} | ${_sed} 's// /g'`"
|
||
# replace_line "${FILE}" CGAL_MAKEFILE "CGAL_MAKEFILE = `multi_escape_special \"${CGAL_MAKEFILE}\"`"
|
||
# done
|
||
|
||
# if [ -d "${CGAL_TEST_DIR}" ]; then
|
||
# for FILE in `${_ls} "${CGAL_TEST_DIR}"/*/makefile 2>/dev/null | ${_sed} 's/ //g'`; do
|
||
# FILE="`echo ${FILE} | ${_sed} 's// /g'`"
|
||
# replace_line "${FILE}" CGAL_MAKEFILE "CGAL_MAKEFILE = `multi_escape_special \"${CGAL_MAKEFILE}\"`"
|
||
# done
|
||
# fi
|
||
|
||
}
|
||
|
||
# compile $1 $2
|
||
# $1 = libCGAL, libCGALCore, libCGALQt, libCGALBenchmark, libCGALimageIO ...
|
||
# $2 = static, shared
|
||
# return 0, iff success
|
||
_do_compile()
|
||
{
|
||
${_printf} "%s" "${_LEFTSPACE}Building $1 $2 ..."
|
||
if [ -f "${COMPILE_LOGFILE}" -a ! -w "${COMPILE_LOGFILE}" ]; then
|
||
${_rm} -f "${COMPILE_LOGFILE}"
|
||
fi
|
||
${_rm} -f *"${OBJ_EXT}"
|
||
MAKE_OPTION="-k CGAL_MAKEFILE=$CGAL_MAKEFILE"
|
||
|
||
case "$2" in
|
||
static)
|
||
if [ -z "${ENABLE_STATIC}" ]; then
|
||
${_printf} "%s\n" " skipped."
|
||
return 0
|
||
fi
|
||
MAKE_OPTION="${MAKE_OPTION} CXXFLAGS=\$(CGAL_LIB_CXXFLAGS) static_lib";;
|
||
shared)
|
||
if [ -z "${ENABLE_SHARED}" ]; then
|
||
${_printf} "%s\n" " skipped."
|
||
return 0
|
||
fi
|
||
MAKE_OPTION="${MAKE_OPTION} CXXFLAGS=\$(CGAL_SHARED_LIB_CXXFLAGS) shared_lib";;
|
||
esac
|
||
|
||
# Please correct the variable _buildlog_marker in the script
|
||
# "Testsuite/test/collect_cgal_testresults" if you modify the following
|
||
# variable _buildlog_marker.
|
||
_buildlog_marker="log for $1 $2 shown"
|
||
|
||
${_printf} "%s %s\n" "${MAKE}" "${MAKE_OPTION}" > "${COMPILE_LOGFILE}"
|
||
if ${MAKE} ${MAKE_OPTION} >"${COMPILE_LOGFILE}" 2>&1; then
|
||
log_print "Compilation of $1 $2 ${_libname} succeeded."
|
||
log_print "vvvvvvvvvvvv build ${_buildlog_marker} below vvvvvvvvvvvv"
|
||
eval ${_cat} \"${COMPILE_LOGFILE}\" ${INSTALL_LOGFILE_REDIRECTION}
|
||
log_print "^^^^^^^^^^^^ build ${_buildlog_marker} above ^^^^^^^^^^^^"
|
||
${_printf} "%s\n" " done."
|
||
ANY_LIB_COMPILED='y'
|
||
eval "${1}_COMPILED='y'"
|
||
eval "${1}_${2}_COMPILED='y'"
|
||
return 0
|
||
else
|
||
log_print "Compilation of $1 $2 ${_libname} failed."
|
||
log_print "vvvvvvvvvvvv error ${_buildlog_marker} below vvvvvvvvvvvv"
|
||
eval ${_cat} \"${COMPILE_LOGFILE}\" ${INSTALL_LOGFILE_REDIRECTION}
|
||
log_print "^^^^^^^^^^^^ error ${_buildlog_marker} above ^^^^^^^^^^^^"
|
||
${_printf} "\n%s\n" "${_LEFTSPACE}Compilation of $1 $2 failed."
|
||
${_printf} "%s\n" "${_LEFTSPACE}You will be shown a log now ..."
|
||
print_filled_line
|
||
wait_for_enter
|
||
${PAGER:-${_cat}} "${COMPILE_LOGFILE}"
|
||
write_buffer "\n"
|
||
return 1
|
||
fi
|
||
}
|
||
|
||
# make lib dir
|
||
make_lib_dir()
|
||
{
|
||
_libname="${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}"
|
||
_check_dir_exists_create "${_libname}"
|
||
_libname=`${_basename} "${_libname}"`
|
||
CGAL_MAKEFILE="${CGAL_MAKE_DIR}/makefile_${_libname}"
|
||
}
|
||
|
||
# create appropriate dirs and makefiles
|
||
make_makefiles()
|
||
{
|
||
# generate directoryfile and makefile:
|
||
${_printf} "%s" "${_LEFTSPACE}Generating Makefiles ..."
|
||
generatemakefiles log_print
|
||
${_printf} "%s\n" " done."
|
||
}
|
||
|
||
# USES: i _tmp
|
||
write_menu_information()
|
||
{
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
clear_screen
|
||
else
|
||
write_buffer "\n"
|
||
fi
|
||
print_filled_line
|
||
print_empty_line
|
||
print_headline "$1 CGAL ${CGAL_VERSION}"
|
||
print_filled_line
|
||
write_buffer "\n"
|
||
flush_buffer
|
||
print_os_setting 'print_with_indent'
|
||
${_printf} "\n"
|
||
}
|
||
|
||
# USES: i _tmp
|
||
build_cgal()
|
||
{
|
||
if [ -n "${ENABLE_SHARED}" ]; then
|
||
case ${CGAL_OS_COMPILER} in
|
||
*CYGWIN*)
|
||
${_printf} "%s\n" \
|
||
"${_LEFTSPACE}No shared libraries on this platform!"
|
||
ENABLE_SHARED='';;
|
||
*) ;;
|
||
esac
|
||
fi
|
||
cd "${CGAL_SRC_DIR}/CGAL"
|
||
if _do_compile libCGAL static; then
|
||
LIB_COMPILED='ok'
|
||
${_printf} "%s" "`print_os_setting 'print_with_indent'`" \
|
||
>> "${INSTALL_RIS_LOGFILE}"
|
||
${_printf} "\n${_LEFTSPACE}%s\n" \
|
||
"----------------------------------------------------------" \
|
||
>> "${INSTALL_RIS_LOGFILE}"
|
||
_do_compile libCGAL shared
|
||
if [ -d "${CGAL_SRC_DIR}/CGALQt" -a -n "${PROVIDE_PKG_QT}" ]; then
|
||
cd "${CGAL_SRC_DIR}/CGALQt"
|
||
_do_compile libCGALQt static
|
||
_do_compile libCGALQt shared
|
||
fi
|
||
# Move CGALBenchmark into libCGAL?
|
||
if [ -d "${CGAL_SRC_DIR}/Benchmark" -a -n "${PROVIDE_PKG_BOOST_PROGRAM_OPTIONS}" ]; then
|
||
cd "${CGAL_SRC_DIR}/Benchmark"
|
||
_do_compile libCGALBenchmark static
|
||
_do_compile libCGALBenchmark shared
|
||
fi
|
||
if [ -d "${CGAL_SRC_DIR}/CGALimageIO" ]; then
|
||
cd "${CGAL_SRC_DIR}/CGALimageIO"
|
||
_do_compile libCGALimageIO static
|
||
_do_compile libCGALimageIO shared
|
||
fi
|
||
if [ -d "${CGAL_SRC_DIR}/CGALPDB" ]; then
|
||
cd "${CGAL_SRC_DIR}/CGALPDB"
|
||
_do_compile libCGALPDB static
|
||
_do_compile libCGALPDB shared
|
||
fi
|
||
if [ -d "${CGAL_SRC_DIR}/CGALCore" -a -n "${PROVIDE_PKG_GMP}" ]; then
|
||
cd "${CGAL_SRC_DIR}/CGALCore"
|
||
_do_compile libCGALCore static
|
||
_do_compile libCGALCore shared
|
||
fi
|
||
fi
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
wait_for_enter
|
||
cd "${CGAL_DIR}"
|
||
}
|
||
|
||
lib_menu()
|
||
{
|
||
# NOTE:if you know a better place between compiler/support library setup
|
||
# and makefile generation, feel free to move the workaround elsewhere
|
||
leda_friend_injection_workaround
|
||
if [ -n "${SETUP_COMPLETE}" ]; then
|
||
write_menu_information "Compiling"
|
||
make_lib_dir
|
||
make_makefiles
|
||
build_cgal
|
||
create_include_makefile
|
||
else
|
||
log_print "The setup tests failed."
|
||
log_print "Therefore, no CGAL library is compiled."
|
||
${_printf} "\n%s\n%s\n\n" \
|
||
"${_LEFTSPACE}Error: Setup tests failed." \
|
||
"${_LEFTSPACE} Please correct your setup."
|
||
print_filled_line
|
||
wait_for_enter
|
||
if [ -z "${INSTALL_INTERACTIVE}" ]; then
|
||
exit 1
|
||
fi
|
||
fi
|
||
}
|
||
|
||
print_lib_information()
|
||
{
|
||
if [ -r "${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}/${CGAL_LIBNAME}" ]; then
|
||
print_line "Libs built: `_get_timestamp \"${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}/${CGAL_LIBNAME}\"`"
|
||
else
|
||
print_line "There are no libs for this os/compiler."
|
||
fi
|
||
}
|
||
|
||
# USES: _tmp
|
||
installation()
|
||
{
|
||
write_menu_information "Installing"
|
||
if [ "${CGAL_DIR}" = "${CGAL_INSTALL_DIR}" ]; then
|
||
log_print "CGAL_DIR == CGAL_INSTALL_DIR, hence no installation."
|
||
${_printf} "\n%s\n\n" \
|
||
"${_LEFTSPACE}Remark: No need to install, as CGAL_DIR == CGAL_INSTALL_DIR."
|
||
print_filled_line
|
||
wait_for_enter
|
||
return 1
|
||
fi
|
||
print_filled_line
|
||
print_empty_line
|
||
print_empty_line
|
||
print_empty_line
|
||
print_empty_line
|
||
print_filled_line
|
||
go_up_lines 4
|
||
print_line "Target Directory: ${CGAL_INSTALL_DIR}."
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
print_prompt "Do you want to install CGAL into this directory (y/N)? "
|
||
_read
|
||
if [ "${KEY}" != 'y' ]; then
|
||
return
|
||
fi
|
||
fi
|
||
|
||
# ok, go ahead...
|
||
go_down_lines 3; flush_buffer
|
||
_check_dir_exists_create "${CGAL_INSTALL_DIR}"
|
||
# this sets $CGAL_MAKEFILE:
|
||
make_lib_dir
|
||
|
||
# install header files
|
||
_CGAL_IDIR="${CGAL_INSTALL_DIR}/include"
|
||
_check_dir_exists_create "${_CGAL_IDIR}"
|
||
_do_command \
|
||
"cd \"${CGAL_INCL_DIR}\"; ${_tar} cf - . | (cd \"${_CGAL_IDIR}\"; ${_tar} xf -; mv CGAL/config/${CGAL_OS_COMPILER}/CGAL/compiler_config.h CGAL; rm -r CGAL/config)" \
|
||
"Install CGAL headers"
|
||
|
||
# install libraries
|
||
# remove ${CGAL_OS_COMPILER}
|
||
_CGAL_IDIR="${CGAL_INSTALL_DIR}/lib"
|
||
_check_dir_exists_create "${_CGAL_IDIR}"
|
||
_do_command \
|
||
"cd \"${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}\"; ${_tar} cf - . | (cd \"${_CGAL_IDIR}\"; ${_tar} xf -)" \
|
||
"Install CGAL libraries"
|
||
# On Darwin, the shared library identification name needs to be adjusted
|
||
case ${CGAL_OS_COMPILER} in
|
||
*Darwin*)
|
||
for i in `cd "${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}"; ls *${CGAL_SHARED_LIB_EXT}`; do
|
||
log_print "Fixing lib paths in" "${i}"
|
||
${_install_name_tool} -id "${_CGAL_IDIR}/${i}" "${_CGAL_IDIR}/${i}"
|
||
${_install_name_tool} -change "${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}/libCGAL.dylib" "${_CGAL_IDIR}/libCGAL.dylib" "${_CGAL_IDIR}/${i}"
|
||
done;;
|
||
esac
|
||
|
||
# install binaries
|
||
_CGAL_IDIR="${CGAL_INSTALL_DIR}/bin"
|
||
_check_dir_exists_create "${_CGAL_IDIR}"
|
||
_do_command \
|
||
"cd \"${CGAL_DIR}/scripts\"; ${_tar} cf - . | (cd \"${_CGAL_IDIR}\"; ${_tar} xf -)" \
|
||
"Install CGAL programs"
|
||
|
||
# install makefile
|
||
_CGAL_IDIR="${CGAL_INSTALL_DIR}/share/cgal"
|
||
_check_dir_exists_create "${_CGAL_IDIR}"
|
||
CGAL_INSTALL_MAKEFILE="${_CGAL_IDIR}/cgal.mk"
|
||
OS_CGAL_DIR=`os_path "${CGAL_DIR}"`
|
||
OS_CGAL_INSTALL_DIR=`os_path "${CGAL_INSTALL_DIR}"`
|
||
|
||
log_print "(${_cp} \"${CGAL_MAKEFILE}\" \"${CGAL_INSTALL_MAKEFILE}\")"
|
||
_do_command "(${_cp} \"${CGAL_MAKEFILE}\" \"${CGAL_INSTALL_MAKEFILE}\")" "Install CGAL Makefile"
|
||
|
||
TMP_CONCAT_LIBPATH=`concat_path "\\\$(CGAL_LIB_DIR)" "\\\$(CGAL_OS_COMPILER)"`
|
||
TMP_OLD_LIBPATH_OPTION=`libpath_option_pure "$TMP_CONCAT_LIBPATH"`
|
||
TMP_NEW_LIBPATH_OPTION=`libpath_option_pure '\$(CGAL_LIB_DIR)'`
|
||
|
||
${_mv} "${CGAL_INSTALL_MAKEFILE}" "${CGAL_INSTALL_MAKEFILE}.bak"
|
||
${_sed} -e "s${OS_CGAL_DIR}${OS_CGAL_INSTALL_DIR}g" \
|
||
-e "s'-I\$(CGAL_INCL_CONF_DIR)'" \
|
||
-e "s\$(CGAL_OS_COMPILER)" \
|
||
-e "s${TMP_OLD_LIBPATH_OPTION}${TMP_NEW_LIBPATH_OPTION}" "${CGAL_INSTALL_MAKEFILE}.bak" > "${CGAL_INSTALL_MAKEFILE}"
|
||
${_rm} "${CGAL_INSTALL_MAKEFILE}.bak"
|
||
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
wait_for_enter
|
||
cd "${CGAL_DIR}"
|
||
}
|
||
|
||
install_menu()
|
||
{
|
||
set_lib_compiled_flag
|
||
if [ -z "${LIB_COMPILED}" ]; then
|
||
log_print "CGAL library not found, hence no installation."
|
||
${_printf} "\n%s\n%s\n\n" \
|
||
"${_LEFTSPACE}Error: Could not find any CGAL library for this OS/compiler." \
|
||
"${_LEFTSPACE} You have to build the CGAL library first."
|
||
print_filled_line
|
||
wait_for_enter
|
||
return 1
|
||
fi
|
||
while [ 0 ]; do
|
||
menu_header 'Install'
|
||
print_lib_information
|
||
print_empty_line
|
||
print_line "${_bold_on}<D>${_bold_off} Change Installation root directory (Mac OS only)."
|
||
print_multi_line "${CGAL_INSTALL_DIR}"
|
||
print_line "${_bold_on}<I>${_bold_off} Install CGAL"
|
||
menu_tailer 'Main Menu'
|
||
|
||
case ${KEY} in
|
||
d|D)
|
||
OLD_INSTALL_DIR="${CGAL_INSTALL_DIR}"
|
||
change_value CGAL_INSTALL_DIR
|
||
;;
|
||
i|I)
|
||
installation
|
||
;;
|
||
q|Q|b|B)
|
||
return
|
||
;;
|
||
esac
|
||
done
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# $1 is the full name of a config file in config/install/*
|
||
# (re)build one function
|
||
# USES: ii
|
||
_build_one()
|
||
{
|
||
# use platform specific logfile
|
||
CONFIG_BASENAME="`${_basename} \"$1\"`"
|
||
INSTALL_LOGFILE="${INSTALL_LOGFILE_BASE}.${CONFIG_BASENAME}"
|
||
log_to_file_and_screen
|
||
log_print
|
||
log_print \
|
||
"--------------------------------------------------------"
|
||
log_print "Build on ${CONFIG_BASENAME}:"
|
||
log_print \
|
||
"--------------------------------------------------------"
|
||
log_to_file
|
||
try_to_get_var_from_config_file COMPILER "$1"
|
||
if [ -n "${COMPILER}" ]; then
|
||
CUSTOM_OSTYPE_TAG="`custom_ostype_tag`"
|
||
set_ostype
|
||
set_compiler_flags
|
||
# do transition from old config files (where the OS part was very verbose)
|
||
if [ ! -r "${CGAL_INSTALL_CONF_DIR}/${CGAL_OS_COMPILER}" ]; then
|
||
NEW_SYST="${SYST}"
|
||
old_guess_os
|
||
SYST="${OLD_SYST}"
|
||
set_ostype
|
||
OLD_LIBDIR="${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}"
|
||
retrieve_compiler_settings
|
||
# rename old config file to not match os in the future
|
||
${_mv} "${CGAL_INSTALL_CONF_DIR}/${CGAL_OS_COMPILER}" \
|
||
"${CGAL_INSTALL_CONF_DIR}/old_${CGAL_OS_COMPILER}"
|
||
SYST="${NEW_SYST}"
|
||
set_ostype
|
||
else
|
||
retrieve_compiler_settings
|
||
fi
|
||
case ${_WHAT_TO_DO} in
|
||
*rebuild*) reset_all_test_variables
|
||
test_setup;;
|
||
esac
|
||
lib_menu
|
||
installation
|
||
else
|
||
log_print "Cannot rebuild the library."
|
||
print_filled_line
|
||
print_empty_line
|
||
print_headline "Cannot build on ${CONFIG_BASENAME} !"
|
||
print_headline "No COMPILER defined in config/install/..."
|
||
print_filled_line
|
||
write_buffer "\n"
|
||
flush_buffer
|
||
fi
|
||
# restore main logfile
|
||
INSTALL_LOGFILE=${INSTALL_LOGFILE_BASE}
|
||
log_to_file
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# (re)build one function
|
||
#
|
||
build_one()
|
||
{
|
||
guess_os log_print
|
||
${_printf} "\n\n"
|
||
_build_one config/install/${BUILD_ONE_CONFIG}
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# (re)build all function
|
||
#
|
||
build_all()
|
||
{
|
||
guess_os log_print
|
||
${_printf} "\n\n"
|
||
for i in `${_ls} "${CGAL_INSTALL_CONF_DIR}"/${SYST}* 2>/dev/null | ${_sed} 's/ //g'`
|
||
do
|
||
i="`echo ${i} | ${_sed} 's// /g'`"
|
||
_build_one "$i"
|
||
done
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# test menu
|
||
#
|
||
# (It is now an undocumented feature, but Andreas still uses it.)
|
||
|
||
test_menu()
|
||
{
|
||
write_menu_information "Testing"
|
||
|
||
${_printf} "%s" "${_LEFTSPACE}Updating `$_basename \"${CGAL_TESTFILE}\"` ..."
|
||
_check_write "${CGAL_TESTFILE}"
|
||
replace_line "${CGAL_TESTFILE}" 'run_testsuite ' ""
|
||
${_printf} "%s" "run_testsuite ${CGAL_MAKE_DIR}/makefile_${CGAL_OS_COMPILER}" \
|
||
>> "${CGAL_TESTFILE}"
|
||
$_chmod 744 "${CGAL_TESTFILE}"
|
||
${_printf} "%s\n" " done."
|
||
|
||
${_printf} "%s\n" "${_LEFTSPACE}Starting ${CGAL_TESTFILE} ..."
|
||
cd "${CGAL_TEST_DIR}"
|
||
"${CGAL_TESTFILE}"
|
||
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
|
||
${PAGER:-${_cat}} "${TEST_LOGFILE}"
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
cd "${CGAL_DIR}"
|
||
wait_for_enter
|
||
return
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# upgrade
|
||
#
|
||
|
||
upgrade()
|
||
{
|
||
_check_read "${UPGRADE_FROM}"
|
||
_check_execute "${UPGRADE_FROM}"
|
||
# copy config install files
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
print_headline "Upgrading from ${UPGRADE_FROM}"
|
||
print_filled_line
|
||
print_line "copying config install files"
|
||
print_filled_line
|
||
flush_buffer
|
||
log_print "copy config install files ... "
|
||
#for i in ${UPGRADE_FROM}/config/install/*; do
|
||
# # check for old format
|
||
# case "`${_awk} 'BEGIN{FS=\".\"}/install_cgal/{print $0}' $i`"
|
||
#done
|
||
${_cp} -r "${UPGRADE_FROM}/config/install" "${CGAL_DIR}/config"
|
||
log_print "done."
|
||
|
||
# copy gmp header and libs
|
||
if [ -r "${UPGRADE_FROM}/include/gmp.h" ]; then
|
||
print_filled_line
|
||
print_line "!!! ATTENTION !!!"
|
||
print_line "You seem to have GMP installed in the CGAL directories."
|
||
print_line "This setup is no longer supported."
|
||
print_line "Please install gmp separately from CGAL."
|
||
print_filled_line
|
||
log_print "Error: GMP installation in CGAL directories is no longer supported."
|
||
log_print " You have to re-configure GMP support manually."
|
||
fi
|
||
print_headline "D O N E"
|
||
go_up_lines 1
|
||
print_filled_line
|
||
flush_buffer
|
||
log_print "done."
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# support menu
|
||
#
|
||
|
||
# translate a given integer $1 from [1..24]
|
||
# into the corresponding char from [1..9,A..P]
|
||
_int_to_char()
|
||
{
|
||
if [ ${1} -lt 10 ]; then
|
||
echo ${1}
|
||
else
|
||
echo ${1} | ${_awk} '{printf "%c\n",$1+55}'
|
||
fi
|
||
}
|
||
|
||
# $1 is the feature
|
||
support_feature_menu()
|
||
{
|
||
while [ 0 ]; do
|
||
menu_header "${1}"
|
||
print_line "${_bold_on}<0>${_bold_off} Auto-find library"
|
||
print_line "${_bold_on}<1>${_bold_off} Set ${1}_INCL_DIR"
|
||
_tmp3="`value_of \"${1}_INCL_DIR\"`"
|
||
print_multi_line "${_tmp3:-<not set>}"
|
||
print_line "${_bold_on}<2>${_bold_off} Set ${1}_LIB_DIR"
|
||
_tmp3="`value_of \"${1}_LIB_DIR\"`"
|
||
print_multi_line "${_tmp3:-<not set>}"
|
||
ii=3
|
||
_tmp3="`value_of PROVIDE_PKG_${1}`"
|
||
for jj in `value_of "SUPPORT_PKG_${1}"`; do
|
||
_tmp2="`value_of \"${jj}_DESCRIPTION\"`"
|
||
if [ -n "${_tmp2}" ]; then
|
||
_tmp2="${jj} (${_tmp2})"
|
||
else
|
||
_tmp2="${jj}"
|
||
fi
|
||
if [ "${_tmp3}" = "${jj}" ]; then
|
||
print_line "${_bold_on}<`_int_to_char ${ii}`>${_bold_off} Disable ${_tmp2}"
|
||
print_multi_line "--> provides ${1} support currently."
|
||
else
|
||
print_line "${_bold_on}<`_int_to_char ${ii}`>${_bold_off} Use ${_tmp2}"
|
||
fi
|
||
eval "${_EXPR} ${ii} + 1"
|
||
ii=${_result}
|
||
done
|
||
print_line "${_bold_on}<T>${_bold_off} Test (and save) setup"
|
||
menu_tailer 'Support Menu'
|
||
|
||
KEY=`echo "${KEY}" | ${_tr} '[:lower:]' '[:upper:]'`
|
||
case $KEY in
|
||
t|T) go_down_lines 3
|
||
flush_buffer
|
||
test_setup;;
|
||
q|Q) return;;
|
||
0) go_down_lines 3
|
||
flush_buffer
|
||
autofind_feature "${1}" ''
|
||
if [ -z "`value_of \"PROVIDE_PKG_${1}\"`" ]; then
|
||
write_buffer "\n"
|
||
print_filled_line
|
||
print_empty_line
|
||
print_headline "Sorry, could not find ${1}."
|
||
wait_for_enter
|
||
fi
|
||
;;
|
||
1) change_value "${1}_INCL_DIR"
|
||
eval "`value_of \"PROVIDE_PKG_${1}\"`_TEST_PASSED=''"
|
||
SETUP_COMPLETE=''
|
||
;;
|
||
2) change_value "${1}_LIB_DIR"
|
||
eval "`value_of \"PROVIDE_PKG_${1}\"`_TEST_PASSED=''"
|
||
SETUP_COMPLETE=''
|
||
;;
|
||
*)
|
||
ii=3
|
||
for jj in `value_of "SUPPORT_PKG_${1}"`; do
|
||
if [ "${KEY}" = "`_int_to_char ${ii}`" ]; then
|
||
_tmp3="`value_of PROVIDE_PKG_${1}`"
|
||
disable_support "${_tmp3}"
|
||
if [ "${_tmp3}" != "${jj}" ]; then
|
||
enable_support "${jj}"
|
||
eval "${jj}_TEST_PASSED=''"
|
||
fi
|
||
break
|
||
fi
|
||
eval "${_EXPR} ${ii} + 1"
|
||
ii=${_result}
|
||
done;;
|
||
esac
|
||
done
|
||
|
||
}
|
||
|
||
autofind_packages()
|
||
{
|
||
log_print "Trying to autofind 3rd party libraries..."
|
||
for pkg in ${SUPPORT_PKGS}; do
|
||
test_support_pkg "${pkg}" ''
|
||
if [ $? -eq 1 ]; then enable_support "${pkg}"; fi
|
||
done
|
||
}
|
||
|
||
# try to autofind a package that provides feature $1
|
||
autofind_feature()
|
||
{
|
||
if [ -z "`value_of \"PROVIDE_PKG_${1}\"`" ]; then
|
||
log_print "Trying to auto-find ${1}..."
|
||
for pkg in `value_of "SUPPORT_PKG_${1}"`; do
|
||
test_support_pkg "${pkg}" ''
|
||
if [ $? -eq 1 ]; then enable_support "${pkg}"; fi
|
||
done
|
||
fi
|
||
}
|
||
|
||
support_menu()
|
||
{
|
||
while [ 0 ]; do
|
||
menu_header 'Support'
|
||
print_line "${_bold_on}<0>${_bold_off} Auto-find all libraries"
|
||
i=1
|
||
for j in ${SUPPORT_FEATURES}; do
|
||
print_line "${_bold_on}<`_int_to_char ${i}`>${_bold_off} ${j} Menu"
|
||
eval "${_EXPR} ${i} + 1"
|
||
i=${_result}
|
||
done
|
||
|
||
print_line "${_bold_on}<T>${_bold_off} Test (and save) setup"
|
||
menu_tailer 'Main Menu'
|
||
|
||
KEY=`echo "${KEY}" | ${_tr} '[:lower:]' '[:upper:]'`
|
||
case $KEY in
|
||
t|T) go_down_lines 3
|
||
flush_buffer
|
||
test_setup;;
|
||
q|Q) return;;
|
||
0) go_down_lines 3
|
||
flush_buffer
|
||
autofind_packages;;
|
||
*)
|
||
i=1
|
||
for j in ${SUPPORT_FEATURES}; do
|
||
if [ "${KEY}" = "`_int_to_char ${i}`" ]; then
|
||
support_feature_menu "${j}"
|
||
break
|
||
fi
|
||
eval "${_EXPR} ${i} + 1"
|
||
i=${_result}
|
||
done;;
|
||
esac
|
||
done
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# main menu
|
||
#
|
||
|
||
# get timestamp of file $1 via ls
|
||
# (assumed to be in columns 6-8)
|
||
_get_timestamp()
|
||
{
|
||
${_ls} -l "$1" | ${_awk} '{printf "%s %s %s",$7,$6,$8}'
|
||
}
|
||
|
||
main_menu()
|
||
{
|
||
while [ 0 ]; do
|
||
menu_header 'Main'
|
||
print_lib_information
|
||
print_empty_line
|
||
print_line "${_bold_on}<C>${_bold_off} Compiler Menu"
|
||
print_line "${_bold_on}<S>${_bold_off} Support Menu"
|
||
print_line "${_bold_on}<T>${_bold_off} Test (and save) setup"
|
||
print_line "${_bold_on}<A>${_bold_off} Run all setup tests (no cache)"
|
||
print_empty_line
|
||
print_line "${_bold_on}<B>${_bold_off} Build CGAL Libraries"
|
||
print_line "${_bold_on}<I>${_bold_off} Install Menu"
|
||
if [ -d "${CGAL_TEST_DIR}" -a -n "${LIB_COMPILED}" ]; then
|
||
print_line "${_bold_on}<R>${_bold_off} Run CGAL testsuite"
|
||
fi
|
||
menu_tailer 'OS'
|
||
|
||
case $KEY in
|
||
c|C) compiler_menu;;
|
||
s|S) support_menu;;
|
||
i|I) install_menu;;
|
||
b|B)
|
||
if [ -z "${SETUP_COMPLETE}" ]; then
|
||
test_setup
|
||
fi
|
||
lib_menu
|
||
;;
|
||
a|A)
|
||
reset_all_test_variables
|
||
go_down_lines 3
|
||
flush_buffer
|
||
test_setup;;
|
||
t|T)
|
||
go_down_lines 3
|
||
flush_buffer
|
||
test_setup;;
|
||
r|R)
|
||
if [ -n "${LIB_COMPILED}" ]; then test_menu; fi;;
|
||
q|Q)
|
||
return;;
|
||
esac
|
||
done
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# MAIN BODY
|
||
#
|
||
|
||
# for command line parsing: check if ${*} is really a compiler
|
||
# with its full path and set _tmp to its basename
|
||
_check_comp_executable()
|
||
{
|
||
_tmp=`eval "_real_basename \"${*}\" 2>/dev/null"`
|
||
if [ -z "${_tmp}" ]; then
|
||
exit_on_error "basename returned empty string"
|
||
elif [ -z "${*}" ]; then
|
||
exit_on_error "Missing argument"
|
||
elif [ "`_real_dirname \"${*}\"`" != "." ]; then
|
||
if [ -z "${CYGWIN_COMPILER}" ]; then
|
||
_check_execute "${1}"
|
||
else
|
||
_check_execute "${*}"
|
||
fi
|
||
elif [ ! -x "${1}" ]; then
|
||
# that was not an absolute path -> try which
|
||
_tmp1="`real_which ${_tmp}`"
|
||
if [ -z "${_tmp1}" ]; then
|
||
exit_on_error "Cannot find \"${_tmp}\""
|
||
fi
|
||
_check_execute "${_tmp1}"
|
||
log_print "${_tmp} is ${_tmp1}."
|
||
fi
|
||
}
|
||
|
||
cgal_install_header()
|
||
{
|
||
${_printf} "\n%s\n" \
|
||
"--------------------------------------------------------"
|
||
${_printf} "%s\n" \
|
||
" This is the install script for CGAL ${CGAL_VERSION}."
|
||
${_printf} "%s\n\n" \
|
||
"--------------------------------------------------------"
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# functions for interactive modes:
|
||
#
|
||
|
||
startup()
|
||
{
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
${_printf} "."
|
||
log_to_file
|
||
else
|
||
log_to_file_and_screen
|
||
fi
|
||
|
||
log_print "Looking for GNU/make..."
|
||
# Verify that GNU Make exists:
|
||
# Check the content of the current ${MAKE} variable.
|
||
if [ -n "${MAKE}" ] && test_gmake "${MAKE}"; then
|
||
log_print 'GNU Make found in the environment variable \${MAKE}.'
|
||
# Search gmake in PATH
|
||
elif _check_for_util gmake q MAKE && test_gmake "${MAKE}"; then
|
||
log_print 'GNU Make found in \${PATH}.';
|
||
# Search gmake in standard directories
|
||
elif _check_for_sysutil gmake q MAKE && test_gmake "${MAKE}"; then
|
||
log_print "GNU Make found in standard directories.";
|
||
# Search make in PATH, or fail.
|
||
elif _check_for_util make y MAKE && test_gmake "${MAKE}"; then
|
||
log_print 'make found in \$PATH is GNU Make.';
|
||
else
|
||
exit_on_error "GNU Make not found - please install GNU Make"
|
||
fi
|
||
|
||
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then ${_printf} "."; fi
|
||
check_conf_dir
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then ${_printf} "."; fi
|
||
set_expr
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then ${_printf} "."; fi
|
||
set_menu_lines
|
||
if [ -n "${INSTALL_INTERACTIVE}" ]; then
|
||
${_printf} "."
|
||
set_terminal_variables
|
||
${_printf} "."
|
||
fi
|
||
guess_os 'log_print'
|
||
case ${SYST} in
|
||
*CYGWIN*) _check_for_sysutil cygpath y;;
|
||
*Darwin*) _check_for_sysutil install_name_tool y;;
|
||
esac
|
||
${_printf} "\n%s\n" \
|
||
"--------------------------------------------------------"
|
||
${_printf} "%s\n" "Settings from Command Line/Environment:"
|
||
${_printf} "%s\n" \
|
||
"--------------------------------------------------------"
|
||
flush_buffer
|
||
if [ -n "${INSTALL_INTERACTIVE}" -a -n "${INSTALL_VERBOSE}" ]; then
|
||
write_buffer "\n\n"
|
||
print_filled_line
|
||
wait_for_enter
|
||
fi
|
||
}
|
||
|
||
finish()
|
||
{
|
||
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 "${CGAL_INSTALL_CGAL} 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
|
||
#write_buffer "\nCGAL_LIB_DIR is\n${CGAL_LIB_DIR}/${CGAL_OS_COMPILER}\n"
|
||
write_buffer "\nRemember to set the CGAL_MAKEFILE environment variable, e.g.:"
|
||
case "$SHELL" in
|
||
*csh) write_buffer "\nsetenv CGAL_MAKEFILE \"";;
|
||
*) write_buffer "\nexport CGAL_MAKEFILE=\"";;
|
||
esac
|
||
if [ -n "${CGAL_INSTALL_MAKEFILE}" ]; then
|
||
write_buffer "${CGAL_INSTALL_MAKEFILE}\"\n\n"
|
||
else
|
||
write_buffer "${CGAL_MAKEFILE}\"\n\n"
|
||
fi
|
||
flush_buffer
|
||
}
|
||
|
||
|
||
# ---------------------------------------------------------------------
|
||
# command line parsing
|
||
#
|
||
|
||
set_compiler_from_command_line()
|
||
{
|
||
_check_comp_executable "${COMPILER}"
|
||
log_to_file
|
||
COMPILER="`compiler_absolute ${COMPILER}`"
|
||
if [ -z "${INSTALL_INTERACTIVE}" ]; then log_to_file_and_screen; fi
|
||
set_ostype
|
||
set_compiler_flags
|
||
}
|
||
|
||
# for variable setting:
|
||
# checks if $2 contains '='
|
||
# if so, sets variable $1 to the substring of $2 to the right of '='
|
||
# and returns 1
|
||
# otherwise sets variable $1 to $3 and returns 0
|
||
set_variable_from_command_line()
|
||
{
|
||
_tmp=`${_printf} "%s\n" "$2" | ${_awk} 'BEGIN {FS="="} {printf $2}'`
|
||
if [ -n "${_tmp}" ]; then
|
||
eval "$1=\"${_tmp}\""
|
||
write_buffer "${_LEFTSPACE}Set $1 to \"`value_of $1`\".\n"
|
||
return 1
|
||
elif [ -n "$3" ]; then
|
||
eval "$1=\"$3\""
|
||
write_buffer "${_LEFTSPACE}Set $1 to \"`value_of $1`\".\n"
|
||
return 0
|
||
else
|
||
exit_on_error "Argument \"${1}\" expected"
|
||
fi
|
||
}
|
||
|
||
# ---------------------------------------------------------------------
|
||
# Here starts the main part
|
||
#
|
||
|
||
_WHAT_TO_DO=''
|
||
_CONFLICT=''
|
||
|
||
# These six utilities are used before the call of check_for_utils().
|
||
_awk=awk
|
||
_sed=sed
|
||
_tee=tee
|
||
_printf=printf
|
||
_rm=rm
|
||
_cat=cat
|
||
|
||
CGAL_INSTALL_VERSION="`_install_version_number`"
|
||
|
||
ARGS="$*"
|
||
|
||
# temporary logfile, that do not dependent on ${CGAL_DIR}.
|
||
EXTRA_INSTALL_LOGFILE="${PWD}/tmp_install.log"
|
||
|
||
# first quickly process "trivial" commandline options
|
||
# (starting the whole parsing process would slowdown too much...)
|
||
case ${*} in
|
||
-version*|--version*|-VERSION*|--version*)
|
||
${_printf} "%s\n" "${CGAL_INSTALL_CGAL} is ${CGAL_INSTALL_VERSION}."
|
||
exit 0
|
||
;;
|
||
-ostype_tag*|--ostype_tag*|-OSTYPE_TAG*|--OSTYPE_TAG*) _tmp=thisisnotused;;
|
||
-os*|--os*|-OS*|--OS*)
|
||
_WHAT_TO_DO='ostype'
|
||
# legacy mode: used to have a compulsory compiler argument
|
||
if [ -n "$2" ]; then
|
||
case $2 in
|
||
# not sure whether it's ok to have empty statement here...
|
||
-*) _tmp=thisisnotused;;
|
||
*) COMPILER=$2; shift;;
|
||
esac
|
||
fi
|
||
shift
|
||
;;
|
||
esac
|
||
|
||
|
||
if [ -z "${_WHAT_TO_DO}" ]; then
|
||
initial_check
|
||
log_to_file_and_extra_buffer
|
||
check_for_utils
|
||
|
||
# ---------------------------------------------------------------------
|
||
# process environment variables
|
||
#
|
||
|
||
if [ -z "${CUSTOM_CXXFLAGS}" ]; then
|
||
if [ -n "$CXXFLAGS" ]; then
|
||
CUSTOM_CXXFLAGS="${CXXFLAGS}"
|
||
log_print 'Setting CUSTOM_CXXFLAGS from \$CXXFLAGS.'
|
||
fi
|
||
if [ -n "${CPPFLAGS}" ]; then
|
||
CUSTOM_CXXFLAGS="${CUSTOM_CXXFLAGS} ${CPPFLAGS}"
|
||
log_print 'Setting CUSTOM_CXXFLAGS from \$CPPFLAGS.'
|
||
fi
|
||
log_print "CUSTOM_CXXFLAGS is " ${CUSTOM_CXXFLAGS}
|
||
fi
|
||
if [ -z "${CUSTOM_LDFLAGS}" -a -n "${LDFLAGS}" ]; then
|
||
CUSTOM_LDFLAGS="${LDFLAGS}"
|
||
log_print 'Setting CUSTOM_LDFLAGS from \$LDFLAGS.'
|
||
log_print "CUSTOM_LDFLAGS is " ${CUSTOM_LDFLAGS}
|
||
fi
|
||
if [ -z "${COMPILER}" -a -n "${CXX}" ]; then
|
||
COMPILER="${CXX}"
|
||
log_print 'Setting COMPILER from \$CXX.'
|
||
fi
|
||
|
||
log_to_file
|
||
parse_support_options
|
||
log_to_file_and_extra_buffer
|
||
|
||
# --- begin parsing commandline options ---
|
||
while [ ${#} -gt 0 ]; do
|
||
# make everything lowercase and strip possible leading -- to -
|
||
_arg="`echo ${*} | ${_tr} '[:lower:]' '[:upper:]' | ${_sed} 's/^--/-/'`"
|
||
case ${_arg} in
|
||
-CGAL_DIR*)
|
||
if set_variable_from_command_line 'CGAL_DIR' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
set_dirs_dependant_on_cgal_dir
|
||
log_to_file_and_screen
|
||
log_print "CGAL_DIR has been changed. Redo initial checks..."
|
||
initial_check
|
||
log_print "CGAL_DIR has been changed. The log file has been reinitialized."
|
||
log_print "Old part of the log file between vvvv and ^^^^:"
|
||
log_print "vvvv"
|
||
flush_extra_buffer
|
||
log_print "^^^^"
|
||
log_print "Redo parsing of support specfiles..."
|
||
parse_support_options
|
||
shift; continue
|
||
;;
|
||
-PREFIX*)
|
||
if set_variable_from_command_line 'CGAL_INSTALL_DIR' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
shift; continue
|
||
;;
|
||
-WITHOUT-AUTOFIND*)
|
||
CGAL_AUTOFIND_PKGS=''
|
||
shift; continue
|
||
;;
|
||
esac
|
||
MATCH=''
|
||
for i in ${SUPPORT_FEATURES}; do
|
||
case ${_arg} in
|
||
-${i}_INCL_DIR*|-${i}_INCLDIR*)
|
||
if set_variable_from_command_line "${i}_INCL_DIR" "$1" "$2"; then
|
||
shift
|
||
fi
|
||
MATCH=y
|
||
;;
|
||
-${i}_LIB_DIR*|-${i}_LIBDIR*)
|
||
if set_variable_from_command_line "${i}_LIB_DIR" "$1" "$2"; then
|
||
shift
|
||
fi
|
||
MATCH=y
|
||
;;
|
||
esac
|
||
if [ -n "${MATCH}" ]; then break; fi
|
||
done
|
||
if [ -n "${MATCH}" ]; then shift; continue; fi
|
||
for i in ${R_SUPPORT_PKGS}; do
|
||
case ${_arg} in
|
||
-WITH-${i}*)
|
||
enable_support "${i}"
|
||
write_buffer "${_LEFTSPACE}Enable ${i} support.\n"
|
||
MATCH=y
|
||
;;
|
||
esac
|
||
if [ -n "${MATCH}" ]; then break; fi
|
||
done
|
||
if [ -n "${MATCH}" ]; then shift; continue; fi
|
||
# added default action of build it
|
||
case ${_arg} in
|
||
-QT_DIR*)
|
||
warn_deprecated ${1}
|
||
if set_variable_from_command_line 'QT_DIR' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
;;
|
||
-QT_MOC*)
|
||
warn_deprecated ${1}
|
||
if set_variable_from_command_line 'QT_MOC' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
;;
|
||
-QT*) warn_deprecated ${1};;
|
||
-CXXFLAGS*|-CUSTOM_CXXFLAGS*)
|
||
if set_variable_from_command_line 'CUSTOM_CXXFLAGS' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
;;
|
||
-CXX*)
|
||
# legacy mode: COMPILER might have been set from -ni
|
||
# if [ -n "${COMPILER}" ]; then
|
||
# _CONFLICT='y'
|
||
# fi
|
||
if set_variable_from_command_line 'COMPILER' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
;;
|
||
-LDFLAGS*|-CUSTOM_LDFLAGS*)
|
||
if set_variable_from_command_line 'CUSTOM_LDFLAGS' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
;;
|
||
-OSTYPE_TAG*|-CUSTOM_OSTYPE_TAG*)
|
||
if set_variable_from_command_line 'CUSTOM_OSTYPE_TAG' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
CUSTOM_OSTYPE_TAG=`echo ${CUSTOM_OSTYPE_TAG} | remove_special_chars`
|
||
;;
|
||
-OS*)
|
||
if [ -n "${_WHAT_TO_DO}" ]; then _CONFLICT='y'; fi
|
||
_WHAT_TO_DO='ostype'
|
||
# legacy mode: used to have a compulsory compiler argument
|
||
if [ -n "$2" ]; then
|
||
case $2 in
|
||
# not sure whether it's ok to have empty statement here...
|
||
-*) _tmp=thisisnotused;;
|
||
*) COMPILER=$2; shift;;
|
||
esac
|
||
fi
|
||
;;
|
||
-NON-INTERACTIVE*|-NI*)
|
||
if [ -n "${_WHAT_TO_DO}" ]; then _CONFLICT='y'; fi
|
||
_WHAT_TO_DO='non-interactive'
|
||
# legacy mode: used to have a compulsory compiler argument
|
||
if [ -n "$2" ]; then
|
||
case $2 in
|
||
-*) _tmp=thisisnotused;;
|
||
*) COMPILER=$2; shift;;
|
||
esac
|
||
fi
|
||
;;
|
||
-I*)
|
||
if [ -n "${_WHAT_TO_DO}" ]; then _CONFLICT='y'; fi
|
||
_WHAT_TO_DO='interactive'
|
||
;;
|
||
-U*)
|
||
if [ -n "${_WHAT_TO_DO}" ]; then _CONFLICT='y'; fi
|
||
if set_variable_from_command_line 'UPGRADE_FROM' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
_WHAT_TO_DO='upgrade'
|
||
;;
|
||
-VERBOSE*) INSTALL_VERBOSE='y';;
|
||
-V*)
|
||
${_printf} "%s\n" "${CGAL_INSTALL_CGAL} is ${CGAL_INSTALL_VERSION}."
|
||
exit 0
|
||
;;
|
||
-REBUILD-ALL*|-RA*|-RBA*)
|
||
if [ -n "${_WHAT_TO_DO}" ]; then _CONFLICT='y'; fi
|
||
_WHAT_TO_DO='rebuild-all'
|
||
;;
|
||
-BUILD-ALL*|-BA*)
|
||
if [ -n "${_WHAT_TO_DO}" ]; then _CONFLICT='y'; fi
|
||
_WHAT_TO_DO='build-all'
|
||
;;
|
||
-REBUILD*|-R*|-RB*)
|
||
if [ -n "${_WHAT_TO_DO}" ]; then _CONFLICT='y'; fi
|
||
_WHAT_TO_DO='rebuild'
|
||
if set_variable_from_command_line 'BUILD_ONE_CONFIG' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
;;
|
||
-BUILD*|-B*)
|
||
if [ -n "${_WHAT_TO_DO}" ]; then _CONFLICT='y'; fi
|
||
_WHAT_TO_DO='build'
|
||
if set_variable_from_command_line 'BUILD_ONE_CONFIG' "$1" "$2"; then
|
||
shift
|
||
fi
|
||
;;
|
||
-DISABLE-SHARED*) ENABLE_SHARED='';;
|
||
-ENABLE-SHARED*) ;; # Already the default.
|
||
-DISABLE-STATIC*) ENABLE_STATIC='';;
|
||
-ENABLE-STATIC*) ;; # Already the default.
|
||
*)
|
||
_WHAT_TO_DO='help'
|
||
;;
|
||
esac
|
||
|
||
|
||
shift
|
||
done
|
||
# --- end of parsing commandline options ---
|
||
fi
|
||
|
||
log_to_file_and_screen
|
||
${_rm} -f "${EXTRA_INSTALL_LOGFILE}"
|
||
|
||
if [ -z "${_WHAT_TO_DO}" ]; then
|
||
_WHAT_TO_DO='non-interactive';
|
||
fi
|
||
|
||
# ---------------------------------------------------------------------
|
||
# postprocess commandline settings
|
||
#
|
||
|
||
if [ -n "${_CONFLICT}" ]; then _WHAT_TO_DO='help'; fi
|
||
|
||
if [ -z "${CGAL_INSTALL_DIR}" ]; then CGAL_INSTALL_DIR="${CGAL_DIR}"; fi
|
||
|
||
case ${_WHAT_TO_DO} in
|
||
*non-interactive*)
|
||
get_cgal_version
|
||
cgal_install_header
|
||
${_printf} "%s\n" "running non interactive mode ..."
|
||
INSTALL_INTERACTIVE=''
|
||
${_printf} "\n%s\n" \
|
||
"--------------------------------------------------------"
|
||
${_printf} "%s\n" "Locating Utilities:"
|
||
${_printf} "%s\n" \
|
||
"--------------------------------------------------------"
|
||
startup
|
||
if [ -z "${COMPILER}" ]; then
|
||
search_for_compilers
|
||
if [ ${_COMPILER_NUMBER} -gt 2 ]; then
|
||
compiler_choose_menu 'Main Menu'
|
||
fi
|
||
else
|
||
set_compiler_from_command_line
|
||
fi
|
||
flush_buffer
|
||
log_to_file
|
||
${_printf} "\n%s\n" \
|
||
"--------------------------------------------------------"
|
||
${_printf} "%s\n" "Configuring CGAL:"
|
||
${_printf} "%s\n" \
|
||
"--------------------------------------------------------"
|
||
test_setup
|
||
lib_menu
|
||
installation
|
||
finish
|
||
;;
|
||
*upgrade*)
|
||
get_cgal_version
|
||
cgal_install_header
|
||
${_printf} "%s\n" "starting ${_WHAT_TO_DO} -"
|
||
startup
|
||
guess_os log_print
|
||
upgrade
|
||
finish
|
||
;;
|
||
*interactive*)
|
||
get_cgal_version
|
||
cgal_install_header
|
||
# start interactive part
|
||
${_printf} "%s\n" "starting interactive mode -"
|
||
INSTALL_INTERACTIVE='y'
|
||
startup
|
||
if [ -z "${COMPILER}" ]; then
|
||
search_for_compilers
|
||
if [ ${_COMPILER_NUMBER} -gt 2 ]; then
|
||
compiler_choose_menu 'Main Menu'
|
||
fi
|
||
else
|
||
_COMPILER_NUMBER=1
|
||
set_compiler_from_command_line
|
||
_register_compiler "${COMPILER}"
|
||
_set_support
|
||
fi
|
||
main_menu
|
||
finish
|
||
;;
|
||
*ostype*)
|
||
# architecture/os key
|
||
_uname=uname
|
||
_basename=basename
|
||
_dirname=dirname
|
||
_which=real_which
|
||
_tr=tr
|
||
eval "guess_os ${_printf}" >/dev/null
|
||
_check_comp_executable "${COMPILER}"
|
||
COMPILER="`compiler_absolute ${COMPILER}`"
|
||
set_ostype
|
||
set_compiler_flags
|
||
${_printf} "%s\n" "${CGAL_OS_COMPILER}"
|
||
;;
|
||
*build-all*)
|
||
get_cgal_version
|
||
cgal_install_header
|
||
${_printf} "%s\n" "starting ${_WHAT_TO_DO} -"
|
||
startup
|
||
build_all
|
||
finish
|
||
;;
|
||
*build*)
|
||
get_cgal_version
|
||
cgal_install_header
|
||
${_printf} "%s\n" "starting ${_WHAT_TO_DO} -"
|
||
startup
|
||
build_one
|
||
finish
|
||
;;
|
||
*help*)
|
||
get_cgal_version
|
||
cgal_install_header
|
||
print_usage_information
|
||
;;
|
||
*)
|
||
get_cgal_version
|
||
cgal_install_header
|
||
print_general_information
|
||
;;
|
||
esac
|
||
exit 0
|
||
|