m4/lx_check_clp.m4
changeset 459 ed54c0d13df0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/m4/lx_check_clp.m4	Tue Dec 02 22:48:28 2008 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +AC_DEFUN([LX_CHECK_CLP],
     1.5 +[
     1.6 +  AC_ARG_WITH([clp],
     1.7 +AS_HELP_STRING([--with-clp@<:@=PREFIX@:>@], [search for CLP under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
     1.8 +AS_HELP_STRING([--without-clp], [disable checking for CLP]),
     1.9 +              [], [with_clp=yes])
    1.10 +
    1.11 +  AC_ARG_WITH([clp-includedir],
    1.12 +AS_HELP_STRING([--with-clp-includedir=DIR], [search for CLP headers in DIR]),
    1.13 +              [], [with_clp_includedir=no])
    1.14 +
    1.15 +  AC_ARG_WITH([clp-libdir],
    1.16 +AS_HELP_STRING([--with-clp-libdir=DIR], [search for CLP libraries in DIR]),
    1.17 +              [], [with_clp_libdir=no])
    1.18 +
    1.19 +  lx_clp_found=no
    1.20 +  if test x"$with_clp" != x"no"; then
    1.21 +    AC_MSG_CHECKING([for CLP])
    1.22 +
    1.23 +    if test x"$with_clp_includedir" != x"no"; then
    1.24 +      CLP_CXXFLAGS="-I$with_clp_includedir"
    1.25 +    elif test x"$with_clp" != x"yes"; then
    1.26 +      CLP_CXXFLAGS="-I$with_clp/include"
    1.27 +    fi
    1.28 +
    1.29 +    if test x"$with_clp_libdir" != x"no"; then
    1.30 +      CLP_LDFLAGS="-L$with_clp_libdir"
    1.31 +    elif test x"$with_clp" != x"yes"; then
    1.32 +      CLP_LDFLAGS="-L$with_clp/lib"
    1.33 +    fi
    1.34 +    CLP_LIBS="-lClp -lCoinUtils -lm"
    1.35 +
    1.36 +    lx_save_cxxflags="$CXXFLAGS"
    1.37 +    lx_save_ldflags="$LDFLAGS"
    1.38 +    lx_save_libs="$LIBS"
    1.39 +    CXXFLAGS="$CLP_CXXFLAGS"
    1.40 +    LDFLAGS="$CLP_LDFLAGS"
    1.41 +    LIBS="$CLP_LIBS"
    1.42 +
    1.43 +    lx_clp_test_prog='
    1.44 +      #include <coin/ClpModel.hpp>
    1.45 +
    1.46 +      int main(int argc, char** argv)
    1.47 +      {
    1.48 +        ClpModel clp;
    1.49 +        return 0;
    1.50 +      }'
    1.51 +
    1.52 +    AC_LANG_PUSH(C++)
    1.53 +    AC_LINK_IFELSE([$lx_clp_test_prog], [lx_clp_found=yes], [lx_clp_found=no])
    1.54 +    AC_LANG_POP(C++)
    1.55 +
    1.56 +    CXXFLAGS="$lx_save_cxxflags"
    1.57 +    LDFLAGS="$lx_save_ldflags"
    1.58 +    LIBS="$lx_save_libs"
    1.59 +
    1.60 +    if test x"$lx_clp_found" = x"yes"; then
    1.61 +      AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.])
    1.62 +      lx_lp_found=yes
    1.63 +      AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.])
    1.64 +      AC_MSG_RESULT([yes])
    1.65 +    else
    1.66 +      CLP_CXXFLAGS=""
    1.67 +      CLP_LDFLAGS=""
    1.68 +      CLP_LIBS=""
    1.69 +      AC_MSG_RESULT([no])
    1.70 +    fi
    1.71 +  fi
    1.72 +  CLP_LIBS="$CLP_LDFLAGS $CLP_LIBS"
    1.73 +  AC_SUBST(CLP_CXXFLAGS)
    1.74 +  AC_SUBST(CLP_LIBS)
    1.75 +  AM_CONDITIONAL([HAVE_CLP], [test x"$lx_clp_found" = x"yes"])
    1.76 +])