config/lp.m4
author ladanyi
Mon, 18 Apr 2005 17:23:42 +0000
changeset 1369 f1cf6b807414
parent 1355 57936f15055b
child 1373 284841d50d63
permissions -rw-r--r--
irrelevant changes
     1 AC_DEFUN([LX_CHECK_GLPK],
     2 [
     3   AC_ARG_WITH([glpk],
     4 AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
     5 AS_HELP_STRING([--without-glpk], [disable checking for GLPK]),
     6               [], [with_glpk=yes])
     7 
     8   AC_ARG_WITH([glpk-includedir],
     9 AS_HELP_STRING([--with-glpk-includedir=DIR], [search for GLPK headers in DIR]),
    10               [], [with_glpk_includedir=no])
    11 
    12   AC_ARG_WITH([glpk-libdir],
    13 AS_HELP_STRING([--with-glpk-libdir=DIR], [search for GLPK libraries in DIR]),
    14               [], [with_glpk_libdir=no])
    15 
    16   if test x"$with_glpk" != x"no"; then
    17     AC_MSG_CHECKING([for GLPK])
    18 
    19     if test x"$with_glpk_includedir" != x"no"; then
    20       GLPK_CFLAGS="-I$with_glpk_includedir"
    21     elif test x"$with_glpk" != x"yes"; then
    22       GLPK_CFLAGS="-I$with_glpk/include"
    23     fi
    24 
    25     if test x"$with_glpk_libdir" != x"no"; then
    26       GLPK_LDFLAGS="-L$with_glpk_libdir"
    27     elif test x"$with_glpk" != x"yes"; then
    28       GLPK_LDFLAGS="-L$with_glpk/lib"
    29     fi
    30     GLPK_LIBS="-lglpk"
    31 
    32     lx_save_cxxflags="$CXXFLAGS";
    33     lx_save_ldflags="$LDFLAGS";
    34     lx_save_libs="$LIBS";
    35     CXXFLAGS="$GLPK_CFLAGS"
    36     LDFLAGS="$GLPK_LDFLAGS"
    37     LIBS="$GLPK_LIBS"
    38 
    39     lx_glpk_test_prog='
    40       extern "C" {
    41       #include <glpk.h>
    42       }
    43 
    44       int main(int argc, char* argv[])
    45       {
    46         LPX *lp;
    47         lp = lpx_create_prob();
    48         lpx_delete_prob(lp);
    49         return 0;
    50       }'
    51 
    52     AC_LANG_PUSH(C++)
    53     AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], [])
    54     AC_LANG_POP(C++)
    55 
    56     CXXFLAGS="$lx_save_cxxflags"
    57     LDFLAGS="$lx_save_ldflags"
    58     LIBS="$lx_save_libs"
    59 
    60     if test x"$lx_glpk_found" = x"yes"; then
    61       AC_DEFINE([HAVE_GLPK], [1], [Define to 1 if you have GLPK.])
    62       AC_MSG_RESULT([yes])
    63     else
    64       AC_MSG_RESULT([no])
    65     fi
    66   fi
    67   GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS"
    68   AC_SUBST(GLPK_CFLAGS)
    69   AC_SUBST(GLPK_LIBS)
    70   AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"])
    71 ])