Changeset 434


Ignore:
Timestamp:
Jul 25, 2007 7:01:56 PM (13 years ago)
Author:
lou
Message:

Revised version of COIN_HAS_GLPK, considers glpk and gmpl.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin.m4

    r428 r434  
    23672367# matching automake conditional COIN_HAS_LBRY. LBRYINCDIR should specify the
    23682368# directory containing include files for the library. LBRYLIB should specify
    2369 # the flags necessary to link to the library.
     2369# the flags necessary to link to the library. A variable coin_has_lbry will
     2370# be set to true or false, as appropriate. A variable lbry_libcheck will be
     2371# be set to yes or no; no indicates link checks should not be attempted.
    23702372#
    23712373# The macro defines three configure arguments, --with-libraryname-incdir,
     
    24782480
    24792481    ADDLIBS="$$2LIB $ADDLIBS"
    2480     AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is used])
     2482    AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available])
    24812483  fi
    24822484
     
    29912993#                             COIN_HAS_GLPK                               #
    29922994###########################################################################
    2993 
    2994 # This macro checks for a library containing the GLPK library.  It
    2995 # checks if the user has provided --with-glpk-lib and --with-glpk-incdir
    2996 # flags, and it not, it checks if the ThirdParty/Glpk project is available.
     2995#
     2996# This macro checks for the GLPK package. GLPK provides two capabilities,
     2997# an LP and MIP solver (GLPK) and the GNU Mathprog modelling language (GMPL).
     2998# The macro checks for either Glpk or Gmpl, according to the value specified as
     2999# the parameter. Use one of Glpk or Gmpl. Use *exactly* these strings, eh?
     3000#
     3001#
     3002# The macro first uses COIN_HAS_USER_LIBRARY to see if the user has specified
     3003# a preexisting library (this allows the use of any glpk version, if the user
     3004# is fussy). The macro then checks for ThirdParty/Glpk.
     3005#
     3006# This macro will define the following variables for Glpk:
     3007#   coin_has_glpk       true or false
     3008#   GLPKLIB             location of the glpk library at build time; this is
     3009#                       added to ADDLIBS
     3010#   GLPKINCDIR          location of glpk include files
     3011#   COIN_HAS_GLPK       Preprocessor symbol, defined to 1
     3012#   COIN_HAS_GLPK       Automake conditional
     3013#   COIN_BUILD_GLPK     Automake conditional, defined only if Glpk is to be
     3014#                       built in ThirdParty/Glpk
     3015#
     3016# With the exception of COIN_BUILD_GLPK, an identical set of variables is
     3017# defined for Gmpl.
    29973018
    29983019AC_DEFUN([AC_COIN_HAS_GLPK],
     
    30053026coin_glpksrcdir=$abs_source_dir/$coin_glpkobjdir
    30063027
    3007 AC_COIN_HAS_USER_LIBRARY([Glpk],[GLPK],[glpk.h],
     3028use_thirdpartyglpk=no
     3029
     3030# Check for the requested component. If the user specified an external glpk
     3031# library don't force a ThirdParty build, let the error propagate.
     3032
     3033m4_if([$1],[Glpk],
     3034[AC_COIN_HAS_USER_LIBRARY([Glpk],[GLPK],[glpk.h],
    30083035    [_glp_lpx_simplex glp_lpx_simplex])
    3009 
    3010 MAKEOKFILE=.MakeOk
    3011 use_glpk="$GLPKLIB"
    3012 if test "$GLPKLIB" == ""; then
    3013 
     3036 if test x"$coin_has_glpk" = xfalse && test x"$GLPKLIB" = x ; then
     3037   use_thirdpartyglpk=try
     3038 fi])
     3039m4_if([$1],[Gmpl],
     3040[AC_COIN_HAS_USER_LIBRARY([Gmpl],[GMPL],[glpmpl.h],
     3041    [_glp_mpl_initialize glp_mpl_initialize])
     3042 AC_MSG_NOTICE([Result of Gmpl check is $coin_has_gmpl])
     3043 if test x"$coin_has_gmpl" = xfalse && test x"$GMPLLIB" = x ; then
     3044   use_thirdpartyglpk=try
     3045 fi])
     3046
     3047# If the user has supplied an external library, use it. Otherwise, consider
     3048# a build in ThirdParty/Glpk. If we build, assume we get both glpk and gmpl.
     3049
     3050if test x"$use_thirdpartyglpk" = xtry ; then
     3051  MAKEOKFILE=.MakeOk
    30143052  # Check if the Glpk's ThirdParty project has been configured
    30153053  if test "$PACKAGE_NAME" != ThirdPartyGlpk; then
    30163054    if test -r $coin_glpkobjdir/.MakeOk; then
    3017       use_glpk=BUILD
     3055      use_thirdpartyglpk=build
     3056    else
     3057      use_thirdpartyglpk=no
    30183058    fi
    3019   fi
    3020 fi
    3021 
    3022 if test x"$use_glpk" == xBUILD; then
    3023 
    3024   GLPKCOINLIB=`cd $coin_glpkobjdir; pwd`/libcoinglpk.la
    3025   AC_SUBST(GLPKCOINLIB)
    3026 
    3027   GLPKINCDIR="$coin_glpksrcdir/glpk/include"
    3028   AC_DEFINE(COIN_HAS_GLPK,[1],[Define to 1 if the Glpk package is used])
    3029 
    3030   # This is a "true" for AM_CONDITIONAL(COIN_HAS_GLPK)
    3031   COIN_HAS_GLPK_TRUE=
    3032   COIN_HAS_GLPK_FALSE='#'
    3033 
    3034   coin_has_glpk=yes
    3035 
    3036   AC_MSG_NOTICE([Using Glpk in ThirdParty])
    3037 fi
    3038 
    3039 AM_CONDITIONAL([COIN_BUILD_GLPK],[test x"$use_glpk" = xBUILD])
     3059  else
     3060    use_thirdpartyglpk=build
     3061  fi
     3062
     3063# If we're building, set the library and include directory variables, create a
     3064# preprocessor symbol, define a variable that says we're using glpk/gmpl, and
     3065# another to indicate a link check is a bad idea (hard to do before the library
     3066# exists).
     3067
     3068  if test x"$use_thirdpartyglpk" == xbuild ; then
     3069    m4_toupper($1LIB)=`cd $coin_glpkobjdir; pwd`/libcoinglpk.la
     3070    AC_SUBST(m4_toupper($1LIB))
     3071    ADDLIBS="$m4_toupper($1LIB) $ADDLIBS"
     3072    m4_toupper($1INCDIR)="$coin_glpksrcdir/glpk/include"
     3073    AC_SUBST(m4_toupper($1INCDIR))
     3074    AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],
     3075              [Define to 1 if $1 package is available])
     3076    m4_tolower(coin_has_$1)=true
     3077    m4_tolower($1_libcheck)=no
     3078    AC_MSG_NOTICE([Using $1 in ThirdParty/Glpk])
     3079  fi
     3080fi
     3081
     3082# Define the necessary automake conditionals.
     3083
     3084AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
     3085               [test x"$m4_tolower(coin_has_$1)" = xtrue])
     3086AM_CONDITIONAL([COIN_BUILD_GLPK],[test x"$use_thirdpartyglpk" = xbuild])
    30403087
    30413088]) # AC_COIN_HAS_GLPK
Note: See TracChangeset for help on using the changeset viewer.