m4/lx_check_soplex.m4
author Peter Kovacs <kpeter@inf.elte.hu>
Fri, 09 Jan 2009 12:43:52 +0100
changeset 450 14bb8812b8af
parent 1 51eaad3a817b
child 457 69928a704ffb
child 500 8a144437db7d
permissions -rw-r--r--
Add creator functions for Residual and Residual::ResidualCapacity (#67)
ladanyi@1
     1
AC_DEFUN([LX_CHECK_SOPLEX],
ladanyi@1
     2
[
ladanyi@1
     3
  AC_ARG_WITH([soplex],
ladanyi@1
     4
AS_HELP_STRING([--with-soplex@<:@=PREFIX@:>@], [search for SOPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
ladanyi@1
     5
AS_HELP_STRING([--without-soplex], [disable checking for SOPLEX]),
ladanyi@1
     6
              [], [with_soplex=yes])
ladanyi@1
     7
ladanyi@1
     8
  AC_ARG_WITH([soplex-includedir],
ladanyi@1
     9
AS_HELP_STRING([--with-soplex-includedir=DIR], [search for SOPLEX headers in DIR]),
ladanyi@1
    10
              [], [with_soplex_includedir=no])
ladanyi@1
    11
ladanyi@1
    12
  AC_ARG_WITH([soplex-libdir],
ladanyi@1
    13
AS_HELP_STRING([--with-soplex-libdir=DIR], [search for SOPLEX libraries in DIR]),
ladanyi@1
    14
              [], [with_soplex_libdir=no])
ladanyi@1
    15
ladanyi@1
    16
  lx_soplex_found=no
ladanyi@1
    17
  if test x"$with_soplex" != x"no"; then
ladanyi@1
    18
    AC_MSG_CHECKING([for SOPLEX])
ladanyi@1
    19
ladanyi@1
    20
    if test x"$with_soplex_includedir" != x"no"; then
ladanyi@1
    21
      SOPLEX_CXXFLAGS="-I$with_soplex_includedir"
ladanyi@1
    22
    elif test x"$with_soplex" != x"yes"; then
ladanyi@1
    23
      SOPLEX_CXXFLAGS="-I$with_soplex/include"
ladanyi@1
    24
    fi
ladanyi@1
    25
ladanyi@1
    26
    if test x"$with_soplex_libdir" != x"no"; then
ladanyi@1
    27
      SOPLEX_LDFLAGS="-L$with_soplex_libdir"
ladanyi@1
    28
    elif test x"$with_soplex" != x"yes"; then
ladanyi@1
    29
      SOPLEX_LDFLAGS="-L$with_soplex/lib"
ladanyi@1
    30
    fi
ladanyi@1
    31
    SOPLEX_LIBS="-lsoplex -lz"
ladanyi@1
    32
ladanyi@1
    33
    lx_save_cxxflags="$CXXFLAGS"
ladanyi@1
    34
    lx_save_ldflags="$LDFLAGS"
ladanyi@1
    35
    lx_save_libs="$LIBS"
ladanyi@1
    36
    CXXFLAGS="$SOPLEX_CXXFLAGS"
ladanyi@1
    37
    LDFLAGS="$SOPLEX_LDFLAGS"
ladanyi@1
    38
    LIBS="$SOPLEX_LIBS"
ladanyi@1
    39
ladanyi@1
    40
    lx_soplex_test_prog='
ladanyi@1
    41
      #include <soplex/soplex.h>
ladanyi@1
    42
ladanyi@187
    43
      int main(int argc, char** argv)
ladanyi@1
    44
      {
ladanyi@1
    45
        soplex::SoPlex soplex;
ladanyi@1
    46
        return 0;
ladanyi@1
    47
      }'
ladanyi@1
    48
ladanyi@1
    49
    AC_LANG_PUSH(C++)
ladanyi@1
    50
    AC_LINK_IFELSE([$lx_soplex_test_prog], [lx_soplex_found=yes], [lx_soplex_found=no])
ladanyi@1
    51
    AC_LANG_POP(C++)
ladanyi@1
    52
ladanyi@1
    53
    CXXFLAGS="$lx_save_cxxflags"
ladanyi@1
    54
    LDFLAGS="$lx_save_ldflags"
ladanyi@1
    55
    LIBS="$lx_save_libs"
ladanyi@1
    56
ladanyi@1
    57
    if test x"$lx_soplex_found" = x"yes"; then
ladanyi@1
    58
      AC_DEFINE([HAVE_SOPLEX], [1], [Define to 1 if you have SOPLEX.])
ladanyi@1
    59
      AC_MSG_RESULT([yes])
ladanyi@1
    60
    else
ladanyi@1
    61
      SOPLEX_CXXFLAGS=""
ladanyi@1
    62
      SOPLEX_LDFLAGS=""
ladanyi@1
    63
      SOPLEX_LIBS=""
ladanyi@1
    64
      AC_MSG_RESULT([no])
ladanyi@1
    65
    fi
ladanyi@1
    66
  fi
ladanyi@1
    67
  SOPLEX_LIBS="$SOPLEX_LDFLAGS $SOPLEX_LIBS"
ladanyi@1
    68
  AC_SUBST(SOPLEX_CXXFLAGS)
ladanyi@1
    69
  AC_SUBST(SOPLEX_LIBS)
ladanyi@1
    70
  AM_CONDITIONAL([HAVE_SOPLEX], [test x"$lx_soplex_found" = x"yes"])
ladanyi@1
    71
])