1 AC_DEFUN([LX_CHECK_GLPK],
4 AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
5 AS_HELP_STRING([--without-glpk], [disable checking for GLPK]),
8 AC_ARG_WITH([glpk-includedir],
9 AS_HELP_STRING([--with-glpk-includedir=DIR], [search for GLPK headers in DIR]),
10 [], [with_glpk_includedir=no])
12 AC_ARG_WITH([glpk-libdir],
13 AS_HELP_STRING([--with-glpk-libdir=DIR], [search for GLPK libraries in DIR]),
14 [], [with_glpk_libdir=no])
17 if test x"$with_glpk" != x"no"; then
18 AC_MSG_CHECKING([for GLPK])
20 if test x"$with_glpk_includedir" != x"no"; then
21 GLPK_CFLAGS="-I$with_glpk_includedir"
22 elif test x"$with_glpk" != x"yes"; then
23 GLPK_CFLAGS="-I$with_glpk/include"
26 if test x"$with_glpk_libdir" != x"no"; then
27 GLPK_LDFLAGS="-L$with_glpk_libdir"
28 elif test x"$with_glpk" != x"yes"; then
29 GLPK_LDFLAGS="-L$with_glpk/lib"
33 lx_save_cxxflags="$CXXFLAGS"
34 lx_save_ldflags="$LDFLAGS"
36 CXXFLAGS="$GLPK_CFLAGS"
37 LDFLAGS="$GLPK_LDFLAGS"
45 int main(int argc, char* argv[])
48 lp = lpx_create_prob();
54 AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], [lx_glpk_found=no])
57 CXXFLAGS="$lx_save_cxxflags"
58 LDFLAGS="$lx_save_ldflags"
61 if test x"$lx_glpk_found" = x"yes"; then
62 AC_DEFINE([HAVE_GLPK], [1], [Define to 1 if you have GLPK.])
71 GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS"
74 AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"])
78 AC_DEFUN([LX_CHECK_CPLEX],
81 AS_HELP_STRING([--with-cplex@<:@=PREFIX@:>@], [search for CPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
82 AS_HELP_STRING([--without-cplex], [disable checking for CPLEX]),
85 AC_ARG_WITH([cplex-includedir],
86 AS_HELP_STRING([--with-cplex-includedir=DIR], [search for CPLEX headers in DIR]),
87 [], [with_cplex_includedir=no])
89 AC_ARG_WITH([cplex-libdir],
90 AS_HELP_STRING([--with-cplex-libdir=DIR], [search for CPLEX libraries in DIR]),
91 [], [with_cplex_libdir=no])
94 if test x"$with_cplex" != x"no"; then
95 AC_MSG_CHECKING([for CPLEX])
97 if test x"$with_cplex_includedir" != x"no"; then
98 CPLEX_CFLAGS="-I$with_cplex_includedir"
99 elif test x"$with_cplex" != x"yes"; then
100 CPLEX_CFLAGS="-I$with_cplex/include"
103 if test x"$with_cplex_libdir" != x"no"; then
104 CPLEX_LDFLAGS="-L$with_cplex_libdir"
105 elif test x"$with_cplex" != x"yes"; then
106 CPLEX_LDFLAGS="-L$with_cplex/lib"
108 CPLEX_LIBS="-lcplex -lm -lpthread"
110 lx_save_cxxflags="$CXXFLAGS"
111 lx_save_ldflags="$LDFLAGS"
113 CXXFLAGS="$CPLEX_CFLAGS"
114 LDFLAGS="$CPLEX_LDFLAGS"
119 #include <ilcplex/cplex.h>
122 int main(int argc, char* argv[])
124 CPXENVptr env = NULL;
129 AC_LINK_IFELSE([$lx_cplex_test_prog], [lx_cplex_found=yes], [lx_cplex_found=no])
132 CXXFLAGS="$lx_save_cxxflags"
133 LDFLAGS="$lx_save_ldflags"
136 if test x"$lx_cplex_found" = x"yes"; then
137 AC_DEFINE([HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.])
146 CPLEX_LIBS="$CPLEX_LDFLAGS $CPLEX_LIBS"
147 AC_SUBST(CPLEX_CFLAGS)
149 AM_CONDITIONAL([HAVE_CPLEX], [test x"$lx_cplex_found" = x"yes"])