-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
66 lines (51 loc) · 1.82 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
AC_INIT([cobrarCPLEX], [0.1.0], [[email protected]])
FOUND_ALL="no"
# Check if global variables are already set, if so we are done
if test [-n "$PKG_CPPFLAGS" -a -n "$PKG_LIBS"] ; then
FOUND_ALL="yes"
else
if test [-n "$PKG_CPPFLAGS" -o -n "$PKG_LIBS"] ; then
AC_MSG_ERROR([All of PKG_CPPFLAGS and PKG_LIBS must be given together])
fi
fi
dnl get arguments
AC_ARG_WITH([cplex-dir],
[AS_HELP_STRING([--with-cplex-dir],[specify location of CPLEX installation directory])],
CPLEX_DIR=$withval,
CPLEX_DIR="")
# Define default CPLEX path
DEFAULT_CPLEX_PATH="/opt/ibm/ILOG/CPLEX_Studio"
# Function to check for the latest CPLEX installation in the default path
check_latest_cplex_path() {
latest_version_dir=$(ls -d ${DEFAULT_CPLEX_PATH}* 2>/dev/null | sort -V | tail -n 1)
if test -d "$latest_version_dir/cplex/include" ; then
CPLEX_DIR="$latest_version_dir/cplex"
return 0
fi
return 1
}
# If no CPLEX_DIR is provided and not already set, check default path
if test ["$FOUND_ALL" = "no" -a -z "$CPLEX_DIR"] ; then
check_latest_cplex_path
fi
if test ["$FOUND_ALL" = "no" -a -n "$CPLEX_DIR"] ; then
PKG_CPPFLAGS="-I${CPLEX_DIR}/include -I${CPLEX_DIR}/include/ilcplex -I${CPLEX_DIR}/../concert/include"
SYSTEM=`uname -m | tr '_' '-'`
LIBFORMAT=`uname -s | tr A-Z a-z`
if test ["$LIBFORMAT" = "darwin"]; then
LIBFORMAT=osx
fi
PKG_LIBS="-L${CPLEX_DIR}/lib/${SYSTEM}_${LIBFORMAT}/static_pic -L${CPLEX_DIR}/../concert/lib/${SYSTEM}_${LIBFORMAT}/static_pic -lilocplex -lcplex -lconcert -lm -lpthread -ldl"
FOUND_ALL="yes"
fi
if test "$FOUND_ALL" = "no" ; then
AC_MSG_ERROR([No CPLEX installation found])
fi
AC_PROG_CXX
AC_PROG_CC
dnl substitute in src/Makevars
AC_SUBST(PKG_CPPFLAGS)
AC_SUBST(PKG_LIBS)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
exit 0