ladanyi@1349
|
1 |
AC_DEFUN([LX_CHECK_GLPK],
|
ladanyi@1349
|
2 |
[
|
ladanyi@1349
|
3 |
AC_ARG_WITH([glpk],
|
ladanyi@1369
|
4 |
AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
|
ladanyi@1369
|
5 |
AS_HELP_STRING([--without-glpk], [disable checking for GLPK]),
|
ladanyi@1349
|
6 |
[], [with_glpk=yes])
|
ladanyi@1349
|
7 |
|
ladanyi@1349
|
8 |
AC_ARG_WITH([glpk-includedir],
|
ladanyi@1369
|
9 |
AS_HELP_STRING([--with-glpk-includedir=DIR], [search for GLPK headers in DIR]),
|
ladanyi@1349
|
10 |
[], [with_glpk_includedir=no])
|
ladanyi@1349
|
11 |
|
ladanyi@1349
|
12 |
AC_ARG_WITH([glpk-libdir],
|
ladanyi@1369
|
13 |
AS_HELP_STRING([--with-glpk-libdir=DIR], [search for GLPK libraries in DIR]),
|
ladanyi@1349
|
14 |
[], [with_glpk_libdir=no])
|
ladanyi@1349
|
15 |
|
alpar@1382
|
16 |
lx_glpk_found=no
|
ladanyi@1349
|
17 |
if test x"$with_glpk" != x"no"; then
|
ladanyi@1349
|
18 |
AC_MSG_CHECKING([for GLPK])
|
ladanyi@1349
|
19 |
|
ladanyi@1349
|
20 |
if test x"$with_glpk_includedir" != x"no"; then
|
ladanyi@1349
|
21 |
GLPK_CFLAGS="-I$with_glpk_includedir"
|
ladanyi@1349
|
22 |
elif test x"$with_glpk" != x"yes"; then
|
ladanyi@1349
|
23 |
GLPK_CFLAGS="-I$with_glpk/include"
|
ladanyi@1349
|
24 |
fi
|
ladanyi@1349
|
25 |
|
ladanyi@1349
|
26 |
if test x"$with_glpk_libdir" != x"no"; then
|
ladanyi@1349
|
27 |
GLPK_LDFLAGS="-L$with_glpk_libdir"
|
ladanyi@1349
|
28 |
elif test x"$with_glpk" != x"yes"; then
|
ladanyi@1349
|
29 |
GLPK_LDFLAGS="-L$with_glpk/lib"
|
ladanyi@1349
|
30 |
fi
|
ladanyi@1349
|
31 |
GLPK_LIBS="-lglpk"
|
ladanyi@1349
|
32 |
|
ladanyi@1349
|
33 |
lx_save_cxxflags="$CXXFLAGS";
|
ladanyi@1349
|
34 |
lx_save_ldflags="$LDFLAGS";
|
ladanyi@1349
|
35 |
lx_save_libs="$LIBS";
|
ladanyi@1349
|
36 |
CXXFLAGS="$GLPK_CFLAGS"
|
ladanyi@1349
|
37 |
LDFLAGS="$GLPK_LDFLAGS"
|
ladanyi@1349
|
38 |
LIBS="$GLPK_LIBS"
|
ladanyi@1349
|
39 |
|
ladanyi@1349
|
40 |
lx_glpk_test_prog='
|
ladanyi@1349
|
41 |
extern "C" {
|
ladanyi@1349
|
42 |
#include <glpk.h>
|
ladanyi@1349
|
43 |
}
|
ladanyi@1349
|
44 |
|
ladanyi@1349
|
45 |
int main(int argc, char* argv[])
|
ladanyi@1349
|
46 |
{
|
ladanyi@1349
|
47 |
LPX *lp;
|
ladanyi@1349
|
48 |
lp = lpx_create_prob();
|
ladanyi@1349
|
49 |
lpx_delete_prob(lp);
|
ladanyi@1349
|
50 |
return 0;
|
ladanyi@1349
|
51 |
}'
|
ladanyi@1349
|
52 |
|
ladanyi@1349
|
53 |
AC_LANG_PUSH(C++)
|
alpar@1373
|
54 |
AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], [lx_glpk_found=no])
|
ladanyi@1349
|
55 |
AC_LANG_POP(C++)
|
ladanyi@1349
|
56 |
|
ladanyi@1349
|
57 |
CXXFLAGS="$lx_save_cxxflags"
|
ladanyi@1349
|
58 |
LDFLAGS="$lx_save_ldflags"
|
ladanyi@1349
|
59 |
LIBS="$lx_save_libs"
|
ladanyi@1349
|
60 |
|
ladanyi@1349
|
61 |
if test x"$lx_glpk_found" = x"yes"; then
|
ladanyi@1355
|
62 |
AC_DEFINE([HAVE_GLPK], [1], [Define to 1 if you have GLPK.])
|
ladanyi@1355
|
63 |
AC_MSG_RESULT([yes])
|
ladanyi@1349
|
64 |
else
|
ladanyi@1355
|
65 |
AC_MSG_RESULT([no])
|
ladanyi@1349
|
66 |
fi
|
ladanyi@1349
|
67 |
fi
|
ladanyi@1349
|
68 |
GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS"
|
ladanyi@1349
|
69 |
AC_SUBST(GLPK_CFLAGS)
|
ladanyi@1349
|
70 |
AC_SUBST(GLPK_LIBS)
|
ladanyi@1349
|
71 |
AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"])
|
ladanyi@1349
|
72 |
])
|
ladanyi@1380
|
73 |
|
ladanyi@1380
|
74 |
|
ladanyi@1380
|
75 |
AC_DEFUN([LX_CHECK_CPLEX],
|
ladanyi@1380
|
76 |
[
|
ladanyi@1380
|
77 |
AC_ARG_WITH([cplex],
|
ladanyi@1380
|
78 |
AS_HELP_STRING([--with-cplex@<:@=PREFIX@:>@], [search for CPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
|
ladanyi@1380
|
79 |
AS_HELP_STRING([--without-cplex], [disable checking for CPLEX]),
|
ladanyi@1380
|
80 |
[], [with_cplex=yes])
|
ladanyi@1380
|
81 |
|
ladanyi@1380
|
82 |
AC_ARG_WITH([cplex-includedir],
|
ladanyi@1380
|
83 |
AS_HELP_STRING([--with-cplex-includedir=DIR], [search for CPLEX headers in DIR]),
|
ladanyi@1380
|
84 |
[], [with_cplex_includedir=no])
|
ladanyi@1380
|
85 |
|
ladanyi@1380
|
86 |
AC_ARG_WITH([cplex-libdir],
|
ladanyi@1380
|
87 |
AS_HELP_STRING([--with-cplex-libdir=DIR], [search for CPLEX libraries in DIR]),
|
ladanyi@1380
|
88 |
[], [with_cplex_libdir=no])
|
ladanyi@1380
|
89 |
|
alpar@1382
|
90 |
lx_cplex_found=no
|
ladanyi@1380
|
91 |
if test x"$with_cplex" != x"no"; then
|
ladanyi@1380
|
92 |
AC_MSG_CHECKING([for CPLEX])
|
ladanyi@1380
|
93 |
|
ladanyi@1380
|
94 |
if test x"$with_cplex_includedir" != x"no"; then
|
ladanyi@1380
|
95 |
CPLEX_CFLAGS="-I$with_cplex_includedir"
|
ladanyi@1380
|
96 |
elif test x"$with_cplex" != x"yes"; then
|
ladanyi@1380
|
97 |
CPLEX_CFLAGS="-I$with_cplex/include"
|
ladanyi@1380
|
98 |
fi
|
ladanyi@1380
|
99 |
|
ladanyi@1380
|
100 |
if test x"$with_cplex_libdir" != x"no"; then
|
ladanyi@1380
|
101 |
CPLEX_LDFLAGS="-L$with_cplex_libdir"
|
ladanyi@1380
|
102 |
elif test x"$with_cplex" != x"yes"; then
|
ladanyi@1380
|
103 |
CPLEX_LDFLAGS="-L$with_cplex/lib"
|
ladanyi@1380
|
104 |
fi
|
ladanyi@1380
|
105 |
CPLEX_LIBS="-lcplex -lm -lpthread"
|
ladanyi@1380
|
106 |
|
ladanyi@1380
|
107 |
lx_save_cxxflags="$CXXFLAGS";
|
ladanyi@1380
|
108 |
lx_save_ldflags="$LDFLAGS";
|
ladanyi@1380
|
109 |
lx_save_libs="$LIBS";
|
ladanyi@1380
|
110 |
CXXFLAGS="$CPLEX_CFLAGS"
|
ladanyi@1380
|
111 |
LDFLAGS="$CPLEX_LDFLAGS"
|
ladanyi@1380
|
112 |
LIBS="$CPLEX_LIBS"
|
ladanyi@1380
|
113 |
|
ladanyi@1380
|
114 |
lx_cplex_test_prog='
|
ladanyi@1380
|
115 |
extern "C" {
|
ladanyi@1380
|
116 |
#include <ilcplex/cplex.h>
|
ladanyi@1380
|
117 |
}
|
ladanyi@1380
|
118 |
|
ladanyi@1380
|
119 |
int main(int argc, char* argv[])
|
ladanyi@1380
|
120 |
{
|
ladanyi@1380
|
121 |
CPXENVptr env = NULL;
|
ladanyi@1380
|
122 |
return 0;
|
ladanyi@1380
|
123 |
}'
|
ladanyi@1380
|
124 |
|
ladanyi@1380
|
125 |
AC_LANG_PUSH(C++)
|
ladanyi@1380
|
126 |
AC_LINK_IFELSE([$lx_cplex_test_prog], [lx_cplex_found=yes], [lx_cplex_found=no])
|
ladanyi@1380
|
127 |
AC_LANG_POP(C++)
|
ladanyi@1380
|
128 |
|
ladanyi@1380
|
129 |
CXXFLAGS="$lx_save_cxxflags"
|
ladanyi@1380
|
130 |
LDFLAGS="$lx_save_ldflags"
|
ladanyi@1380
|
131 |
LIBS="$lx_save_libs"
|
ladanyi@1380
|
132 |
|
ladanyi@1380
|
133 |
if test x"$lx_cplex_found" = x"yes"; then
|
ladanyi@1380
|
134 |
AC_DEFINE([HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.])
|
ladanyi@1380
|
135 |
AC_MSG_RESULT([yes])
|
ladanyi@1380
|
136 |
else
|
ladanyi@1380
|
137 |
AC_MSG_RESULT([no])
|
ladanyi@1380
|
138 |
fi
|
ladanyi@1380
|
139 |
fi
|
ladanyi@1380
|
140 |
CPLEX_LIBS="$CPLEX_LDFLAGS $CPLEX_LIBS"
|
ladanyi@1380
|
141 |
AC_SUBST(CPLEX_CFLAGS)
|
ladanyi@1380
|
142 |
AC_SUBST(CPLEX_LIBS)
|
ladanyi@1380
|
143 |
AM_CONDITIONAL([HAVE_CPLEX], [test x"$lx_cplex_found" = x"yes"])
|
ladanyi@1380
|
144 |
])
|