1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/m4/lx_check_cplex.m4 Tue Jul 04 10:06:24 2006 +0000
1.3 @@ -0,0 +1,77 @@
1.4 +AC_DEFUN([LX_CHECK_CPLEX],
1.5 +[
1.6 + AC_ARG_WITH([cplex],
1.7 +AS_HELP_STRING([--with-cplex@<:@=PREFIX@:>@], [search for CPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
1.8 +AS_HELP_STRING([--without-cplex], [disable checking for CPLEX]),
1.9 + [], [with_cplex=yes])
1.10 +
1.11 + AC_ARG_WITH([cplex-includedir],
1.12 +AS_HELP_STRING([--with-cplex-includedir=DIR], [search for CPLEX headers in DIR]),
1.13 + [], [with_cplex_includedir=no])
1.14 +
1.15 + AC_ARG_WITH([cplex-libdir],
1.16 +AS_HELP_STRING([--with-cplex-libdir=DIR], [search for CPLEX libraries in DIR]),
1.17 + [], [with_cplex_libdir=no])
1.18 +
1.19 + lx_cplex_found=no
1.20 + if test x"$with_cplex" != x"no"; then
1.21 + AC_MSG_CHECKING([for CPLEX])
1.22 +
1.23 + if test x"$with_cplex_includedir" != x"no"; then
1.24 + CPLEX_CFLAGS="-I$with_cplex_includedir"
1.25 + elif test x"$with_cplex" != x"yes"; then
1.26 + CPLEX_CFLAGS="-I$with_cplex/include"
1.27 + elif test x"$CPLEX_INCLUDEDIR" != x; then
1.28 + CPLEX_CFLAGS="-I$CPLEX_INCLUDEDIR"
1.29 + fi
1.30 +
1.31 + if test x"$with_cplex_libdir" != x"no"; then
1.32 + CPLEX_LDFLAGS="-L$with_cplex_libdir"
1.33 + elif test x"$with_cplex" != x"yes"; then
1.34 + CPLEX_LDFLAGS="-L$with_cplex/lib"
1.35 + elif test x"$CPLEX_LIBDIR" != x; then
1.36 + CPLEX_LDFLAGS="-L$CPLEX_LIBDIR"
1.37 + fi
1.38 + CPLEX_LIBS="-lcplex -lm -lpthread"
1.39 +
1.40 + lx_save_cxxflags="$CXXFLAGS"
1.41 + lx_save_ldflags="$LDFLAGS"
1.42 + lx_save_libs="$LIBS"
1.43 + CXXFLAGS="$CPLEX_CFLAGS"
1.44 + LDFLAGS="$CPLEX_LDFLAGS"
1.45 + LIBS="$CPLEX_LIBS"
1.46 +
1.47 + lx_cplex_test_prog='
1.48 + extern "C" {
1.49 + #include <ilcplex/cplex.h>
1.50 + }
1.51 +
1.52 + int main(int argc, char* argv[])
1.53 + {
1.54 + CPXENVptr env = NULL;
1.55 + return 0;
1.56 + }'
1.57 +
1.58 + AC_LANG_PUSH(C++)
1.59 + AC_LINK_IFELSE([$lx_cplex_test_prog], [lx_cplex_found=yes], [lx_cplex_found=no])
1.60 + AC_LANG_POP(C++)
1.61 +
1.62 + CXXFLAGS="$lx_save_cxxflags"
1.63 + LDFLAGS="$lx_save_ldflags"
1.64 + LIBS="$lx_save_libs"
1.65 +
1.66 + if test x"$lx_cplex_found" = x"yes"; then
1.67 + AC_DEFINE([HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.])
1.68 + AC_MSG_RESULT([yes])
1.69 + else
1.70 + CPLEX_CFLAGS=""
1.71 + CPLEX_LDFLAGS=""
1.72 + CPLEX_LIBS=""
1.73 + AC_MSG_RESULT([no])
1.74 + fi
1.75 + fi
1.76 + CPLEX_LIBS="$CPLEX_LDFLAGS $CPLEX_LIBS"
1.77 + AC_SUBST(CPLEX_CFLAGS)
1.78 + AC_SUBST(CPLEX_LIBS)
1.79 + AM_CONDITIONAL([HAVE_CPLEX], [test x"$lx_cplex_found" = x"yes"])
1.80 +])