ladanyi@1489: AC_DEFUN([LX_CHECK_CPLEX], ladanyi@1489: [ ladanyi@1489: AC_ARG_WITH([cplex], ladanyi@1489: AS_HELP_STRING([--with-cplex@<:@=PREFIX@:>@], [search for CPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@]) ladanyi@1489: AS_HELP_STRING([--without-cplex], [disable checking for CPLEX]), ladanyi@1489: [], [with_cplex=yes]) ladanyi@1489: ladanyi@1489: AC_ARG_WITH([cplex-includedir], ladanyi@1489: AS_HELP_STRING([--with-cplex-includedir=DIR], [search for CPLEX headers in DIR]), ladanyi@1489: [], [with_cplex_includedir=no]) ladanyi@1489: ladanyi@1489: AC_ARG_WITH([cplex-libdir], ladanyi@1489: AS_HELP_STRING([--with-cplex-libdir=DIR], [search for CPLEX libraries in DIR]), ladanyi@1489: [], [with_cplex_libdir=no]) ladanyi@1489: ladanyi@1489: lx_cplex_found=no ladanyi@1489: if test x"$with_cplex" != x"no"; then ladanyi@1489: AC_MSG_CHECKING([for CPLEX]) ladanyi@1489: ladanyi@1489: if test x"$with_cplex_includedir" != x"no"; then ladanyi@1489: CPLEX_CFLAGS="-I$with_cplex_includedir" ladanyi@1489: elif test x"$with_cplex" != x"yes"; then ladanyi@1489: CPLEX_CFLAGS="-I$with_cplex/include" ladanyi@1489: fi ladanyi@1489: ladanyi@1489: if test x"$with_cplex_libdir" != x"no"; then ladanyi@1489: CPLEX_LDFLAGS="-L$with_cplex_libdir" ladanyi@1489: elif test x"$with_cplex" != x"yes"; then ladanyi@1489: CPLEX_LDFLAGS="-L$with_cplex/lib" ladanyi@1489: fi ladanyi@1489: CPLEX_LIBS="-lcplex -lm -lpthread" ladanyi@1489: ladanyi@1489: lx_save_cxxflags="$CXXFLAGS" ladanyi@1489: lx_save_ldflags="$LDFLAGS" ladanyi@1489: lx_save_libs="$LIBS" ladanyi@1489: CXXFLAGS="$CPLEX_CFLAGS" ladanyi@1489: LDFLAGS="$CPLEX_LDFLAGS" ladanyi@1489: LIBS="$CPLEX_LIBS" ladanyi@1489: ladanyi@1489: lx_cplex_test_prog=' ladanyi@1489: extern "C" { ladanyi@1489: #include ladanyi@1489: } ladanyi@1489: ladanyi@1489: int main(int argc, char* argv[]) ladanyi@1489: { ladanyi@1489: CPXENVptr env = NULL; ladanyi@1489: return 0; ladanyi@1489: }' ladanyi@1489: ladanyi@1489: AC_LANG_PUSH(C++) ladanyi@1489: AC_LINK_IFELSE([$lx_cplex_test_prog], [lx_cplex_found=yes], [lx_cplex_found=no]) ladanyi@1489: AC_LANG_POP(C++) ladanyi@1489: ladanyi@1489: CXXFLAGS="$lx_save_cxxflags" ladanyi@1489: LDFLAGS="$lx_save_ldflags" ladanyi@1489: LIBS="$lx_save_libs" ladanyi@1489: ladanyi@1489: if test x"$lx_cplex_found" = x"yes"; then ladanyi@1489: AC_DEFINE([HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.]) ladanyi@1489: AC_MSG_RESULT([yes]) ladanyi@1489: else ladanyi@1489: CPLEX_CFLAGS="" ladanyi@1489: CPLEX_LDFLAGS="" ladanyi@1489: CPLEX_LIBS="" ladanyi@1489: AC_MSG_RESULT([no]) ladanyi@1489: fi ladanyi@1489: fi ladanyi@1489: CPLEX_LIBS="$CPLEX_LDFLAGS $CPLEX_LIBS" ladanyi@1489: AC_SUBST(CPLEX_CFLAGS) ladanyi@1489: AC_SUBST(CPLEX_LIBS) ladanyi@1489: AM_CONDITIONAL([HAVE_CPLEX], [test x"$lx_cplex_found" = x"yes"]) ladanyi@1489: ])