added check for CLPEX
authorladanyi
Fri, 22 Apr 2005 16:20:12 +0000
changeset 1380cb2891afe526
parent 1379 96a34c0904dd
child 1381 998e8def9676
added check for CLPEX
config/lp.m4
configure.ac
     1.1 --- a/config/lp.m4	Thu Apr 21 15:15:12 2005 +0000
     1.2 +++ b/config/lp.m4	Fri Apr 22 16:20:12 2005 +0000
     1.3 @@ -69,3 +69,74 @@
     1.4    AC_SUBST(GLPK_LIBS)
     1.5    AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"])
     1.6  ])
     1.7 +
     1.8 +
     1.9 +AC_DEFUN([LX_CHECK_CPLEX],
    1.10 +[
    1.11 +  AC_ARG_WITH([cplex],
    1.12 +AS_HELP_STRING([--with-cplex@<:@=PREFIX@:>@], [search for CPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
    1.13 +AS_HELP_STRING([--without-cplex], [disable checking for CPLEX]),
    1.14 +              [], [with_cplex=yes])
    1.15 +
    1.16 +  AC_ARG_WITH([cplex-includedir],
    1.17 +AS_HELP_STRING([--with-cplex-includedir=DIR], [search for CPLEX headers in DIR]),
    1.18 +              [], [with_cplex_includedir=no])
    1.19 +
    1.20 +  AC_ARG_WITH([cplex-libdir],
    1.21 +AS_HELP_STRING([--with-cplex-libdir=DIR], [search for CPLEX libraries in DIR]),
    1.22 +              [], [with_cplex_libdir=no])
    1.23 +
    1.24 +  if test x"$with_cplex" != x"no"; then
    1.25 +    AC_MSG_CHECKING([for CPLEX])
    1.26 +
    1.27 +    if test x"$with_cplex_includedir" != x"no"; then
    1.28 +      CPLEX_CFLAGS="-I$with_cplex_includedir"
    1.29 +    elif test x"$with_cplex" != x"yes"; then
    1.30 +      CPLEX_CFLAGS="-I$with_cplex/include"
    1.31 +    fi
    1.32 +
    1.33 +    if test x"$with_cplex_libdir" != x"no"; then
    1.34 +      CPLEX_LDFLAGS="-L$with_cplex_libdir"
    1.35 +    elif test x"$with_cplex" != x"yes"; then
    1.36 +      CPLEX_LDFLAGS="-L$with_cplex/lib"
    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 +      AC_MSG_RESULT([no])
    1.71 +    fi
    1.72 +  fi
    1.73 +  CPLEX_LIBS="$CPLEX_LDFLAGS $CPLEX_LIBS"
    1.74 +  AC_SUBST(CPLEX_CFLAGS)
    1.75 +  AC_SUBST(CPLEX_LIBS)
    1.76 +  AM_CONDITIONAL([HAVE_CPLEX], [test x"$lx_cplex_found" = x"yes"])
    1.77 +])
     2.1 --- a/configure.ac	Thu Apr 21 15:15:12 2005 +0000
     2.2 +++ b/configure.ac	Fri Apr 22 16:20:12 2005 +0000
     2.3 @@ -25,6 +25,7 @@
     2.4  
     2.5  dnl Checks for libraries.
     2.6  LX_CHECK_GLPK
     2.7 +LX_CHECK_CPLEX
     2.8  
     2.9  LX_ENABLE_DOCS
    2.10  
    2.11 @@ -66,6 +67,7 @@
    2.12  echo C++ compiles flags............ : $CXXFLAGS
    2.13  echo
    2.14  echo GLPK support.................. : $lx_glpk_found
    2.15 +echo CPLEX support................. : $lx_cplex_found
    2.16  echo
    2.17  echo The packace will be installed in
    2.18  echo -n '  '