improve configure

This commit is contained in:
Vitor Santos Costa 2016-12-03 10:35:39 -06:00
parent 47b5de9bfc
commit 490a07ade2
6 changed files with 104 additions and 26 deletions

View File

@ -1,2 +1,20 @@
ENABLE_VARS="jit|no|WITH_JIT clpbn|yes|WITH_CLPBN cplint|yes|WITH_CPLINT horus|yes|WITH_HORUS docs|no|WITH_DOCS problog|yes|WITH_PROBLOG"
WITH_VARS="swig|yes|WITH_SWIG gecode|yes|WITH_GECODE R|yes|WITH_REAL cudd|yes|WITH_BDD python|yes|WITH_PYTHON "
ENABLE_VARS="clpbn|yes|WITH_CLPBN \
cplint|yes|WITH_CPLINT \
horus|yes|WITH_HORUS \
clpr|yes|WITH_CLPR \
problog|yes|WITH_PROBLOG
jit|no|WITH_JIT \
chr|no|WITH_CHR \
threads|no|WITH_THREADS"
WITH_VARS="swig|yes|WITH_SWIG \
mpi|yes|WITH_MPI \
gecode|yes|WITH_GECODE \
docs|yes|WITH_DOCS \
r|yes|WITH_REAL \
cudd|yes|WITH_CUDD \
xml2|yes|WITH_XML2 \
raptor|yes|WITH_RAPTOR \
python|yes|WITH_PYTHON \
openssl|yes|WITH_OPENSSL\
readline|yes|WITH_READLINE \
gmp|yes|WITH_GMP "

View File

@ -337,10 +337,14 @@ check_function_exists(socklen_t HAVE_SOCKLEN_T)
check_function_exists(sqllen HAVE_SQLLEN)
check_function_exists(sqlulen HAVE_SQLULEN)
check_function_exists(srand HAVE_SRAND)
check_function_exists(srand HAVE_SRAND48)
check_function_exists(srand48 HAVE_SRAND48)
check_function_exists(srandom HAVE_SRANDOM)
check_function_exists(stpcpy HAVE_STPCPY)
check_function_exists(stpncpy HAVE_STPNCPY)
check_function_exists(ssize_t HAVE_SSIZE_T)
check_function_exists(stat HAVE_STAT)
check_function_exists(strcat HAVE_STRCAT)
check_function_exists(strncat HAVE_STRNCAT)
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(strcasestr HAVE_STRCASESTR)
check_function_exists(strchr HAVE_STRCHR)

View File

