m4/lx_check_soplex.m4
changeset 1 51eaad3a817b
child 187 84c2a2e5cfee
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/m4/lx_check_soplex.m4	Tue Dec 18 10:56:09 2007 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +AC_DEFUN([LX_CHECK_SOPLEX],
     1.5 +[
     1.6 +  AC_ARG_WITH([soplex],
     1.7 +AS_HELP_STRING([--with-soplex@<:@=PREFIX@:>@], [search for SOPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
     1.8 +AS_HELP_STRING([--without-soplex], [disable checking for SOPLEX]),
     1.9 +              [], [with_soplex=yes])
    1.10 +
    1.11 +  AC_ARG_WITH([soplex-includedir],
    1.12 +AS_HELP_STRING([--with-soplex-includedir=DIR], [search for SOPLEX headers in DIR]),
    1.13 +              [], [with_soplex_includedir=no])
    1.14 +
    1.15 +  AC_ARG_WITH([soplex-libdir],
    1.16 +AS_HELP_STRING([--with-soplex-libdir=DIR], [search for SOPLEX libraries in DIR]),
    1.17 +              [], [with_soplex_libdir=no])
    1.18 +
    1.19 +  lx_soplex_found=no
    1.20 +  if test x"$with_soplex" != x"no"; then
    1.21 +    AC_MSG_CHECKING([for SOPLEX])
    1.22 +
    1.23 +    if test x"$with_soplex_includedir" != x"no"; then
    1.24 +      SOPLEX_CXXFLAGS="-I$with_soplex_includedir"
    1.25 +    elif test x"$with_soplex" != x"yes"; then
    1.26 +      SOPLEX_CXXFLAGS="-I$with_soplex/include"
    1.27 +    fi
    1.28 +
    1.29 +    if test x"$with_soplex_libdir" != x"no"; then
    1.30 +      SOPLEX_LDFLAGS="-L$with_soplex_libdir"
    1.31 +    elif test x"$with_soplex" != x"yes"; then
    1.32 +      SOPLEX_LDFLAGS="-L$with_soplex/lib"
    1.33 +    fi
    1.34 +    SOPLEX_LIBS="-lsoplex -lz"
    1.35 +
    1.36 +    lx_save_cxxflags="$CXXFLAGS"
    1.37 +    lx_save_ldflags="$LDFLAGS"
    1.38 +    lx_save_libs="$LIBS"
    1.39 +    CXXFLAGS="$SOPLEX_CXXFLAGS"
    1.40 +    LDFLAGS="$SOPLEX_LDFLAGS"
    1.41 +    LIBS="$SOPLEX_LIBS"
    1.42 +
    1.43 +    lx_soplex_test_prog='
    1.44 +      #include <soplex/soplex.h>
    1.45 +
    1.46 +      int main(int argc, char* argv[])
    1.47 +      {
    1.48 +        soplex::SoPlex soplex;
    1.49 +        return 0;
    1.50 +      }'
    1.51 +
    1.52 +    AC_LANG_PUSH(C++)
    1.53 +    AC_LINK_IFELSE([$lx_soplex_test_prog], [lx_soplex_found=yes], [lx_soplex_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_soplex_found" = x"yes"; then
    1.61 +      AC_DEFINE([HAVE_SOPLEX], [1], [Define to 1 if you have SOPLEX.])
    1.62 +      AC_MSG_RESULT([yes])
    1.63 +    else
    1.64 +      SOPLEX_CXXFLAGS=""
    1.65 +      SOPLEX_LDFLAGS=""
    1.66 +      SOPLEX_LIBS=""
    1.67 +      AC_MSG_RESULT([no])
    1.68 +    fi
    1.69 +  fi
    1.70 +  SOPLEX_LIBS="$SOPLEX_LDFLAGS $SOPLEX_LIBS"
    1.71 +  AC_SUBST(SOPLEX_CXXFLAGS)
    1.72 +  AC_SUBST(SOPLEX_LIBS)
    1.73 +  AM_CONDITIONAL([HAVE_SOPLEX], [test x"$lx_soplex_found" = x"yes"])
    1.74 +])