ladanyi@1
|
1 |
AC_DEFUN([LX_CHECK_CPLEX],
|
ladanyi@1
|
2 |
[
|
ladanyi@1
|
3 |
AC_ARG_WITH([cplex],
|
ladanyi@1
|
4 |
AS_HELP_STRING([--with-cplex@<:@=PREFIX@:>@], [search for CPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
|
ladanyi@1
|
5 |
AS_HELP_STRING([--without-cplex], [disable checking for CPLEX]),
|
ladanyi@1
|
6 |
[], [with_cplex=yes])
|
ladanyi@1
|
7 |
|
ladanyi@1
|
8 |
AC_ARG_WITH([cplex-includedir],
|
ladanyi@1
|
9 |
AS_HELP_STRING([--with-cplex-includedir=DIR], [search for CPLEX headers in DIR]),
|
ladanyi@1
|
10 |
[], [with_cplex_includedir=no])
|
ladanyi@1
|
11 |
|
ladanyi@1
|
12 |
AC_ARG_WITH([cplex-libdir],
|
ladanyi@1
|
13 |
AS_HELP_STRING([--with-cplex-libdir=DIR], [search for CPLEX libraries in DIR]),
|
ladanyi@1
|
14 |
[], [with_cplex_libdir=no])
|
ladanyi@1
|
15 |
|
ladanyi@1
|
16 |
lx_cplex_found=no
|
ladanyi@1
|
17 |
if test x"$with_cplex" != x"no"; then
|
ladanyi@1
|
18 |
AC_MSG_CHECKING([for CPLEX])
|
ladanyi@1
|
19 |
|
ladanyi@1
|
20 |
if test x"$with_cplex_includedir" != x"no"; then
|
ladanyi@1
|
21 |
CPLEX_CFLAGS="-I$with_cplex_includedir"
|
ladanyi@1
|
22 |
elif test x"$with_cplex" != x"yes"; then
|
ladanyi@1
|
23 |
CPLEX_CFLAGS="-I$with_cplex/include"
|
ladanyi@1
|
24 |
elif test x"$CPLEX_INCLUDEDIR" != x; then
|
ladanyi@1
|
25 |
CPLEX_CFLAGS="-I$CPLEX_INCLUDEDIR"
|
ladanyi@1
|
26 |
fi
|
ladanyi@1
|
27 |
|
ladanyi@1
|
28 |
if test x"$with_cplex_libdir" != x"no"; then
|
ladanyi@1
|
29 |
CPLEX_LDFLAGS="-L$with_cplex_libdir"
|
ladanyi@1
|
30 |
elif test x"$with_cplex" != x"yes"; then
|
ladanyi@1
|
31 |
CPLEX_LDFLAGS="-L$with_cplex/lib"
|
ladanyi@1
|
32 |
elif test x"$CPLEX_LIBDIR" != x; then
|
ladanyi@1
|
33 |
CPLEX_LDFLAGS="-L$CPLEX_LIBDIR"
|
ladanyi@1
|
34 |
fi
|
ladanyi@1
|
35 |
CPLEX_LIBS="-lcplex -lm -lpthread"
|
ladanyi@1
|
36 |
|
ladanyi@1
|
37 |
lx_save_cxxflags="$CXXFLAGS"
|
ladanyi@1
|
38 |
lx_save_ldflags="$LDFLAGS"
|
ladanyi@1
|
39 |
lx_save_libs="$LIBS"
|
ladanyi@1
|
40 |
CXXFLAGS="$CPLEX_CFLAGS"
|
ladanyi@1
|
41 |
LDFLAGS="$CPLEX_LDFLAGS"
|
ladanyi@1
|
42 |
LIBS="$CPLEX_LIBS"
|
ladanyi@1
|
43 |
|
ladanyi@1
|
44 |
lx_cplex_test_prog='
|
ladanyi@1
|
45 |
extern "C" {
|
ladanyi@1
|
46 |
#include <ilcplex/cplex.h>
|
ladanyi@1
|
47 |
}
|
ladanyi@1
|
48 |
|
ladanyi@187
|
49 |
int main(int argc, char** argv)
|
ladanyi@1
|
50 |
{
|
ladanyi@1
|
51 |
CPXENVptr env = NULL;
|
ladanyi@1
|
52 |
return 0;
|
ladanyi@1
|
53 |
}'
|
ladanyi@1
|
54 |
|
ladanyi@1
|
55 |
AC_LANG_PUSH(C++)
|
ladanyi@1
|
56 |
AC_LINK_IFELSE([$lx_cplex_test_prog], [lx_cplex_found=yes], [lx_cplex_found=no])
|
ladanyi@1
|
57 |
AC_LANG_POP(C++)
|
ladanyi@1
|
58 |
|
ladanyi@1
|
59 |
CXXFLAGS="$lx_save_cxxflags"
|
ladanyi@1
|
60 |
LDFLAGS="$lx_save_ldflags"
|
ladanyi@1
|
61 |
LIBS="$lx_save_libs"
|
ladanyi@1
|
62 |
|
ladanyi@1
|
63 |
if test x"$lx_cplex_found" = x"yes"; then
|
ladanyi@540
|
64 |
AC_DEFINE([LEMON_HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.])
|
ladanyi@1
|
65 |
AC_MSG_RESULT([yes])
|
ladanyi@1
|
66 |
else
|
ladanyi@1
|
67 |
CPLEX_CFLAGS=""
|
ladanyi@1
|
68 |
CPLEX_LDFLAGS=""
|
ladanyi@1
|
69 |
CPLEX_LIBS=""
|
ladanyi@1
|
70 |
AC_MSG_RESULT([no])
|
ladanyi@1
|
71 |
fi
|
ladanyi@1
|
72 |
fi
|
ladanyi@1
|
73 |
CPLEX_LIBS="$CPLEX_LDFLAGS $CPLEX_LIBS"
|
ladanyi@1
|
74 |
AC_SUBST(CPLEX_CFLAGS)
|
ladanyi@1
|
75 |
AC_SUBST(CPLEX_LIBS)
|
ladanyi@1
|
76 |
AM_CONDITIONAL([HAVE_CPLEX], [test x"$lx_cplex_found" = x"yes"])
|
ladanyi@1
|
77 |
])
|