m4/lx_check_soplex.m4
author Alpar Juttner <alpar@cs.elte.hu>
Sun, 07 Mar 2010 09:42:47 +0000
branch1.1
changeset 939 86a880ba752d
parent 586 547e966b3b29
parent 540 8a144437db7d
permissions -rw-r--r--
Update NEWS file
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
alpar@586
    23
      SOPLEX_CXXFLAGS="-I$with_soplex/src"
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='
alpar@586
    41
      #include <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@540
    58
      AC_DEFINE([LEMON_HAVE_SOPLEX], [1], [Define to 1 if you have SOPLEX.])
alpar@480
    59
      lx_lp_found=yes
ladanyi@674
    60
      AC_DEFINE([LEMON_HAVE_LP], [1], [Define to 1 if you have any LP solver.])
ladanyi@1
    61
      AC_MSG_RESULT([yes])
ladanyi@1
    62
    else
ladanyi@1
    63
      SOPLEX_CXXFLAGS=""
ladanyi@1
    64
      SOPLEX_LDFLAGS=""
ladanyi@1
    65
      SOPLEX_LIBS=""
ladanyi@1
    66
      AC_MSG_RESULT([no])
ladanyi@1
    67
    fi
ladanyi@1
    68
  fi
ladanyi@1
    69
  SOPLEX_LIBS="$SOPLEX_LDFLAGS $SOPLEX_LIBS"
ladanyi@1
    70
  AC_SUBST(SOPLEX_CXXFLAGS)
ladanyi@1
    71
  AC_SUBST(SOPLEX_LIBS)
ladanyi@1
    72
  AM_CONDITIONAL([HAVE_SOPLEX], [test x"$lx_soplex_found" = x"yes"])
ladanyi@1
    73
])