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