Changeset 2422


Ignore:
Timestamp:
Sep 3, 2011 12:30:27 PM (8 years ago)
Author:
stefan
Message:

add AC_COIN_CHECK_GMP; cleanup a few other macros

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin.m4

    r2421 r2422  
    20672067
    20682068# This macro defined the --enable-gnu-packages flag.  This can be used
    2069 # to check if a user wants to compile GNU packges (such as readline or
    2070 # zlib) into the executable.  By default, GNU packages are disabled.
     2069# to check if a user wants to compile GNU packges (such as readline)
     2070# into the executable.  By default, GNU packages are disabled.
    20712071# This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES
    20722072
     
    21322132
    21332133  if test $coin_has_zlib = yes; then
    2134     AC_CHECK_LIB([z],[gzopen],
    2135                  [coin_foreach_w([myvar], [$1], [
     2134    AC_CHECK_LIB([z],[gzopen],,[coin_has_zlib=no])
     2135  fi
     2136
     2137  if test $coin_has_zlib = yes; then
     2138    coin_foreach_w([myvar], [$1], [
    21362139                    m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS"
    21372140                    m4_toupper(myvar)_PCLIBS="-lz $m4_toupper(myvar)_PCLIBS"
    21382141                    m4_toupper(myvar)_LIBS_INSTALLED="-lz $m4_toupper(myvar)_LIBS_INSTALLED"
    2139                   ])
    2140                  :],
    2141                  [coin_has_zlib=no])
    2142   fi
    2143 
    2144   if test $coin_has_zlib = yes; then
     2142                   ])
    21452143    AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
    21462144  fi
     
    21782176
    21792177  if test $coin_has_bzlib = yes; then
    2180     AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],
    2181                  [coin_foreach_w([myvar], [$1], [
     2178    AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],,[coin_has_bzlib=no])
     2179  fi
     2180
     2181  if test $coin_has_bzlib = yes; then
     2182    coin_foreach_w([myvar], [$1], [
    21822183                    m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS"
    21832184                    m4_toupper(myvar)_PCLIBS="-lbz2 $m4_toupper(myvar)_PCLIBS"
    21842185                    m4_toupper(myvar)_LIBS_INSTALLED="-lbz2 $m4_toupper(myvar)_LIBS_INSTALLED"
    21852186                  ])
    2186                  :],
    2187                  [coin_has_bzlib=no])
    2188   fi
    2189 
    2190   if test $coin_has_bzlib = yes; then
    21912187    AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
    21922188  fi
     
    22302226  # Now we check for readline
    22312227  if test $coin_has_readline = yes; then
    2232     AC_CHECK_LIB([readline],[readline],
    2233                  [coin_foreach_w([myvar], [$1], [
     2228    AC_CHECK_LIB([readline],[readline],,[coin_has_readline=no])
     2229  fi
     2230
     2231  if test $coin_has_readline = yes; then
     2232    coin_foreach_w([myvar], [$1], [
    22342233                    m4_toupper(myvar)_LIBS="-lreadline $LIBS $m4_toupper(myvar)_LIBS"
    22352234                    m4_toupper(myvar)_PCLIBS="-lreadline $LIBS $m4_toupper(myvar)_PCLIBS"
    22362235                    m4_toupper(myvar)_LIBS_INSTALLED="-lreadline $LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
    2237                   ])
    2238                  :],
    2239                  [coin_has_readline=no])
    2240   fi
    2241 
    2242   if test $coin_has_readline = yes; then
     2236                   ])
    22432237    AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
    22442238  fi
     
    22472241fi
    22482242]) # AC_COIN_CHECK_GNU_READLINE
     2243
     2244###########################################################################
     2245#                              COIN_CHECK_GMP                             #
     2246###########################################################################
     2247
     2248# This macro checks for the gmp library.  If found, it defines the C
     2249# preprocessor variable COIN_HAS_GMP.  Further, for a (space separated) list
     2250# of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
     2251
     2252AC_DEFUN([AC_COIN_CHECK_GMP],
     2253[
     2254AC_BEFORE([AC_COIN_PROG_CXX],[$0])
     2255AC_BEFORE([AC_COIN_PROG_CC],[$0])
     2256AC_BEFORE([AC_COIN_PROG_F77],[$0])
     2257AC_BEFORE([$0],[AC_COIN_FINALIZE])
     2258
     2259AC_ARG_ENABLE([gmp],
     2260              [AC_HELP_STRING([--disable-gmp],[do not compile with GNU multiple precision library])],
     2261              [coin_enable_gmp=$enableval],
     2262              [coin_enable_gmp=yes])
     2263
     2264coin_has_gmp=no
     2265if test $coin_enable_gmp = yes; then
     2266  AC_COIN_CHECK_HEADER([gmp.h],[AC_CHECK_LIB([gmp],[__gmpz_init],[coin_has_gmp=yes])])
     2267 
     2268  if test $coin_has_gmp = yes ; then
     2269    coin_foreach_w([myvar], [$1], [
     2270                    m4_toupper(myvar)_LIBS="-lgmp $m4_toupper(myvar)_LIBS"
     2271                    m4_toupper(myvar)_PCLIBS="-lgmp $m4_toupper(myvar)_PCLIBS"
     2272                    m4_toupper(myvar)_LIBS_INSTALLED="-lgmp $m4_toupper(myvar)_LIBS_INSTALLED"
     2273                   ])
     2274    AC_DEFINE([COIN_HAS_GMP],[1],[Define to 1 if GMP is available])
     2275  fi
     2276fi
     2277]) # AC_COIN_CHECK_GMP
    22492278
    22502279###########################################################################
Note: See TracChangeset for help on using the changeset viewer.