COIN-OR::LEMON - Graph Library

source: lemon-0.x/config/lx_check_cplex.m4 @ 1506:e8f1ad6cc8dd

Last change on this file since 1506:e8f1ad6cc8dd was 1489:f7e9cc3bc2da, checked in by Akos Ladanyi, 14 years ago
  • separate file for each m4 script
  • consistent naming
  • removed cxxflags.m4
File size: 2.1 KB
Line 
1AC_DEFUN([LX_CHECK_CPLEX],
2[
3  AC_ARG_WITH([cplex],
4AS_HELP_STRING([--with-cplex@<:@=PREFIX@:>@], [search for CPLEX under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
5AS_HELP_STRING([--without-cplex], [disable checking for CPLEX]),
6              [], [with_cplex=yes])
7
8  AC_ARG_WITH([cplex-includedir],
9AS_HELP_STRING([--with-cplex-includedir=DIR], [search for CPLEX headers in DIR]),
10              [], [with_cplex_includedir=no])
11
12  AC_ARG_WITH([cplex-libdir],
13AS_HELP_STRING([--with-cplex-libdir=DIR], [search for CPLEX libraries in DIR]),
14              [], [with_cplex_libdir=no])
15
16  lx_cplex_found=no
17  if test x"$with_cplex" != x"no"; then
18    AC_MSG_CHECKING([for CPLEX])
19
20    if test x"$with_cplex_includedir" != x"no"; then
21      CPLEX_CFLAGS="-I$with_cplex_includedir"
22    elif test x"$with_cplex" != x"yes"; then
23      CPLEX_CFLAGS="-I$with_cplex/include"
24    fi
25
26    if test x"$with_cplex_libdir" != x"no"; then
27      CPLEX_LDFLAGS="-L$with_cplex_libdir"
28    elif test x"$with_cplex" != x"yes"; then
29      CPLEX_LDFLAGS="-L$with_cplex/lib"
30    fi
31    CPLEX_LIBS="-lcplex -lm -lpthread"
32
33    lx_save_cxxflags="$CXXFLAGS"
34    lx_save_ldflags="$LDFLAGS"
35    lx_save_libs="$LIBS"
36    CXXFLAGS="$CPLEX_CFLAGS"
37    LDFLAGS="$CPLEX_LDFLAGS"
38    LIBS="$CPLEX_LIBS"
39
40    lx_cplex_test_prog='
41      extern "C" {
42      #include <ilcplex/cplex.h>
43      }
44
45      int main(int argc, char* argv[])
46      {
47        CPXENVptr env = NULL;
48        return 0;
49      }'
50
51    AC_LANG_PUSH(C++)
52    AC_LINK_IFELSE([$lx_cplex_test_prog], [lx_cplex_found=yes], [lx_cplex_found=no])
53    AC_LANG_POP(C++)
54
55    CXXFLAGS="$lx_save_cxxflags"
56    LDFLAGS="$lx_save_ldflags"
57    LIBS="$lx_save_libs"
58
59    if test x"$lx_cplex_found" = x"yes"; then
60      AC_DEFINE([HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.])
61      AC_MSG_RESULT([yes])
62    else
63      CPLEX_CFLAGS=""
64      CPLEX_LDFLAGS=""
65      CPLEX_LIBS=""
66      AC_MSG_RESULT([no])
67    fi
68  fi
69  CPLEX_LIBS="$CPLEX_LDFLAGS $CPLEX_LIBS"
70  AC_SUBST(CPLEX_CFLAGS)
71  AC_SUBST(CPLEX_LIBS)
72  AM_CONDITIONAL([HAVE_CPLEX], [test x"$lx_cplex_found" = x"yes"])
73])
Note: See TracBrowser for help on using the repository browser.