@ -13,6 +13,7 @@
SET( CUDD_FOUND "NO" )
set (CUDD_INCLUDE_SEARCH_PATH
${CUDD_ROOT_DIR}/include
${CMAKE_INSTALL_PREFIX}/include
/usr/local/yap/include
/usr/local/Yap/include
@ -32,6 +33,7 @@ set (CUDD_INCLUDE_SEARCH_PATH
set (CUDD_LIB_SEARCH_PATH
${CUDD_ROOT_DIR}/lib
${CMAKE_INSTALL_PREFIX}/lib
/usr/lib
/usr/local/lib/cudd

View File

@ -11,6 +11,7 @@ IF (MYSQL_INCLUDE_DIR)
ENDIF (MYSQL_INCLUDE_DIR)
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
${MYSQL_ROOT_DIR}/include
/usr/local/include/mysql
/usr/include/mysql
/usr/include/mariadb
@ -18,7 +19,8 @@ FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
SET(MYSQL_NAMES mysqlclient mysqlclient_r mariadb )
FIND_LIBRARY(MYSQL_LIBRARY
NAMES ${MYSQL_NAMES}
NAMES ${MYSQL_ROOT_DIR}/lib
${MYSQL_NAMES}
PATHS /usr/lib /usr/local/lib
PATH_SUFFIXES mysql mariadb
)
@ -45,4 +47,4 @@ ENDIF (MYSQL_FOUND)
MARK_AS_ADVANCED(
MYSQL_LIBRARY
MYSQL_INCLUDE_DIR
)
)

View File

@ -19,6 +19,7 @@
set(ODBC_FOUND FALSE)
find_path(ODBC_INCLUDE_DIRECTORIES sql.h
${ODBC_ROOT_DIR}/include
/usr/include
/usr/include/odbc
/usr/local/include
@ -34,6 +35,7 @@ find_path(ODBC_INCLUDE_DIRECTORIES sql.h
find_library(ODBC_LIBRARY
NAMES iodbc odbc odbcinst odbc32
PATHS
${ODBC_ROOT_DIR}/lib
/usr/lib
/usr/lib/odbc
/usr/local/lib

92
configure vendored
View File

@ -22,7 +22,7 @@
# details, see <https://creativecommons.org/publicdomain/zero/1.0/>
TOP_SRCDIR="$(dirname $0)"
CMAKE_CMD="cmake ${TOP_SRCDIR}"
CMAKE=cmake
BUILD_TYPE="Debug"
PREFIX=/usr/local
@ -39,15 +39,19 @@ quote() {
extract_var_string() {
VAR_NAME=$1
VAR_NAME=$(echo $1 | sed -e 's/[ \t]*$//')
if [ "x$2" != "x" ]; then
VAR_VALUE=$2
else
VAR_VALUE=yes
VAR_NAME=$(echo $1 | sed -e 's/[\\b]*$//')
if [ "x$VAR_VALUE" = "x" ]; then
if [ "x$2" != "x" ]; then
VAR_VALUE=$2
else
VAR_VALUE=yes
fi
fi
if [ "x$3" != "x" ]; then
VAR_UC_NAME=$3
VAR_UC=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g')
else
VAR_UC_NAME=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g')
fi
@ -55,35 +59,73 @@ extract_var_string() {
set_config_var() {
is_with=n
found=y
arg=$(echo "${2}" | tr '[:upper:]' '[:lower:]' )
case "$1" in
"--enable-"*)
name="${1#--enable-}"
cfg="${ENABLE_VARS}"
case "x$arg" in
"xy"|"xyes"|"xtrue")
VAR_VALUE=yes
;;
"xn"|"xno"|"xfalse")
found=y
VAR_VALUE=no
;;
**)
VAR_VALUE=""
;;
esac
;;
"--disable-"*)
name="${1#--disable-}";
cfg="${DISABLE_VARS}";
cfg="${ENABLE_VARS}"
case "x$arg" in
"xy"|"xyes"|"xtrue")
VAR_VALUE=no
;;
"xn"|"xno"|"xfalse")
VAR_VALUE=yes
;;
**)
VAR_VALUE=""
;;
esac
;;
"--with-"*)
# IFS="=" read -ra WITHARGS <<< "${1}"
name="${1#--with-}"
cfg="${WITH_VARS}"
is_with=y
case "x$arg" in
"x"|"xy"|"xyes"|"xtrue")
is_with=n
VAR_VALUE=yes
``;;
"xn"|"xno"|"xfalse")
is_with=n
VAR_VALUE=no
;;
**)
is_with=y
VAR_VALUE=""
;;
esac
;;
esac
found=n
for varstring in $cfg; do
extract_var_string $(echo "${varstring}" | tr '|' ' ')
if [ "x$VAR_NAME" = "x$name" ]; then
found=y
break;
fi
done
for varstring in $cfg; do
extract_var_string $(echo "${varstring}" | tr '|' ' ')
if [ "x$VAR_NAME" = "x$name" ]; then
found=y
break;
fi
done
if [ "$found" = "y" ]; then
if [ "x$is_with" = "xy" ]; then
CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$2")"
CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$VAR_VALUE") -D${VAR_UC}_ROOT_DIR=$(quote "$2")"
else
CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "${VAR_VALUE}")"
fi
@ -100,6 +142,7 @@ prefix_to_offset() {
print_help() {
cat <<EOF >&2
-h, --help display this help and exit
--cmake=CMAKE use a specific cmake, not the default
--disable-debug disable debugging mode
--pass-thru pass remaining arguments through to CMake
@ -154,7 +197,6 @@ EOF
fi
done
first=y
for varstring in ${WITH_VARS}; do
if [ $first = 'y' ]; then
echo ""
@ -164,6 +206,7 @@ EOF
var_doc_name="WITH_${VAR_UC_NAME}_DOC"
eval "docstring=\$$var_doc_name"
paraminfo="${VAR_NAME}=${VAR_VALUE}"
if [ "x${docstring}" = "x" ]; then
printf " --with-%-16s enable %s support\n" "$paraminfo" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
else
@ -176,6 +219,10 @@ EOF
while [ $# != 0 ]; do
case "$1" in
"--cmake="*)
CMAKE="${1#*=}";;
"--cmake")
CMAKE="${2}"; shift;;
"--prefix="*)
PREFIX="${1#*=}";;
"--prefix")
@ -274,11 +321,13 @@ while [ $# != 0 ]; do
done;;
"--enable-"*)
set_config_var "$1"
name=$(echo "${1#--enable-}" | awk '{split($1,v,"="); print v[1]}')
set_config_var "--with-${name}" "${1#--enable-${name}=}"
;;
"--disable-"*)
set_config_var "$1"
name=$(echo "${1#--disable-}" | awk '{split($1,v,"="); print v[1]}')
set_config_var "--with-${name}" "${1#--disable-${name}=}"
;;
"--with-"*)
@ -312,4 +361,5 @@ if [ "x${LDFLAGS}" != "x" ]; then
done
fi
eval "cmake ${TOP_SRCDIR} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${LIBDIR} ${CMAKE_ARGS}"
CMAKE_CMD="'${CMAKE} ${TOP_SRCDIR}"
echo "${CMAKE} ${TOP_SRCDIR} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${LIBDIR} ${CMAKE_ARGS}"