Changeset 1695 for stable/0.6/coin.m4


Ignore:
Timestamp:
Oct 30, 2010 6:24:42 PM (11 years ago)
Author:
tkr
Message:

Syncing stable/0.6 with trunk

Location:
stable/0.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable/0.6

  • stable/0.6/coin.m4

    r1694 r1695  
    1212# Check requirements
    1313AC_PREREQ(2.59)
     14
     15###########################################################################
     16#                           coin_foreach_w                                #
     17###########################################################################
     18
     19# the autoconf version used by COIN-OR is so old that it does not have the M4 macro foreach_w.
     20# thus, we define our own one which applies the foreach macro to the same arguments but with
     21# all spaces replaced by ',' in the second argument.
     22# further, we run the loop only if the second argument is not empty
     23AC_DEFUN([coin_foreach_w], [m4_ifval([$2], [m4_foreach([$1], [m4_bpatsubsts([$2],[[     ]+],[, ])], [$3])])])
    1424
    1525###########################################################################
     
    270280# This macro sets the variable coin_vpath_config to true if this is a
    271281# VPATH configuration, otherwise it sets it to false.
     282
    272283AC_DEFUN([AC_COIN_CHECK_VPATH],
    273 [AC_MSG_CHECKING(whether this is a VPATH configuration)
     284[
     285AC_MSG_CHECKING(whether this is a VPATH configuration)
    274286if test `cd $srcdir; pwd` != `pwd`; then
    275287  coin_vpath_config=yes;
     
    285297
    286298# This macro does everything that is required in the early part in the
    287 # configure script, such as defining a few variables.  This should only
    288 # be used in the main directory of a project directory (the one under
    289 # which src is)
     299# configure script, such as defining a few variables.  This should only be used
     300# in the main directory of a project directory (the one which holds the src
     301# directory for the project). The first parameter is the project name. The
     302# second (optional) is the libtool library version (important for releases,
     303# less so for stable or trunk).
    290304
    291305AC_DEFUN([AC_COIN_PROJECTDIR_INIT],
     
    294308AC_SUBST(ADDLIBS)
    295309
     310# Initialize the PCADDLIBS variable.
     311# This variable is used to setup library flags for the "Libs:" section in a .pc file.
     312# In certain cases, it may contain more flags than the ADDLIBS variable.
     313PCADDLIBS=""
     314AC_SUBST(PCADDLIBS)
     315
    296316# As backup, we make sure we don't loose an FLIBS if it has been set
    297317# by the user
     
    310330coin_projectdir=yes
    311331
    312 # Check if a library version is set for libtool
    313 m4_ifvaln([$1],[coin_libversion=$1],[])
     332# Set the project's version number
     333if test "x$1" != x; then
     334  AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION), ["$PACKAGE_VERSION"],
     335                     [Version number of project])
     336fi
     337
     338# Set the project's SVN revision number. The complicated sed expression
     339# (made worse by quadrigraphs) ensures that things like 4123:4168MS end up
     340# as a single number.
     341AC_CHECK_PROG([have_svnversion],[svnversion],[yes],[no])
     342if test "x$have_svnversion" = xyes && test "x$1" != x; then
     343  AC_SUBST(m4_toupper($1_SVN_REV))
     344  svn_rev_tmp=`cd $srcdir/$m4_tolower(coin_has_$1) ; svnversion`
     345  m4_toupper($1_SVN_REV)=`echo $svn_rev_tmp | sed -n -e 's/^@<:@0-9@:>@*://' -e 's/\(@<:@0-9@:>@\)@<:@^0-9@:>@*$/\1/p'`
     346  if test $m4_toupper($1_SVN_REV) != exported; then
     347    AC_DEFINE_UNQUOTED(m4_toupper($1_SVN_REV), $m4_toupper($1_SVN_REV),
     348                       [SVN revision number of project])
     349  fi
     350fi
     351
     352# Capture libtool library version, if given.
     353m4_ifvaln([$2],[coin_libversion=$2],[])
    314354]) # AC_COIN_PROJECTDIR_INIT
    315355
     
    587627      *)
    588628# ToDo decide about unroll-loops
    589         coin_opt_cxxflags="-O3 -fomit-frame-pointer"
     629        coin_opt_cxxflags="-O3"
    590630        coin_add_cxxflags="-pipe"
    591631        coin_dbg_cxxflags="-g"
     
    9721012        ;;
    9731013      *)
    974         coin_opt_cflags="-O3 -fomit-frame-pointer"
     1014        coin_opt_cflags="-O3"
    9751015        coin_add_cflags="-pipe"
    9761016        coin_dbg_cflags="-g"
     
    11981238
    11991239  if test "$G77" = "yes"; then
    1200     coin_opt_fflags="-O3 -fomit-frame-pointer"
     1240    coin_opt_fflags="-O3"
    12011241    coin_add_fflags="-pipe"
    12021242    coin_dbg_fflags="-g"
     
    13901430  # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables.
    13911431  # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line.
     1432  # Further, excluding libc.lib from the default libs seemed to be necessary only for VS < 8.
     1433  # Since the corresponding flag seems to make more trouble that it avoid, it has been removed now.
    13921434     *-cygwin* | *-mingw*)
    13931435       case "$F77" in
    1394          ifort* | */ifort* | IFORT* | */IFORT*)
    1395            FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib"
     1436#         ifort* | */ifort* | IFORT* | */IFORT*)
     1437#           FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib"
    13961438#           if "$coin_debug_compile" = true ; then
    13971439#             FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib"
     
    13991441#             FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib"
    14001442#           fi
    1401            ;;
     1443#           ;;
    14021444         compile_f2c*)
    14031445           FLIBS=`$F77 -FLIBS` ;;
     
    14111453         pgf77* | */pgf77* | pgf90* | */pgf90*)
    14121454# ask linker to go through the archives multiple times
    1413 # (the Fortran compiler seems to do that automatically...
     1455# (the Fortran compiler seems to do that automatically...)
    14141456           FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;;
    14151457       esac
     
    16621704full_prefix=`cd $full_prefix ; pwd`
    16631705AC_SUBST(abs_lib_dir)
    1664 abs_lib_dir=$full_prefix/lib
     1706abs_lib_dir=$full_prefix/lib/coin
    16651707AC_SUBST(abs_include_dir)
    16661708abs_include_dir=$full_prefix/include
     
    17861828  # set RPATH_FLAGS to the compiler link flags required to hardcode location
    17871829  # of the shared objects
    1788   AC_COIN_RPATH_FLAGS($abs_lib_dir)
     1830  AC_COIN_RPATH_FLAGS([$abs_lib_dir $abs_lib_dir/ThirdParty])
    17891831
    17901832else
     
    18521894#END
    18531895}])
    1854 
    18551896
    18561897###########################################################################
     
    21272168    ADDLIBS="$ADDLIBS $FLIBS"
    21282169  fi
     2170  PCADDLIBS="$PCADDLIBS $ADDLIBS"
    21292171
    21302172  # library extension
     
    21592201  fi
    21602202
     2203  # need to come before AC_OUTPUT
     2204  if test x$coin_projectdir != xyes; then
     2205    # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects
     2206    echo $coin_subdirs > coin_subdirs.txt
     2207  else
     2208    # substitute for OBJDIR, needed to setup .pc file for uninstalled project
     2209    ABSBUILDDIR="`pwd`"
     2210    AC_SUBST(ABSBUILDDIR)
     2211  fi
     2212 
    21612213  AC_OUTPUT
    21622214
     
    21932245###########################################################################
    21942246
    2195 # This macro makes sure that a symbolic link is created to a file in
    2196 # the source code directory tree if we are in a VPATH compilation, and
    2197 # if this package is the main package to be installed
     2247# This macro queues source files that need to be available in the build
     2248# directory. In a VPATH configuration, the files will be made available by
     2249# symbolic link or copy (when the platform does not support links). The list
     2250# is processed by COIN_FINALIZE. The parameter is a whitespace-separated
     2251# list of files.
    21982252
    21992253AC_DEFUN([AC_COIN_VPATH_LINK],
    2200 [AC_REQUIRE([AC_COIN_CHECK_VPATH])
     2254[
     2255AC_REQUIRE([AC_COIN_CHECK_VPATH])
     2256# Allow for newlines in the parameter
    22012257if test $coin_vpath_config = yes; then
    2202   coin_vpath_link_files="$coin_vpath_link_files $1"
     2258  cvl_tmp="$1"
     2259  for file in $cvl_tmp ; do
     2260    coin_vpath_link_files="$coin_vpath_link_files $file"
     2261  done
    22032262fi
    22042263]) #AC_COIN_VPATH_LINK
     
    22212280]) # AC_COIN_ENABLE_GNU_PACKAGES
    22222281
     2282#######################################################################
     2283#                           COIN_CHECK_LIBM                           #
     2284#######################################################################
     2285
     2286# For a (space separated) list of arguments X, this macro adds the flags
     2287# for linking against the math library to a X_LIBS and X_PCLIBS.
     2288
     2289AC_DEFUN([AC_COIN_CHECK_LIBM],
     2290[AC_BEFORE([AC_COIN_PROG_CC],[$0])
     2291
     2292case "$CC" in
     2293  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
     2294    ;;
     2295  *)
     2296    coin_foreach_w([myvar], [$1], [
     2297      m4_toupper(myvar)_LIBS="-lm $m4_toupper(myvar)_LIBS"
     2298      m4_toupper(myvar)_PCLIBS="-lm $m4_toupper(myvar)_PCLIBS"
     2299    ])
     2300  ;;
     2301esac
     2302
     2303]) # AC_COIN_CHECK_LIBM
     2304
    22232305###########################################################################
    22242306#                           COIN_CHECK_GNU_ZLIB                           #
     
    22262308
    22272309# This macro checks for the libz library.
     2310# If found, it sets the automake conditional COIN_HAS_ZLIB and defines the C preprocessor variable COIN_HAS_ZLIB.
     2311# Further, for a (space separated) list of arguments X, it adds the linker flag to the variables X_LIBS and X_PCLIBS.
    22282312
    22292313AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB],
     
    22402324  if test $coin_has_zlib = yes; then
    22412325    AC_CHECK_LIB([z],[gzopen],
    2242                  [ADDLIBS="-lz $ADDLIBS"],
     2326                 [ADDLIBS="-lz $ADDLIBS"
     2327                  coin_foreach_w([myvar], [$1], [
     2328                    m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS"
     2329                    m4_toupper(myvar)_PCLIBS="-lz $m4_toupper(myvar)_PCLIBS"
     2330                  ])
     2331                 ],
    22432332                 [coin_has_zlib=no])
    22442333  fi
     
    22582347
    22592348# This macro checks for the libbz2 library.
     2349# If found, it defines the C preprocessor variable COIN_HAS_BZLIB.
     2350# Further, for a (space separated) list of arguments X, it adds the linker flag to the variables X_LIBS and X_PCLIBS.
    22602351
    22612352AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB],
     
    22722363  if test $coin_has_bzlib = yes; then
    22732364    AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],
    2274                  [ADDLIBS="-lbz2 $ADDLIBS"],
     2365                 [ADDLIBS="-lbz2 $ADDLIBS"
     2366                  coin_foreach_w([myvar], [$1], [
     2367                    m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS"
     2368                    m4_toupper(myvar)_PCLIBS="-lbz2 $m4_toupper(myvar)_PCLIBS"
     2369                  ])
     2370                 ],
    22752371                 [coin_has_bzlib=no])
    22762372  fi
     
    22912387# contains "readline".  It is assumed that #include <stdio.h> is included
    22922388# in the source file before the #include<readline/readline.h>
     2389# If found, it defines the C preprocessor variable COIN_HAS_READLINE.
     2390# Further, for a (space separated) list of arguments X, it adds the linker flag to the variable X_LIBS and X_PCLIBS.
    22932391
    22942392AC_DEFUN([AC_COIN_CHECK_GNU_READLINE],
     
    23162414  if test $coin_has_readline = yes; then
    23172415    AC_CHECK_LIB([readline],[readline],
    2318                  [ADDLIBS="-lreadline $LIBS $ADDLIBS"],
     2416                 [ADDLIBS="-lreadline $LIBS $ADDLIBS"
     2417                  coin_foreach_w([myvar], [$1], [
     2418                    m4_toupper(myvar)_LIBS="-lreadline $LIBS $m4_toupper(myvar)_LIBS"
     2419                    m4_toupper(myvar)_PCLIBS="-lreadline $LIBS $m4_toupper(myvar)_PCLIBS"
     2420                  ])
     2421                 ],
    23192422                 [coin_has_readline=no])
    23202423  fi
     
    24342537[AC_REQUIRE([AC_COIN_CHECK_GNU_ZLIB])
    24352538AC_REQUIRE([AC_COIN_CHECK_VPATH])
     2539AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
     2540AC_REQUIRE([AC_PROG_LN_S])
     2541
    24362542files=`cd $srcdir; ls $1`
    24372543# We need to do the following loop to make sure that are no newlines
     
    24492555      lnkcmd=cp ;;
    24502556  esac
    2451   if test "$lnkcmd" = cp; then
     2557  if test "x$lnkcmd" = xcp; then
    24522558    AC_MSG_NOTICE([Copying example files ($1)])
    24532559  else
    2454     AC_PROG_LN_S
    24552560    AC_MSG_NOTICE([Creating links to the example files ($1)])
    24562561    lnkcmd="$LN_S"
     
    24822587
    24832588###########################################################################
    2484 #                            COIN_HAS_PROJECT                             #
    2485 ###########################################################################
    2486 
    2487 # This macro sets up usage of a Coin package.  It defines the
    2488 # PKGSRCDIR and PKGOBJDIR variables, refering to the main source and
    2489 # object directory of the package, respectively.  It also defines
    2490 # a COIN_HAS_PKG preprocessor macro and makefile conditional.  The
    2491 # argument should be the name (Pkg) of the project (in correct lower
    2492 # and upper case)
     2589#                            COIN_HAS_PROJECT (deprecated)                #
     2590###########################################################################
     2591
     2592# This macro sets up usage of a Coin package.  It defines the PKGSRCDIR,
     2593# PKGOBJDIR, and PKGDOCDIR variables, referring to the main source, object, and
     2594# documentation directories of the package, respectively.  It also defines a
     2595# COIN_HAS_PKG preprocessor macro and makefile conditional.  The argument
     2596# should be the name (Pkg) of the project (in correct lower and upper case)
    24932597
    24942598AC_DEFUN([AC_COIN_HAS_PROJECT],
     
    25282632  m4_toupper($1OBJDIR)=`pwd`/$m4_tolower(coin_has_$1)
    25292633  AC_SUBST(m4_toupper($1DOCDIR))
    2530   m4_toupper($1DOCDIR)=$abs_lib_dir/../share/doc/coin/$1
     2634  m4_toupper($1DOCDIR)=$abs_lib_dir/../../share/doc/coin/$1
    25312635fi
    25322636
     
    25792683# extern "C" linkage. Otherwise, you'll have to somehow find the mangled C++
    25802684# name.
     2685# A fifth argument can be specified to include linker flags that may be required
     2686# to sucessfully perform the linking check.
     2687#
     2688# An optional sixth argument can be given to specify a list of targets.
     2689# For each target X, the variables X_LIBS and X_PCLIBS will be extended by $LBRYLIB,
     2690# if the library has been found and seems to work.
    25812691
    25822692AC_DEFUN([AC_COIN_HAS_USER_LIBRARY],
     
    26422752        [if test x"$m4_tolower($1)_libcheck" != xno; then
    26432753           coin_save_LIBS="$LIBS"
    2644            LIBS="$$2LIB $ADDLIBS"
     2754           LIBS="$$2LIB $ADDLIBS $5"
    26452755           coin_$2_link=no
    26462756           AC_LANG_PUSH(C)
     
    26542764           done
    26552765           AC_LANG_POP(C)
    2656            if test x"$coin_$2_link" = xyes ; then
    2657              LIBS="$coin_save_LIBS"
    2658            else
     2766           LIBS="$coin_save_LIBS"
     2767           if test x"$coin_$2_link" != xyes ; then
    26592768             AC_MSG_ERROR([Cannot find symbol(s) $4 with $2])
    26602769           fi
     
    26622771
    26632772# If we make it this far, we've verified the file and linked the function. Add
    2664 # the necessary link flags to ADDLIBS and define the preprocessor symbol
     2773# the necessary link flags to ADDLIBS and $6_{PC}LIBS and define the preprocessor symbol
    26652774# COIN_HAS_LBRY.
    26662775
    26672776    ADDLIBS="$$2LIB $ADDLIBS"
     2777    coin_foreach_w([myvar], [$6], [
     2778      m4_toupper(myvar)_LIBS="$$2LIB $m4_toupper(myvar)_LIBS"
     2779      m4_toupper(myvar)_PCLIBS="$$2LIB $m4_toupper(myvar)_PCLIBS"
     2780    ])
     2781   
    26682782    AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available])
    26692783  fi
     
    33493463
    33503464]) # AC_COIN_HAS_GLPK
     3465
     3466
     3467###########################################################################
     3468#                           COIN_DOXYGEN                                  #
     3469###########################################################################
     3470#
     3471# This macro determines the configuration information for doxygen, the tool
     3472# used to generate online documentation of COIN code. It takes one parameter,
     3473# a list of projects (mixed-case, to match the directory names) that should
     3474# be processed as external tag files. E.g., COIN_DOXYGEN([Clp Osi]).
     3475#
     3476# This macro will define the following variables:
     3477#  coin_have_doxygen    Yes if doxygen is found, no otherwise
     3478#  coin_doxy_usedot     Defaults to `yes'; --with-dot will still check to see
     3479#                       if dot is available
     3480#  coin_doxy_tagname    Name of doxygen tag file (placed in doxydoc directory)
     3481#  coin_doxy_logname    Name of doxygen log file (placed in doxydoc directory)
     3482#  coin_doxy_tagfiles   List of doxygen tag files used to reference other
     3483#                       doxygen documentation
     3484#  coin_doxy_excludes   Directories to exclude from doxygen processing
     3485
     3486AC_DEFUN([AC_COIN_DOXYGEN],
     3487[
     3488
     3489AC_MSG_NOTICE([configuring doxygen documentation options])
     3490
     3491# Check to see if doxygen is available.
     3492
     3493AC_CHECK_PROG([coin_have_doxygen],[doxygen],[yes],[no])
     3494
     3495# Look for the dot tool from the graphviz package, unless the user has
     3496# disabled it.
     3497
     3498AC_ARG_WITH([dot],
     3499  AS_HELP_STRING([--with-dot],
     3500                 [use dot (from graphviz) when creating documentation with
     3501                  doxygen if available; --without-dot to disable]),
     3502  [],[withval=yes])
     3503if test x"$withval" = xno ; then
     3504  coin_doxy_usedot=NO
     3505  AC_MSG_CHECKING([for dot ])
     3506  AC_MSG_RESULT([disabled])
     3507else
     3508  AC_CHECK_PROG([coin_doxy_usedot],[dot],[YES],[NO])
     3509fi
     3510
     3511# Generate a tag file name and a log file name
     3512
     3513AC_SUBST([coin_doxy_tagname],[doxydoc/${PACKAGE}_doxy.tag])
     3514AC_SUBST([coin_doxy_logname],[doxydoc/${PACKAGE}_doxy.log])
     3515
     3516# Process the list of project names and massage them into possible doxygen
     3517# doc'n directories. Prefer 1) classic external, source processed using
     3518# a project-specific doxygen.conf, we use the tag file; 2) classic
     3519# external, source processed using package doxygen.conf; 3) installed
     3520# doxydoc. Alternatives 1) and 2) are only possible if the directory will be
     3521# configured, which we can't know unless this is the package base configure,
     3522# since coin_subdirs is only set there. Hence it's sufficient to check for
     3523# membership. If we use a tag file from a classic external, exclude the
     3524# source from doxygen processing when doxygen runs in the base directory.
     3525
     3526coin_doxy_tagfiles=
     3527coin_doxy_excludes=
     3528tmp="$1"
     3529for proj in $tmp ; do
     3530  lc_proj=`echo $proj | [tr [A-Z] [a-z]]`
     3531  AC_MSG_CHECKING([for doxygen doc'n for $proj ])
     3532  doxytag=${lc_proj}_doxy.tag
     3533  doxyfound=no
     3534  for chkProj in $coin_subdirs ; do
     3535    if test "$chkProj" = "$proj" ; then
     3536      # proj will be configured, hence doxydoc present in build tree
     3537      doxysrcdir="${srcdir}/${proj}"
     3538      # AC_MSG_NOTICE([Considering $doxysrcdir (base)])
     3539      if test -d "$doxysrcdir" ; then
     3540        # with a doxydoc directory?
     3541        doxydir="$doxysrcdir/doxydoc"
     3542        # AC_MSG_NOTICE([Considering $doxydir (base)])
     3543        # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
     3544        if test -d "$doxydir" ; then
     3545          # use tag file; don't process source
     3546          eval doxydir="`pwd`/${proj}/doxydoc"
     3547          coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
     3548          AC_MSG_RESULT([$doxydir (tag)])
     3549          coin_doxy_excludes="$coin_doxy_excludes */${proj}*"
     3550        else
     3551          # will process the source -- nothing further to be done here
     3552          AC_MSG_RESULT([$doxysrcdir (src)])
     3553        fi
     3554        doxyfound=yes
     3555      fi
     3556    fi
     3557  done
     3558  # Not built, fall back to installed tag file
     3559  if test $doxyfound = no ; then
     3560    eval doxydir="${datadir}/coin/doc/${proj}/doxydoc"
     3561    # AC_MSG_NOTICE([Considering $doxydir (install)])
     3562    # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
     3563    coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
     3564    AC_MSG_RESULT([$doxydir (tag)])
     3565  fi
     3566done
     3567AC_SUBST([coin_doxy_tagfiles])
     3568AC_SUBST([coin_doxy_excludes])
     3569
     3570]) # AC_COIN_DOXYGEN
     3571
     3572
     3573###########################################################################
     3574#                           COIN_HAS_PKGCONFIG                            #
     3575###########################################################################
     3576
     3577# This macro checks whether a pkg-config tool with a minimal version number is available.
     3578# If so, then the variable PKGCONFIG is set to its path.
     3579# If not, PKGCONFIG is set to "".
     3580# The minimal version number can be given as first parameter, by default it is 0.9.0.
     3581# This macro is a modified version of PKG_PROG_PKG_CONFIG in pkg.m4
     3582#
     3583# Further, the AM_CONDITIONAL COIN_HAS_PKGCONFIG is set and PKGCONFIG is AC_SUBST'ed.
     3584# Finally, if this setup belongs to a project directory, then the search path for .pc files
     3585# is assembled from the value of $PKG_CONFIG_PATH, the values of --prefix, --coin-instdir,
     3586# and the directory named in a file ../coin_subdirs.txt or ../../coin_subdirs.txt in a variable
     3587# COIN_PKG_CONFIG_PATH, which is also AC_SUBST'ed.
     3588
     3589AC_DEFUN([AC_COIN_HAS_PKGCONFIG],
     3590[AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
     3591
     3592AC_ARG_ENABLE([pkg-config],
     3593  [AC_HELP_STRING([--enable-pkg-config],[use pkg-config if available (default is yes)])],
     3594  [use_pkgconfig="$enableval"],
     3595  [use_pkgconfig=yes])
     3596
     3597if test $use_pkgconfig = yes ; then
     3598  if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
     3599    AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
     3600  fi
     3601  if test -n "$PKG_CONFIG"; then
     3602    _pkg_min_version=m4_default([$1], [0.9.0])
     3603    AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
     3604    if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
     3605      AC_MSG_RESULT([yes])
     3606    else
     3607      AC_MSG_RESULT([no])
     3608      PKG_CONFIG=""
     3609    fi
     3610  fi
     3611
     3612  # check if pkg-config supports the short-errors flag
     3613  if test -n "$PKG_CONFIG" && \
     3614    $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
     3615    pkg_short_errors=" --short-errors "
     3616  else
     3617    pkg_short_errors=""
     3618  fi
     3619fi
     3620
     3621AM_CONDITIONAL([COIN_HAS_PKGCONFIG], [test -n "$PKG_CONFIG"])
     3622AC_SUBST(PKG_CONFIG)
     3623
     3624# assemble pkg-config search path for installed projects
     3625COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
     3626
     3627# let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there
     3628# best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig,
     3629# unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}...
     3630COIN_PKG_CONFIG_PATH="${prefix}/lib/pkgconfig:${COIN_PKG_CONFIG_PATH}"
     3631
     3632AC_ARG_WITH([coin-instdir],
     3633  AC_HELP_STRING([--with-coin-instdir],
     3634                 [prefix of installation directory for precompiled COIN packages]),
     3635  [if test -d "$withval"; then : ; else
     3636     AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
     3637   fi
     3638   COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:${COIN_PKG_CONFIG_PATH}"
     3639  ],[])
     3640
     3641AC_SUBST(COIN_PKG_CONFIG_PATH)
     3642
     3643# assemble additional pkg-config search paths for uninstalled projects
     3644if test x$coin_projectdir = xyes ; then
     3645  # if we are in a project setup, then in a classic setup, we want to find uninstalled projects
     3646  # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory
     3647  # unfortunately, if the user set prefix, then we do not know where the project base directory is located
     3648  # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data)
     3649  COIN_PKG_CONFIG_PATH_UNINSTALLED=
     3650  if test -e ../coin_subdirs.txt ; then
     3651    for i in `cat ../coin_subdirs.txt` ; do
     3652      if test -d ../$i ; then
     3653        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
     3654      fi
     3655    done
     3656  fi
     3657
     3658  if test -e ../../coin_subdirs.txt ; then
     3659    for i in `cat ../../coin_subdirs.txt` ; do
     3660      if test -d ../../$i ; then
     3661        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
     3662      fi
     3663    done
     3664  fi
     3665
     3666  AC_SUBST(COIN_PKG_CONFIG_PATH_UNINSTALLED)
     3667fi
     3668
     3669])
     3670
     3671###########################################################################
     3672#                           COIN_PKG_CHECK_PROJECT_EXISTS                 #
     3673###########################################################################
     3674
     3675# COIN_PKG_CHECK_PROJECT_EXISTS(PROJECT, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
     3676#
     3677# Check to see whether a particular project exists.  Similar
     3678# to PKG_CHECK_MODULES(), but set only the variables $1_VERSION and $1_PKG_ERRORS variables
     3679#
     3680AC_DEFUN([AC_COIN_PKG_CHECK_PROJECT_EXISTS],
     3681[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3682if test -n "$PKG_CONFIG" ; then
     3683  if $PKG_CONFIG --exists "m4_tolower($1)"; then
     3684    m4_toupper($1)[]_VERSION=`$PKG_CONFIG --modversion "m4_tolower($1)" 2>/dev/null`
     3685    m4_ifval([$2], [$2], [:])
     3686  else
     3687    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "m4_tolower($1)"`
     3688    $3
     3689  fi
     3690else
     3691  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
     3692fi
     3693])
     3694
     3695###########################################################################
     3696#                           COIN_PKG_CHECK_MODULE_EXISTS                  #
     3697###########################################################################
     3698
     3699# COIN_PKG_CHECK_MODULES_EXISTS(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
     3700#
     3701# Check to see whether a particular set of packages exists.
     3702# Similar to PKG_CHECK_MODULES(), but set only the variable $1_VERSIONS and $1_PKG_ERRORS
     3703#
     3704AC_DEFUN([AC_COIN_PKG_CHECK_MODULE_EXISTS],
     3705[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3706if test -n "$PKG_CONFIG" ; then
     3707  if $PKG_CONFIG --exists "$2"; then
     3708    m4_toupper($1)[]_VERSIONS="`$PKG_CONFIG --modversion $2 2>/dev/null`"
     3709    $3
     3710  else
     3711    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors $2`
     3712    $4
     3713  fi
     3714else
     3715  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
     3716fi
     3717])
     3718
     3719###########################################################################
     3720#                           COIN_PKG_HAS_MODULE                           #
     3721###########################################################################
     3722
     3723# COIN_PKG_HAS_MODULE(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
     3724#
     3725# Checks whether pkg-config files for a given set of packages is available.
     3726# If so, sets MODULE_CFLAGS, MODULE_LIBS, and MODULES_DATA and executes ACTION-IF-FOUND.
     3727# If not, then ACTION-IF-NOT-FOUND is executed.
     3728# A reason for not finding a package is stored in MODULE_PKG_ERRORS
     3729#
     3730# --------------------------------------------------------------
     3731AC_DEFUN([AC_COIN_PKG_HAS_MODULE],
     3732[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3733
     3734AC_COIN_PKG_CHECK_MODULE_EXISTS([$1],[$2],
     3735  [ cflags=`$PKG_CONFIG --cflags "$2" 2>/dev/null`
     3736    # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files
     3737        # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's
     3738        # but only do this if is not trivial
     3739    if test "$CYGPATH_W" != "echo" ; then
     3740      # need to put into brackets since otherwise autoconf replaces the brackets in the sed command
     3741          [cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
     3742        fi
     3743    m4_toupper($1)[]_CFLAGS="$cflags"
     3744    m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "$2" 2>/dev/null`
     3745    m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "$2" 2>/dev/null`
     3746    $3
     3747  ],
     3748  [ $4 ])
     3749
     3750])# PKG_CHECK_MODULES
     3751
     3752###########################################################################
     3753#                           COIN_MAIN_PACKAGEDIR                          #
     3754###########################################################################
     3755
     3756# This macro substitutes COIN_MAIN_SUBDIR.
     3757# If $2/$1 or $1 is in COIN_SKIP_PROJECTS, do nothing.
     3758# If --with-$1-lib, --with-$1-incdir, or --with-$1-datadir is given, then assume that the package is installed.
     3759# Otherwise, if pkg-config is available, use it to check whether the package is available.
     3760#   If $4 is given, then pkg-config is asked for the existance of $4, otherwise tolower($1) is used.
     3761# Otherwise, if the directory $2/$1 and the file $2/$1/$3 exist, check whether $2/$1/configure exists.
     3762#   If so, include this directory into the list of directories where configure and make recourse into.
     3763# tolower(coin_has_$1) is set to notGiven, skipping, installed, the version of an installed project, or the projects main directory (if uninstalled).
     3764
     3765AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],
     3766[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3767AC_MSG_CHECKING([whether project $1 is available])
     3768
     3769m4_tolower(coin_has_$1)=notGiven
     3770coin_have_project_dir=no
     3771
     3772# check if user wants to skip project in any case
     3773AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
     3774if test x"$COIN_SKIP_PROJECTS" != x; then
     3775  for dir in $COIN_SKIP_PROJECTS; do
     3776    if test $dir = "$1"; then
     3777      m4_tolower(coin_has_$1)=skipping
     3778    fi
     3779    if test $dir = "$2/$1"; then
     3780      m4_tolower(coin_has_$1)=skipping
     3781    fi
     3782  done
     3783fi
     3784
     3785if test $m4_tolower(coin_has_$1) != skipping; then
     3786  if test $PACKAGE_TARNAME = m4_tolower($1); then
     3787    m4_tolower(coin_has_$1)=.
     3788    coin_have_project_dir=yes
     3789  fi
     3790
     3791  AC_ARG_WITH([m4_tolower($1)-lib],
     3792    AC_HELP_STRING([--with-m4_tolower($1)-lib],
     3793                   [linker flags for using project $1]),
     3794      [m4_tolower(coin_has_$1)=installed],
     3795      [])
     3796
     3797  AC_ARG_WITH([m4_tolower($1)-incdir],
     3798    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
     3799                   [directory with header files for using project $1]),
     3800    [m4_tolower(coin_has_$1)=installed],
     3801    [])
     3802
     3803  AC_ARG_WITH([m4_tolower($1)-datadir],
     3804    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
     3805                   [directory with data files for using project $1]),
     3806    [m4_tolower(coin_has_$1)=installed],
     3807    [])
     3808
     3809  m4_if(m4_tolower($1), blas, [
     3810    #--with-blas can overwrite --with-blas-lib, and can be set to BUILD to enforce building blas
     3811    AC_ARG_WITH([blas],
     3812      AC_HELP_STRING([--with-blas], [specify BLAS library (or BUILD for compilation)]),
     3813        [if test x"$withval" = "xBUILD" ; then
     3814           coin_has_blas=notGiven
     3815         else
     3816           coin_has_blas=installed
     3817         fi],
     3818        [])])
     3819
     3820  m4_if(m4_tolower($1), lapack, [
     3821    #--with-lapack can overwrite --with-lapack-lib, and can be set to BUILD to enforce building lapack
     3822    AC_ARG_WITH([lapack],
     3823      AC_HELP_STRING([--with-lapack], [specify LAPACK library (or BUILD for compilation)]),
     3824        [if test x"$withval" = "xBUILD" ; then
     3825           coin_has_lapack=notGiven
     3826         else
     3827           coin_has_lapack=installed
     3828         fi],
     3829        [])])
     3830
     3831fi
     3832
     3833if test $m4_tolower(coin_has_$1) = notGiven; then
     3834  #check for project by using pkg-config, if pkg-config is available
     3835  #we are only interested in installed packages here, so we do not search in $COIN_PKG_CONFIG_PATH_UNINSTALLED
     3836  if test -n "$PKG_CONFIG" ; then
     3837    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
     3838    PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" ; export PKG_CONFIG_PATH
     3839      m4_ifval([$4],
     3840        [AC_COIN_PKG_CHECK_PROJECT_EXISTS([$4],
     3841                [m4_tolower(coin_has_$1)="$m4_toupper([$4])_VERSION"])],
     3842              [AC_COIN_PKG_CHECK_PROJECT_EXISTS([$1],
     3843                [m4_tolower(coin_has_$1)="$m4_toupper([$1])_VERSION"])])
     3844    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
     3845    export PKG_CONFIG_PATH
     3846  fi
     3847fi
     3848
     3849# if not found yet, check if project is available in present directory
     3850if test "$m4_tolower(coin_has_$1)" = notGiven; then
     3851  if test -d $srcdir/$2/$1; then
     3852    # If a third argument is given, then we have to check if one one the files given in that third argument is present.
     3853    # If none of the files in the third argument is available, then we consider the project directory as non-existing.
     3854    # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient.
     3855    m4_ifvaln([$3],
     3856      [for i in $srcdir/m4_ifval($2,[$2/],)$1/$3; do
     3857         if test -r $i; then
     3858           coin_have_project_dir=yes
     3859         fi
     3860       done],
     3861      [ coin_have_project_dir=yes ])
     3862    if test $coin_have_project_dir = yes; then
     3863      m4_tolower(coin_has_$1)=m4_ifval($2,[$2/],)$1
     3864    fi
     3865  fi
     3866fi
     3867
     3868AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
     3869
     3870AC_MSG_CHECKING(whether project $1 need to be configured)
     3871if test "$coin_have_project_dir" = yes ; then
     3872
     3873  if test -r $srcdir/m4_ifval($2,[$2/],)$1/configure; then
     3874    coin_subdirs="$coin_subdirs m4_ifval($2,[$2/],)$1"
     3875    AC_MSG_RESULT(yes)
     3876    AC_CONFIG_SUBDIRS(m4_ifval($2,[$2/],)$1)
     3877  else
     3878    AC_MSG_RESULT(no)
     3879  fi
     3880else
     3881  AC_MSG_RESULT(no)
     3882fi
     3883])
     3884
     3885###########################################################################
     3886#                            COIN_HAS_MODULE                              #
     3887###########################################################################
     3888
     3889# This macro sets up a COIN-OR module.
     3890# A module consists of one or more COIN-OR packages.
     3891# It defines the MODULE_CFLAGS, MODULE_LIBS, and MODULE_DATA variables, referring to the compiler and linker
     3892# flags to use when linking against this module and the directories where the module data resists.
     3893# It also defines a COIN_HAS_MODULE preprocessor macro and makefile conditional.
     3894# Further, tolower(coin_has_$1) is set to "yes".
     3895# If the flag 'required' is set (which is on by default), then the packages of the module are added to
     3896# the REQUIREDPACKAGES variable, which can be used to setup a .pc file.
     3897# The first argument should be the name (MODULE) of the module (in correct lower
     3898# and upper case).
     3899# The second argument should be a (space separated) list of projects which this
     3900# module consists of. Optionally, required version numbers can be added.
     3901# The optional third argument can be used to overwrite default values for flags like 'required'.
     3902#
     3903# It is also possible to specify a preinstalled version of this module
     3904# or to specify only the linker and compiler flags and data directory.
     3905# If the flag 'required' (which is on by default) is set, then user-given linker flags are added to
     3906# the PCADDLIBS variable, which can be used to setup a .pc file.
     3907#
     3908# If the user did not specify --with-$1-... flags and pkg-config is not available,
     3909# COIN_HAS_MODULE_FALLBACK($1, $2, $3) is called.
     3910
     3911AC_DEFUN([AC_COIN_HAS_MODULE],
     3912[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3913AC_MSG_CHECKING([for COIN-OR module $1])
     3914
     3915m4_tolower(coin_has_$1)=notGiven
     3916
     3917# check if user wants to skip module in any case
     3918if test x"$COIN_SKIP_PROJECTS" != x; then
     3919  for dir in $COIN_SKIP_PROJECTS; do
     3920    if test $dir = "$1"; then
     3921      m4_tolower(coin_has_$1)=skipping
     3922    fi
     3923  done
     3924fi
     3925
     3926m4_toupper($1_LIBS)=
     3927m4_toupper($1_CFLAGS)=
     3928m4_toupper($1_DATA)=
     3929AC_SUBST(m4_toupper($1_LIBS))
     3930AC_SUBST(m4_toupper($1_CFLAGS))
     3931AC_SUBST(m4_toupper($1_DATA))
     3932AC_SUBST(REQUIREDPACKAGES)
     3933
     3934#check if user provided LIBS, CFLAGS, or DATA for module
     3935if test $m4_tolower(coin_has_$1) != skipping; then
     3936
     3937  AC_ARG_WITH([m4_tolower($1)-lib],
     3938    AC_HELP_STRING([--with-m4_tolower($1)-lib],
     3939                   [linker flags for using module $1]),
     3940      [m4_tolower(coin_has_$1)=yes
     3941       m4_toupper($1_LIBS)="$withval"
     3942       m4_bmatch($3, [required=0], [], [PCADDLIBS="$withval $PCADDLIBS"])
     3943      ],
     3944      [])
     3945
     3946  AC_ARG_WITH([m4_tolower($1)-incdir],
     3947    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
     3948                   [directory with header files for using module $1]),
     3949    [m4_tolower(coin_has_$1)=yes
     3950     m4_toupper($1_CFLAGS)="-I`${CYGPATH_W} $withval`"],
     3951    [])
     3952
     3953  AC_ARG_WITH([m4_tolower($1)-datadir],
     3954    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
     3955                   [directory with data files for using module $1]),
     3956    [m4_tolower(coin_has_$1)=yes
     3957     m4_toupper($1_DATA)="$withval"],
     3958    [])
     3959fi
     3960
     3961if test $m4_tolower(coin_has_$1) = notGiven; then
     3962  if test -n "$PKG_CONFIG" ; then
     3963    # set search path for pkg-config
     3964    # need to export variable to be sure that the following pkg-config gets these values
     3965    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
     3966    PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED"
     3967    export PKG_CONFIG_PATH
     3968   
     3969    # let pkg-config do it's magic
     3970    AC_COIN_PKG_HAS_MODULE([$1],[$2],
     3971      [ m4_tolower(coin_has_$1)=yes
     3972        AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS])
     3973        m4_bmatch($3, [required=0], [], [REQUIREDPACKAGES="$2 $REQUIREDPACKAGES"])
     3974      ],
     3975      [ m4_tolower(coin_has_$1)=notGiven
     3976        AC_MSG_RESULT([not given: $m4_toupper($1)_PKG_ERRORS])
     3977      ])
     3978
     3979    # reset PKG_CONFIG_PATH variable
     3980    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
     3981    export PKG_CONFIG_PATH
     3982  else
     3983    AC_MSG_RESULT([skipped check via pkg-config, redirect to fallback])
     3984    AC_COIN_HAS_MODULE_FALLBACK([$1], [$2], [$3])
     3985  fi
     3986
     3987else
     3988  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
     3989fi
     3990
     3991if test $m4_tolower(coin_has_$1) != skipping &&
     3992   test $m4_tolower(coin_has_$1) != notGiven ; then
     3993  if test 0 = 1 ; then  #change this test to enable a bit of debugging output
     3994  if test -n "$m4_toupper($1)_CFLAGS" ; then
     3995    AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
     3996  fi
     3997  if test -n "$m4_toupper($1)_LIBS" ; then
     3998    AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
     3999  fi
     4000  if test -n "$m4_toupper($1)_DATA" ; then
     4001    AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
     4002  fi
     4003  fi
     4004  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 module is available])
     4005fi
     4006
     4007# Define the Makefile conditional
     4008AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
     4009               [test $m4_tolower(coin_has_$1) != notGiven &&
     4010                test $m4_tolower(coin_has_$1) != skipping])
     4011
     4012]) # AC_COIN_HAS_MODULE
     4013
     4014###########################################################################
     4015#                       COIN_HAS_MODULE_FALLBACK                          #
     4016###########################################################################
     4017
     4018# This macro is used if COIN_HAS_MODULE fails to find a module because pkg-config was disabled or is not available.
     4019#
     4020# For each project xxx specified in $2, it searches for a xxx-uninstalled.pc file in the directories specified in
     4021# $COIN_PKG_CONFIG_PATH_UNINSTALLED. The latter variable is setup by COIN_HAS_PKGCONFIG and
     4022# consists of the content of the coin_subdirs.txt file which has been created by configure in the base directory.
     4023# The content of xxx-uninstalled.pc is parsed in order to defines the variables MODULE_CFLAGS, MODULE_LIBS, and MODULE_DATA,
     4024# referring to the compiler and linker flags to use when linking against this module
     4025# and the directory where the module data resists.
     4026# Further, the Required field of each .pc file is parsed and -uninstalled.pc files for these projects are searched for.
     4027# The MODULE_CFLAGS and MODULE_LIBS variables are augmented with the information from these .pc files.
     4028# Thus, the macros checks also dependencies of $2.
     4029# Note that the MODULE_DATA variable is set to the content of datadir of the first .pc file that is parsed.
     4030#
     4031# If .pc files for all projects in $2 and their dependencies is found, tolower(coin_has_$1) is set to "yes".
     4032# Otherwise, if some dependency is not found, tolower(coin_has_$1) is set to no.
     4033# Further, a COIN_HAS_MODULE preprocessor macro and a makefile conditional are defined.
     4034# If the flag 'required' is set (which is on by default), then the module package is added to
     4035# the REQUIREDPACKAGES variable, which can be used to setup a .pc file.
     4036#
     4037# The first argument should be the name (MODULE) of the module (in correct lower and upper case).
     4038# The second argument should be the base names of the projects .pc file which define this module.
     4039# The optional third argument can be used to overwrite default values for flags like 'required'.
     4040
     4041# $1 is not checked for $COIN_SKIP_PROJECTS, since we only look into $COIN_PKG_CONFIG_PATH_UNINSTALLED.
     4042# When the content of this variable was setup in the base directory, $COIN_SKIP_PROJECTS has already been considered.
     4043
     4044AC_DEFUN([AC_COIN_HAS_MODULE_FALLBACK],
     4045[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     4046AC_MSG_CHECKING([for COIN-OR module $1 (fallback)])
     4047
     4048m4_tolower(coin_has_$1)=notGiven
     4049m4_toupper($1_LIBS)=
     4050m4_toupper($1_CFLAGS)=
     4051m4_toupper($1_DATA)=
     4052AC_SUBST(REQUIREDPACKAGES)
     4053
     4054# initial list of dependencies is "$2", but we need to filter out version number specifications (= x, <= x, >= x)
     4055projtoprocess="m4_bpatsubsts([$2], [<?>?=[      ]*[^    ]+])"
     4056projprocessed=""
     4057
     4058while test $m4_tolower(coin_has_$1) = notGiven ; do
     4059  # setup list of projects that need to be processed in the next round
     4060  nextprojtoprocess=""
     4061
     4062  for proj in $projtoprocess ; do
     4063    # if $proj has been processed already, skip this round
     4064    if test "x$projprocessed" != x ; then
     4065      for projdone in $projprocessed ; do
     4066        if test $projdone = $proj ; then
     4067          continue 2
     4068        fi
     4069      done
     4070    fi
     4071
     4072    # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it
     4073    pcfile=""
     4074    save_IFS="$IFS"
     4075    IFS=":"
     4076    for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do
     4077      # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again
     4078      if test -r "$dir/$proj-uninstalled.pc" ; then
     4079        pcfile="$dir/$proj-uninstalled.pc"
     4080        pcfiledir="$dir"
     4081        break
     4082      fi
     4083    done
     4084    IFS="$save_IFS"
     4085
     4086    if test "x$pcfile" != x ; then
     4087      # read CFLAGS from $pcfile and add CYGPATH_W cludge into include flags
     4088      projcflags=`sed -n -e 's/Cflags://p' "$pcfile"`
     4089      projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
     4090      m4_toupper($1_CFLAGS)="$projcflags $m4_toupper($1_CFLAGS)"
     4091     
     4092      # read LIBS from $pcfile and replace -L${libdir} by absolute path to build directory in linker flags
     4093      # we assume that the build directory is $pcfiledir/src if this directory exists, otherwise we assume that it is $pcfiledir
     4094      projlibs=`sed -n -e 's/Libs://' -e 's/-L\${libdir}//p' "$pcfile"`
     4095      if test "x$projlibs" != x ; then
     4096        if test -d "${pcfiledir}/src" ; then
     4097          projlibs="-L`cd "${pcfiledir}/src"; pwd` $projlibs"
     4098        else
     4099          projlibs="-L`cd "$pcfiledir"; pwd` $projlibs"
     4100        fi
     4101      else
     4102        projlibs=`sed -n -e 's/Libs://p' "$pcfile"`
     4103      fi
     4104      m4_toupper($1_LIBS)="$m4_toupper($1_LIBS) $projlibs"
     4105     
     4106      # read DATA from $pcfile, if this is the first .pc file we are processing (so assume that its the main one)
     4107      if test "x$projprocessed" = x ; then
     4108        m4_toupper($1_DATA)=`sed -n -e 's/datadir=//gp' "$pcfile"`
     4109      fi
     4110     
     4111      # read dependencies from $pcfile, filter it, and add to list of projects that need to be processed next
     4112      projrequires=[`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\?>\?=[         ]*[^    ]\+//g'`]
     4113      nextprojtoprocess="$nextprojtoprocess $projrequires"
     4114     
     4115      # remember that we have processed $proj
     4116      projprocessed="$projprocessed $proj"
     4117     
     4118    else
     4119      AC_MSG_RESULT([no, dependency $proj not available])
     4120      break 2
     4121    fi
     4122
     4123  done
     4124 
     4125  projtoprocess="$nextprojtoprocess"
     4126 
     4127  if test "x$projtoprocess" = x ; then
     4128    m4_tolower(coin_has_$1)=yes
     4129    AC_MSG_RESULT([yes, dependencies are$projprocessed])
     4130   
     4131    m4_bmatch($3, [required=0], [], [REQUIREDPACKAGES="$2 $REQUIREDPACKAGES"])
     4132    AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 module is available])
     4133   
     4134    if test 1 = 0 ; then  #change this test to enable a bit of debugging output
     4135    if test -n "$m4_toupper($1)_CFLAGS" ; then
     4136      AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
     4137    fi
     4138    if test -n "$m4_toupper($1)_LIBS" ; then
     4139      AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
     4140    fi
     4141    if test -n "$m4_toupper($1)_DATA" ; then
     4142      AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
     4143    fi
     4144    fi
     4145  fi
     4146done
     4147
     4148AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
     4149               [test $m4_tolower(coin_has_$1) != notGiven &&
     4150                test $m4_tolower(coin_has_$1) != skipping])
     4151
     4152]) # AC_COIN_HAS_MODULE_FALLBACK
     4153
     4154###########################################################################
     4155#                         COIN_HAS_MODULE_BLAS                            #
     4156###########################################################################
     4157
     4158# This macro checks for a library containing the BLAS library.  It
     4159# 1. checks the --with-blas argument
     4160# 2. if --with-blas=BUILD has been specified goes to point 5
     4161# 3. if --with-blas has been specified to a working library, sets BLAS_LIBS to its value
     4162# 4. tries standard libraries
     4163# 5. calls COIN_HAS_MODULE(Blas, [coinblas]) to check for ThirdParty/Blas
     4164# 6. calls COIN_HAS_MODULE_FALLBACK(Blas, [coinblas], [../ThirdParty/Blas or ../Blas])
     4165# The makefile conditional and preprocessor macro COIN_HAS_BLAS is defined.
     4166# BLAS_LIBS is set to the flags required to link with a Blas library.
     4167# In case 3 and 4, the flags to link to Blas are added to PCADDLIBS too.
     4168# In case 5, Blas is added to REQUIREDPACKAGES
     4169
     4170AC_DEFUN([AC_COIN_HAS_MODULE_BLAS],
     4171[
     4172AC_ARG_WITH([blas],
     4173            AC_HELP_STRING([--with-blas],
     4174                           [specify BLAS library (or BUILD for compilation)]),
     4175            [use_blas="$withval"], [use_blas=])
     4176
     4177#if user specified --with-blas-lib, then we should give COIN_HAS_MODULE preference
     4178AC_ARG_WITH([blas-lib],,[use_blas=BUILD])
     4179
     4180# Check if user supplied option makes sense
     4181if test x"$use_blas" != x; then
     4182  if test "$use_blas" = "BUILD"; then
     4183    # we come to this later
     4184    :
     4185  elif test "$use_blas" != "no"; then
     4186    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
     4187    coin_save_LIBS="$LIBS"
     4188    LIBS="$use_blas $LIBS"
     4189    AC_COIN_TRY_FLINK([daxpy],
     4190                      [AC_MSG_RESULT([yes])],
     4191                      [AC_MSG_RESULT([no])
     4192                       AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
     4193    LIBS="$coin_save_LIBS"
     4194  fi
     4195else
     4196# Try to autodetect the library for blas based on build system
     4197  #AC_MSG_CHECKING([default locations for BLAS])
     4198  skip_lblas_check=no
     4199  case $build in
     4200    *-sgi-*)
     4201      AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
     4202      SAVE_LIBS="$LIBS"
     4203      LIBS="-lcomplib.sgimath $LIBS"
     4204      AC_COIN_TRY_FLINK([daxpy],
     4205                        [AC_MSG_RESULT([yes])
     4206                         use_blas="-lcomplib.sgimath"],
     4207                        [AC_MSG_RESULT([no])
     4208                         SAVE_LIBS="$LIBS"])
     4209      ;;
     4210
     4211# Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio
     4212# cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't
     4213# recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims
     4214# that CC and cc will understand -library in Studio 13. The main extra
     4215# function of -xlic_lib and -library is to arrange for the Fortran run-time
     4216# libraries to be linked for C++ and C. We can arrange that explicitly.
     4217    *-*-solaris*)
     4218      SAVE_LIBS="$LIBS"
     4219      AC_MSG_CHECKING([for BLAS in libsunperf])
     4220      LIBS="-lsunperf $FLIBS $LIBS"
     4221      AC_COIN_TRY_FLINK([daxpy],
     4222                        [AC_MSG_RESULT([yes])
     4223                         use_blas='-lsunperf'
     4224                         coin_need_flibs=yes],
     4225                        [AC_MSG_RESULT([no])
     4226                         LIBS="$SAVE_LIBS"])
     4227      ;;
     4228    *-cygwin* | *-mingw*)
     4229# On cygwin, consider -lblas only if doscompile is disabled. The prebuilt
     4230# library will want to link with cygwin, hence won't run standalone in DOS.
     4231      if test "$enable_doscompile" = mingw; then
     4232        skip_lblas_check=yes
     4233      fi
     4234      case "$CC" in
     4235        cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
     4236          SAVE_LIBS="$LIBS"
     4237          AC_MSG_CHECKING([for BLAS in MKL])
     4238          LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS"
     4239          AC_COIN_TRY_FLINK([daxpy],
     4240                            [AC_MSG_RESULT([yes])
     4241                             use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib'],
     4242                            [AC_MSG_RESULT([no])
     4243                             LIBS="$SAVE_LIBS"])
     4244          ;;
     4245      esac
     4246      ;;
     4247  esac
     4248
     4249  if test -z "$use_blas" && test $skip_lblas_check = no; then
     4250    SAVE_LIBS="$LIBS"
     4251    AC_MSG_CHECKING([whether -lblas has BLAS])
     4252    LIBS="-lblas $LIBS"
     4253    AC_COIN_TRY_FLINK([daxpy],
     4254                      [AC_MSG_RESULT([yes])
     4255                       use_blas='-lblas'],
     4256                      [AC_MSG_RESULT([no])
     4257                       LIBS="$SAVE_LIBS"])
     4258  fi
     4259  LIBS="$SAVE_LIBS"
     4260 
     4261  # If we have no other ideas, consider building BLAS.
     4262  if test -z "$use_blas" ; then
     4263    use_blas=BUILD
     4264  fi
     4265fi
     4266
     4267if test "x$use_blas" = xBUILD ; then
     4268  AC_COIN_HAS_MODULE(Blas, [coinblas])
     4269 
     4270elif test "x$use_blas" != x && test "$use_blas" != no; then
     4271  coin_has_blas=yes
     4272  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 0])
     4273  AC_DEFINE([COIN_HAS_BLAS],[1], [If defined, the BLAS Library is available.])
     4274  BLAS_LIBS="$use_blas"
     4275  BLAS_CFLAGS=
     4276  BLAS_DATA=
     4277  AC_SUBST(BLAS_LIBS)
     4278  AC_SUBST(BLAS_CFLAGS)
     4279  AC_SUBST(BLAS_DATA)
     4280  PCADDLIBS="$use_blas $PCADDLIBS"
     4281 
     4282else
     4283  coin_has_blas=no
     4284  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 1])
     4285fi
     4286
     4287]) # AC_COIN_HAS_MODULE_BLAS
     4288
     4289###########################################################################
     4290#                       COIN_HAS_MODULE_LAPACK                            #
     4291###########################################################################
     4292
     4293# This macro checks for a library containing the LAPACK library.  It
     4294# 1. checks the --with-lapack argument
     4295# 2. if --with-lapack=BUILD has been specified goes to point 5
     4296# 3. if --with-lapack has been specified to a working library, sets LAPACK_LIBS to its value
     4297# 4. tries standard libraries
     4298# 5. calls COIN_HAS_MODULE(Lapack, [lapack]) to check for ThirdParty/Lapack
     4299# 6. calls COIN_HAS_MODULE_FALLBACK(Lapack, [coinlapack], [../ThirdParty/Lapack or ../Lapack])
     4300# The makefile conditional and preprocessor macro COIN_HAS_LAPACK is defined.
     4301# LAPACK_LIBS is set to the flags required to link with a Lapack library.
     4302# In case 3 and 4, the flags to link to Lapack are added to PCADDLIBS too.
     4303# In case 5, Lapack is added to REQUIREDPACKAGES
     4304
     4305AC_DEFUN([AC_COIN_HAS_MODULE_LAPACK],
     4306[
     4307AC_ARG_WITH([lapack],
     4308            AC_HELP_STRING([--with-lapack],
     4309                           [specify LAPACK library (or BUILD for compilation)]),
     4310            [use_lapack=$withval], [use_lapack=])
     4311           
     4312#if user specified --with-lapack-lib, then we should give COIN_HAS_MODULE preference
     4313AC_ARG_WITH([lapack-lib],,[use_lapack=BUILD])
     4314
     4315# Check if user supplied option makes sense
     4316if test x"$use_lapack" != x; then
     4317  if test "$use_lapack" = "BUILD"; then
     4318    # we come to this later
     4319    :
     4320  elif test "$use_lapack" != no; then
     4321    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
     4322    coin_save_LIBS="$LIBS"
     4323    LIBS="$use_lapack $LIBS"
     4324    AC_COIN_TRY_FLINK([dsyev],
     4325                      [AC_MSG_RESULT([yes])],
     4326                      [AC_MSG_RESULT([no])
     4327                       AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
     4328    LIBS="$coin_save_LIBS"
     4329  fi
     4330else
     4331  if test x$coin_has_blas = xyes; then
     4332    # First try to see if LAPACK is already available with BLAS library
     4333    AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
     4334    coin_save_LIBS="$LIBS"
     4335    LIBS="$BLAS_LIBS $LIBS"
     4336    AC_COIN_TRY_FLINK([dsyev],
     4337                      [AC_MSG_RESULT([yes]); use_lapack="$BLAS_LIBS"],
     4338                      [AC_MSG_RESULT([no])])
     4339    LIBS="$coin_save_LIBS"
     4340  fi
     4341  skip_llapack_check=no
     4342  if test -z "$use_lapack"; then
     4343    # Try to autodetect the library for lapack based on build system
     4344    case $build in
     4345      *-sgi-*)
     4346        SAVE_LIBS="$LIBS"
     4347        AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
     4348        LIBS="-lcomplib.sgimath $LIBS"
     4349        AC_COIN_TRY_FLINK([dsyev],
     4350                          [AC_MSG_RESULT([yes])
     4351                           use_lapack="-lcomplib.sgimath;"],
     4352                          [AC_MSG_RESULT([no])
     4353                           SAVE_LIBS="$LIBS"])
     4354        ;;
     4355
     4356# See comments in COIN_HAS_BLAS.
     4357      *-*-solaris*)
     4358      SAVE_LIBS="$LIBS"
     4359      AC_MSG_CHECKING([for LAPACK in libsunperf])
     4360      LIBS="-lsunperf $FLIBS $LIBS"
     4361      AC_COIN_TRY_FLINK([dsyev],
     4362                        [AC_MSG_RESULT([yes])
     4363                         use_lapack='-lsunperf'
     4364                         coin_need_flibs=yes],
     4365                        [AC_MSG_RESULT([no])
     4366                         LIBS="$SAVE_LIBS"])
     4367        ;;
     4368# On cygwin, do this check only if doscompile is disabled. The prebuilt library
     4369# will want to link with cygwin, hence won't run standalone in DOS.
     4370      *-cygwin*)
     4371        if test "$enable_doscompile" = mingw; then
     4372          skip_llapack_check=yes
     4373        fi
     4374        ;;
     4375    esac
     4376  fi
     4377
     4378  if test -z "$use_lapack" && test $skip_llapack_check = no; then
     4379    SAVE_LIBS="$LIBS"
     4380    AC_MSG_CHECKING([whether -llapack has LAPACK])
     4381    LIBS="-llapack $LIBS"
     4382    AC_COIN_TRY_FLINK([dsyev],
     4383                      [AC_MSG_RESULT([yes])
     4384                       use_lapack='-llapack'],
     4385                      [AC_MSG_RESULT([no])
     4386                       LIBS="$SAVE_LIBS"])
     4387  fi
     4388 
     4389  LIBS="$SAVE_LIBS"
     4390
     4391  # If we have no other ideas, consider building LAPACK.
     4392  if test -z "$use_lapack" ; then
     4393    use_lapack=BUILD
     4394  fi
     4395fi
     4396
     4397if test "x$use_lapack" = xBUILD ; then
     4398  AC_COIN_HAS_MODULE(Lapack, [coinlapack])
     4399 
     4400elif test "x$use_lapack" != x && test "$use_lapack" != no; then
     4401  coin_has_lapack=yes
     4402  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 0])
     4403  AC_DEFINE([COIN_HAS_LAPACK],[1], [If defined, the LAPACK Library is available.])
     4404  LAPACK_LIBS="$use_lapack"
     4405  LAPACK_CFLAGS=
     4406  LAPACK_DATA=
     4407  AC_SUBST(LAPACK_LIBS)
     4408  AC_SUBST(LAPACK_CFLAGS)
     4409  AC_SUBST(LAPACK_DATA)
     4410  if test "x$LAPACK_LIBS" != "x$BLAS_LIBS"; then
     4411    PCADDLIBS="$LAPACK_LIBS $PCADDLIBS"
     4412  fi
     4413 
     4414else
     4415  coin_has_lapack=no
     4416  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 1])
     4417fi
     4418
     4419]) # AC_COIN_HAS_MODULE_LAPACK
     4420
     4421###########################################################################
     4422#                            COIN_HAS_PACKAGE                             #
     4423###########################################################################
     4424
     4425# This macro checks for the existance of a COIN-OR package and provides compiler and linker flags to compile against this package.
     4426# A package can consists of one or more COIN-OR or other projects.
     4427# It defines the PACKAGE_CFLAGS, PACKAGE_LIBS, and PACKAGE_DATA variables, referring to the compiler and linker
     4428# flags to use when linking against this module and the directories where the module data resists.
     4429# It also defines a COIN_HAS_PACKAGE preprocessor macro and makefile conditional.
     4430# Further, tolower(coin_has_$1) is set to "yes".
     4431# If a list of build targets using this projects is given in the third argument,
     4432# then the compiler and linker variables and .pc file setup variable corresponding to this build target
     4433# are extended with the values for this package.
     4434# That is, for each build target X, the variables X_CFLAGS, X_LIBS, X_PCLIBS, X_PCREQUIRES are setup,
     4435# whereas the last two specify the values to put into the "Libs:" and "Requires:" fields of the .pc file, resp.
     4436#
     4437# The first argument should be the name (PACKAGE) of the package (in correct lower
     4438# and upper case).
     4439# The second argument should be a (space separated) list of projects which this
     4440# package consists of. Optionally, required version numbers can be added.
     4441# The optional third argument should be a (space separated) list of build targets
     4442# which use this package, if available.
     4443#
     4444# It is also possible to specify a preinstalled version of this package
     4445# or to specify only the linker and compiler flags and data directory.
     4446#
     4447# If the user did not specify --with-$1-... flags and pkg-config is not available,
     4448# COIN_HAS_PACKAGE_FALLBACK($1, $2, $3) is called.
     4449
     4450AC_DEFUN([AC_COIN_HAS_PACKAGE],
     4451[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     4452AC_MSG_CHECKING([for COIN-OR package $1])
     4453
     4454m4_tolower(coin_has_$1)=notGiven
     4455
     4456# check if user wants to skip package in any case
     4457if test x"$COIN_SKIP_PROJECTS" != x; then
     4458  for dir in $COIN_SKIP_PROJECTS; do
     4459    if test $dir = "$1"; then
     4460      m4_tolower(coin_has_$1)=skipping
     4461    fi
     4462  done
     4463fi
     4464
     4465m4_toupper($1_LIBS)=
     4466m4_toupper($1_CFLAGS)=
     4467m4_toupper($1_DATA)=
     4468AC_SUBST(m4_toupper($1_LIBS))
     4469AC_SUBST(m4_toupper($1_CFLAGS))
     4470AC_SUBST(m4_toupper($1_DATA))
     4471coin_foreach_w([myvar], [$3], [
     4472  AC_SUBST(m4_toupper(myvar)_CFLAGS)
     4473  AC_SUBST(m4_toupper(myvar)_LIBS)
     4474  AC_SUBST(m4_toupper(myvar)_PCLIBS)
     4475  AC_SUBST(m4_toupper(myvar)_PCREQUIRES)
     4476])
     4477
     4478#check if user provided LIBS, CFLAGS, or DATA for module
     4479if test $m4_tolower(coin_has_$1) != skipping; then
     4480
     4481  AC_ARG_WITH([m4_tolower($1)-lib],
     4482    AC_HELP_STRING([--with-m4_tolower($1)-lib],
     4483                   [linker flags for using package $1]),
     4484      [m4_tolower(coin_has_$1)=yes
     4485       m4_toupper($1_LIBS)="$withval"
     4486       coin_foreach_w([myvar], [$3], [
     4487         m4_toupper(myvar)_PCLIBS="$withval $m4_toupper(myvar)_PCLIBS"
     4488         m4_toupper(myvar)_LIBS="$withval $m4_toupper(myvar)_LIBS"
     4489       ])
     4490      ],
     4491      [])
     4492
     4493  AC_ARG_WITH([m4_tolower($1)-incdir],
     4494    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
     4495                   [directory with header files for using package $1]),
     4496    [m4_tolower(coin_has_$1)=yes
     4497     m4_toupper($1_CFLAGS)="-I`${CYGPATH_W} $withval`"
     4498     coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS="$withval $m4_toupper(myvar)_CFLAGS"
     4499     ])
     4500    ],
     4501    [])
     4502
     4503  AC_ARG_WITH([m4_tolower($1)-datadir],
     4504    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
     4505                   [directory with data files for using package $1]),
     4506    [m4_tolower(coin_has_$1)=yes
     4507     m4_toupper($1_DATA)="$withval"],
     4508    [])
     4509fi
     4510
     4511if test $m4_tolower(coin_has_$1) = notGiven; then
     4512  if test -n "$PKG_CONFIG" ; then
     4513    # set search path for pkg-config
     4514    # need to export variable to be sure that the following pkg-config gets these values
     4515    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
     4516    PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED"
     4517    export PKG_CONFIG_PATH
     4518   
     4519    # let pkg-config do it's magic
     4520    AC_COIN_PKG_HAS_MODULE([$1],[$2],
     4521      [ m4_tolower(coin_has_$1)=yes
     4522        AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS])
     4523        coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
     4524        ])
     4525      ],
     4526      [ m4_tolower(coin_has_$1)=notGiven
     4527        AC_MSG_RESULT([not given: $m4_toupper($1)_PKG_ERRORS])
     4528      ])
     4529
     4530    # reset PKG_CONFIG_PATH variable
     4531    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
     4532    export PKG_CONFIG_PATH
     4533   
     4534    # augment X_CFLAGS and X_LIBS for each build target X in $3
     4535    coin_foreach_w([myvar], [$3], [
     4536      m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
     4537      m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
     4538    ])
     4539  else
     4540    AC_MSG_RESULT([skipped check via pkg-config, redirect to fallback])
     4541    AC_COIN_HAS_PACKAGE_FALLBACK([$1], [$2], [$3])
     4542  fi
     4543
     4544else
     4545  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
     4546fi
     4547
     4548if test $m4_tolower(coin_has_$1) != skipping &&
     4549   test $m4_tolower(coin_has_$1) != notGiven ; then
     4550  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
     4551   
     4552  if test 1 = 0 ; then  #change this test to enable a bit of debugging output
     4553    if test -n "$m4_toupper($1)_CFLAGS" ; then
     4554      AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
     4555    fi
     4556    if test -n "$m4_toupper($1)_LIBS" ; then
     4557      AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
     4558    fi
     4559    if test -n "$m4_toupper($1)_DATA" ; then
     4560      AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
     4561    fi
     4562    if test -n "$m4_toupper($1)_CFLAGS" ; then
     4563      AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
     4564    fi
     4565    coin_foreach_w([myvar], [$3], [
     4566      AC_MSG_NOTICE([myvar CFLAGS are $m4_toupper(myvar)_CFLAGS])
     4567      AC_MSG_NOTICE([myvar LIBS   are $m4_toupper(myvar)_LIBS])
     4568    ])
     4569  fi
     4570fi
     4571
     4572# Define the Makefile conditional
     4573AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
     4574               [test $m4_tolower(coin_has_$1) != notGiven &&
     4575                test $m4_tolower(coin_has_$1) != skipping])
     4576
     4577]) # AC_COIN_HAS_MODULE
     4578
     4579###########################################################################
     4580#                       COIN_HAS_PACKAGE_FALLBACK                         #
     4581###########################################################################
     4582
     4583# This macro is used if COIN_HAS_PACKAGE fails to find a module because pkg-config was disabled or is not available.
     4584#
     4585# For each project xxx specified in $2, it searches for a xxx-uninstalled.pc file in the directories specified in
     4586# $COIN_PKG_CONFIG_PATH_UNINSTALLED. The latter variable is setup by COIN_HAS_PKGCONFIG and
     4587# consists of the content of the coin_subdirs.txt file which has been created by configure in the base directory.
     4588# The content of xxx-uninstalled.pc is parsed in order to defines the variables PACKAGE_CFLAGS, PACKAGE_LIBS, and PACKAGE_DATA,
     4589# referring to the compiler and linker flags to use when linking against this package
     4590# and the directory where the package data resists.
     4591# Further, for each build target X specified in the third argument, the variables X_CFLAGS and X_LIBS are
     4592# extended with the compiler and linker flags of this package and the variables X_PCLIBS and X_PCREQUIRES are extended by the list
     4593# of linker flags and dependent projects as needed to setup a .pc file.
     4594# The macros checks also dependencies of $2.
     4595# Note that the PACKAGE_DATA variable is set to the content of datadir of the first .pc file that is parsed.
     4596#
     4597# If .pc files for all projects in $2 and their dependencies is found, tolower(coin_has_$1) is set to "yes".
     4598# Otherwise, if some dependency is not found, tolower(coin_has_$1) is set to "notGiven".
     4599# Further, a COIN_HAS_PACKAGE preprocessor macro and a makefile conditional are defined.
     4600#
     4601# The first argument should be the name (PACKAGE) of the package (in correct lower and upper case).
     4602# The second argument should be the base names of the projects .pc file which define this package.
     4603# The optional third argument should be a (space separated) list of build targets
     4604# which use this package, if available.
     4605
     4606# $1 is not checked for $COIN_SKIP_PROJECTS, since we only look into $COIN_PKG_CONFIG_PATH_UNINSTALLED.
     4607# When the content of this variable was setup in the base directory, $COIN_SKIP_PROJECTS has already been considered.
     4608
     4609AC_DEFUN([AC_COIN_HAS_PACKAGE_FALLBACK],
     4610[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     4611AC_MSG_CHECKING([for COIN-OR package $1 (fallback)])
     4612
     4613m4_tolower(coin_has_$1)=notGiven
     4614m4_toupper($1_LIBS)=
     4615m4_toupper($1_CFLAGS)=
     4616m4_toupper($1_DATA)=
     4617
     4618# initial list of dependencies is "$2", but we need to filter out version number specifications (= x, <= x, >= x)
     4619projtoprocess="m4_bpatsubsts([$2], [<?>?=[      ]*[^    ]+])"
     4620projprocessed=""
     4621
     4622while test $m4_tolower(coin_has_$1) = notGiven ; do
     4623  # setup list of projects that need to be processed in the next round
     4624  nextprojtoprocess=""
     4625
     4626  for proj in $projtoprocess ; do
     4627    # if $proj has been processed already, skip this round
     4628    if test "x$projprocessed" != x ; then
     4629      for projdone in $projprocessed ; do
     4630        if test $projdone = $proj ; then
     4631          continue 2
     4632        fi
     4633      done
     4634    fi
     4635
     4636    # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it
     4637    pcfile=""
     4638    save_IFS="$IFS"
     4639    IFS=":"
     4640    for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do
     4641      # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again
     4642      if test -r "$dir/$proj-uninstalled.pc" ; then
     4643        pcfile="$dir/$proj-uninstalled.pc"
     4644        pcfiledir="$dir"
     4645        break
     4646      fi
     4647    done
     4648    IFS="$save_IFS"
     4649
     4650    if test "x$pcfile" != x ; then
     4651      # read CFLAGS from $pcfile and add CYGPATH_W cludge into include flags
     4652      projcflags=`sed -n -e 's/Cflags://p' "$pcfile"`
     4653      projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
     4654      m4_toupper($1_CFLAGS)="$projcflags $m4_toupper($1_CFLAGS)"
     4655     
     4656      # read LIBS from $pcfile and replace -L${libdir} by absolute path to build directory in linker flags
     4657      # we assume that the build directory is $pcfiledir/src if this directory exists, otherwise we assume that it is $pcfiledir
     4658      projlibs=`sed -n -e 's/Libs://' -e 's/-L\${libdir}//p' "$pcfile"`
     4659      if test "x$projlibs" != x ; then
     4660        if test -d "${pcfiledir}/src" ; then
     4661          projlibs="-L`cd "${pcfiledir}/src"; pwd` $projlibs"
     4662        else
     4663          projlibs="-L`cd "$pcfiledir"; pwd` $projlibs"
     4664        fi
     4665      else
     4666        projlibs=`sed -n -e 's/Libs://p' "$pcfile"`
     4667      fi
     4668      m4_toupper($1_LIBS)="$m4_toupper($1_LIBS) $projlibs"
     4669     
     4670      # read DATA from $pcfile, if this is the first .pc file we are processing (so assume that its the main one)
     4671      if test "x$projprocessed" = x ; then
     4672        m4_toupper($1_DATA)=`sed -n -e 's/datadir=//gp' "$pcfile"`
     4673      fi
     4674     
     4675      # read dependencies from $pcfile, filter it, and add to list of projects that need to be processed next
     4676      projrequires=[`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\?>\?=[         ]*[^    ]\+//g'`]
     4677      nextprojtoprocess="$nextprojtoprocess $projrequires"
     4678     
     4679      # remember that we have processed $proj
     4680      projprocessed="$projprocessed $proj"
     4681     
     4682    else
     4683      AC_MSG_RESULT([no, dependency $proj not available])
     4684      break 2
     4685    fi
     4686
     4687  done
     4688 
     4689  projtoprocess="$nextprojtoprocess"
     4690 
     4691  # if there are no more projects to search for, finish up
     4692  if test "x$projtoprocess" = x ; then
     4693    m4_tolower(coin_has_$1)=yes
     4694    AC_MSG_RESULT([yes, dependencies are$projprocessed])
     4695    AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
     4696   
     4697    coin_foreach_w([myvar], [$3], [
     4698      m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
     4699      m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
     4700      m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
     4701    ])
     4702   
     4703    if test 1 = 0 ; then  #change this test to enable a bit of debugging output
     4704      if test -n "$m4_toupper($1)_CFLAGS" ; then
     4705        AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
     4706      fi
     4707      if test -n "$m4_toupper($1)_LIBS" ; then
     4708        AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
     4709      fi
     4710      if test -n "$m4_toupper($1)_DATA" ; then
     4711        AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
     4712      fi
     4713      coin_foreach_w([myvar], [$3], [
     4714        AC_MSG_NOTICE([myvar CFLAGS are $m4_toupper(myvar)_CFLAGS])
     4715        AC_MSG_NOTICE([myvar LIBS   are $m4_toupper(myvar)_LIBS])
     4716      ])
     4717    fi
     4718  fi
     4719done
     4720
     4721AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
     4722               [test $m4_tolower(coin_has_$1) != notGiven &&
     4723                test $m4_tolower(coin_has_$1) != skipping])
     4724
     4725]) # AC_COIN_HAS_PACKAGE_FALLBACK
     4726
     4727###########################################################################
     4728#                         COIN_HAS_PACKAGE_BLAS                           #
     4729###########################################################################
     4730
     4731# This macro checks for a library containing the BLAS library.  It
     4732# 1. checks the --with-blas argument
     4733# 2. if --with-blas=BUILD has been specified goes to point 5
     4734# 3. if --with-blas has been specified to a working library, sets BLAS_LIBS to its value
     4735# 4. tries standard libraries
     4736# 5. calls COIN_HAS_PACKAGE(Blas, [coinblas], [$1]) to check for ThirdParty/Blas
     4737# The makefile conditional and preprocessor macro COIN_HAS_BLAS is defined.
     4738# BLAS_LIBS is set to the flags required to link with a Blas library.
     4739# For each build target X in $1, X_LIBS is extended with $BLAS_LIBS.
     4740# In case 3 and 4, the flags to link to Blas are added to X_PCLIBS too.
     4741# In case 5, Blas is added to X_PCREQUIRES.
     4742
     4743AC_DEFUN([AC_COIN_HAS_PACKAGE_BLAS],
     4744[
     4745AC_ARG_WITH([blas],
     4746            AC_HELP_STRING([--with-blas],
     4747                           [specify BLAS library (or BUILD for compilation)]),
     4748            [use_blas="$withval"], [use_blas=])
     4749
     4750#if user specified --with-blas-lib, then we should give COIN_HAS_PACKAGE preference
     4751AC_ARG_WITH([blas-lib],,[use_blas=BUILD])
     4752
     4753# Check if user supplied option makes sense
     4754if test x"$use_blas" != x; then
     4755  if test "$use_blas" = "BUILD"; then
     4756    # we come to this later
     4757    :
     4758  elif test "$use_blas" != "no"; then
     4759    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
     4760    coin_save_LIBS="$LIBS"
     4761    LIBS="$use_blas $LIBS"
     4762    AC_COIN_TRY_FLINK([daxpy],
     4763                      [AC_MSG_RESULT([yes])],
     4764                      [AC_MSG_RESULT([no])
     4765                       AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
     4766    LIBS="$coin_save_LIBS"
     4767  fi
     4768else
     4769# Try to autodetect the library for blas based on build system
     4770  #AC_MSG_CHECKING([default locations for BLAS])
     4771  skip_lblas_check=no
     4772  case $build in
     4773    *-sgi-*)
     4774      AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
     4775      coin_save_LIBS="$LIBS"
     4776      LIBS="-lcomplib.sgimath $LIBS"
     4777      AC_COIN_TRY_FLINK([daxpy],
     4778                        [AC_MSG_RESULT([yes])
     4779                         use_blas="-lcomplib.sgimath"],
     4780                        [AC_MSG_RESULT([no])])
     4781      LIBS="$coin_save_LIBS"
     4782      ;;
     4783
     4784# Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio
     4785# cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't
     4786# recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims
     4787# that CC and cc will understand -library in Studio 13. The main extra
     4788# function of -xlic_lib and -library is to arrange for the Fortran run-time
     4789# libraries to be linked for C++ and C. We can arrange that explicitly.
     4790    *-*-solaris*)
     4791      AC_MSG_CHECKING([for BLAS in libsunperf])
     4792      coin_save_LIBS="$LIBS"
     4793      LIBS="-lsunperf $FLIBS $LIBS"
     4794      AC_COIN_TRY_FLINK([daxpy],
     4795                        [AC_MSG_RESULT([yes])
     4796                         use_blas='-lsunperf'
     4797                         coin_need_flibs=yes],
     4798                        [AC_MSG_RESULT([no])])
     4799      LIBS="$coin_save_LIBS"
     4800      ;;
     4801    *-cygwin* | *-mingw*)
     4802# On cygwin, consider -lblas only if doscompile is disabled. The prebuilt
     4803# library will want to link with cygwin, hence won't run standalone in DOS.
     4804      if test "$enable_doscompile" = mingw; then
     4805        skip_lblas_check=yes
     4806      fi
     4807      case "$CC" in
     4808        cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
     4809          AC_MSG_CHECKING([for BLAS in MKL])
     4810          coin_save_LIBS="$LIBS"
     4811          LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS"
     4812          AC_COIN_TRY_FLINK([daxpy],
     4813                            [AC_MSG_RESULT([yes])
     4814                             use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib'],
     4815                            [AC_MSG_RESULT([no])])
     4816          LIBS="$coin_save_LIBS"
     4817          ;;
     4818      esac
     4819      ;;
     4820  esac
     4821
     4822  if test -z "$use_blas" && test $skip_lblas_check = no; then
     4823    AC_MSG_CHECKING([whether -lblas has BLAS])
     4824    coin_save_LIBS="$LIBS"
     4825    LIBS="-lblas $LIBS"
     4826    AC_COIN_TRY_FLINK([daxpy],
     4827                      [AC_MSG_RESULT([yes])
     4828                       use_blas='-lblas'],
     4829                      [AC_MSG_RESULT([no])])
     4830    LIBS="$coin_save_LIBS"
     4831  fi
     4832 
     4833  # If we have no other ideas, consider building BLAS.
     4834  if test -z "$use_blas" ; then
     4835    use_blas=BUILD
     4836  fi
     4837fi
     4838
     4839if test "x$use_blas" = xBUILD ; then
     4840  AC_COIN_HAS_PACKAGE(Blas, [coinblas], [$1])
     4841 
     4842elif test "x$use_blas" != x && test "$use_blas" != no; then
     4843  coin_has_blas=yes
     4844  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 0])
     4845  AC_DEFINE([COIN_HAS_BLAS],[1], [If defined, the BLAS Library is available.])
     4846  BLAS_LIBS="$use_blas"
     4847  BLAS_CFLAGS=
     4848  BLAS_DATA=
     4849  AC_SUBST(BLAS_LIBS)
     4850  AC_SUBST(BLAS_CFLAGS)
     4851  AC_SUBST(BLAS_DATA)
     4852  coin_foreach_w([myvar], [$1], [
     4853    m4_toupper(myvar)_PCLIBS="$BLAS_LIBS $m4_toupper(myvar)_PCLIBS"
     4854    m4_toupper(myvar)_LIBS="$BLAS_LIBS $m4_toupper(myvar)_LIBS"
     4855  ])
     4856 
     4857else
     4858  coin_has_blas=no
     4859  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 1])
     4860fi
     4861
     4862coin_foreach_w([myvar], [$1], [
     4863  AC_SUBST(m4_toupper(myvar)_PCLIBS)
     4864  AC_SUBST(m4_toupper(myvar)_LIBS)
     4865])
     4866
     4867]) # AC_COIN_HAS_PACKAGE_BLAS
     4868
     4869###########################################################################
     4870#                       COIN_HAS_PACKAGE_LAPACK                           #
     4871###########################################################################
     4872
     4873# This macro checks for a library containing the LAPACK library.  It
     4874# 1. checks the --with-lapack argument
     4875# 2. if --with-lapack=BUILD has been specified goes to point 5
     4876# 3. if --with-lapack has been specified to a working library, sets LAPACK_LIBS to its value
     4877# 4. tries standard libraries
     4878# 5. calls COIN_HAS_PACKAGE(Lapack, [lapack], [$1]) to check for ThirdParty/Lapack
     4879# The makefile conditional and preprocessor macro COIN_HAS_LAPACK is defined.
     4880# LAPACK_LIBS is set to the flags required to link with a Lapack library.
     4881# For each build target X in $1, X_LIBS is extended with $LAPACK_LIBS.
     4882# In case 3 and 4, the flags to link to Lapack are added to X_PCLIBS too.
     4883# In case 5, Lapack is added to X_PCREQUIRES.
     4884
     4885AC_DEFUN([AC_COIN_HAS_PACKAGE_LAPACK],
     4886[
     4887AC_ARG_WITH([lapack],
     4888            AC_HELP_STRING([--with-lapack],
     4889                           [specify LAPACK library (or BUILD for compilation)]),
     4890            [use_lapack=$withval], [use_lapack=])
     4891           
     4892#if user specified --with-lapack-lib, then we should give COIN_HAS_PACKAGE preference
     4893AC_ARG_WITH([lapack-lib],,[use_lapack=BUILD])
     4894
     4895# Check if user supplied option makes sense
     4896if test x"$use_lapack" != x; then
     4897  if test "$use_lapack" = "BUILD"; then
     4898    # we come to this later
     4899    :
     4900  elif test "$use_lapack" != no; then
     4901    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
     4902    coin_save_LIBS="$LIBS"
     4903    LIBS="$use_lapack $LIBS"
     4904    AC_COIN_TRY_FLINK([dsyev],
     4905                      [AC_MSG_RESULT([yes])],
     4906                      [AC_MSG_RESULT([no])
     4907                       AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
     4908    LIBS="$coin_save_LIBS"
     4909  fi
     4910else
     4911  if test x$coin_has_blas = xyes; then
     4912    # First try to see if LAPACK is already available with BLAS library
     4913    AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
     4914    coin_save_LIBS="$LIBS"
     4915    LIBS="$BLAS_LIBS $LIBS"
     4916    AC_COIN_TRY_FLINK([dsyev],
     4917                      [AC_MSG_RESULT([yes]); use_lapack="$BLAS_LIBS"],
     4918                      [AC_MSG_RESULT([no])])
     4919    LIBS="$coin_save_LIBS"
     4920  fi
     4921  skip_llapack_check=no
     4922  if test -z "$use_lapack"; then
     4923    # Try to autodetect the library for lapack based on build system
     4924    case $build in
     4925      *-sgi-*)
     4926        AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
     4927        coin_save_LIBS="$LIBS"
     4928        LIBS="-lcomplib.sgimath $LIBS"
     4929        AC_COIN_TRY_FLINK([dsyev],
     4930                          [AC_MSG_RESULT([yes])
     4931                           use_lapack="-lcomplib.sgimath;"],
     4932                          [AC_MSG_RESULT([no])])
     4933        LIBS="$coin_save_LIBS"
     4934        ;;
     4935
     4936      # See comments in COIN_HAS_BLAS.
     4937      *-*-solaris*)
     4938        AC_MSG_CHECKING([for LAPACK in libsunperf])
     4939        coin_save_LIBS="$LIBS"
     4940        LIBS="-lsunperf $FLIBS $LIBS"
     4941        AC_COIN_TRY_FLINK([dsyev],
     4942                          [AC_MSG_RESULT([yes])
     4943                           use_lapack='-lsunperf'
     4944                           coin_need_flibs=yes],
     4945                          [AC_MSG_RESULT([no])])
     4946        LIBS="$coin_save_LIBS"
     4947        ;;
     4948        # On cygwin, do this check only if doscompile is disabled. The prebuilt library
     4949        # will want to link with cygwin, hence won't run standalone in DOS.
     4950      *-cygwin*)
     4951        if test "$enable_doscompile" = mingw; then
     4952          skip_llapack_check=yes
     4953        fi
     4954        ;;
     4955    esac
     4956  fi
     4957
     4958  if test -z "$use_lapack" && test $skip_llapack_check = no; then
     4959    AC_MSG_CHECKING([whether -llapack has LAPACK])
     4960    coin_save_LIBS="$LIBS"
     4961    LIBS="-llapack $LIBS"
     4962    AC_COIN_TRY_FLINK([dsyev],
     4963                      [AC_MSG_RESULT([yes])
     4964                       use_lapack='-llapack'],
     4965                      [AC_MSG_RESULT([no])])
     4966    LIBS="$coin_save_LIBS"
     4967  fi
     4968
     4969  # If we have no other ideas, consider building LAPACK.
     4970  if test -z "$use_lapack" ; then
     4971    use_lapack=BUILD
     4972  fi
     4973fi
     4974
     4975if test "x$use_lapack" = xBUILD ; then
     4976  AC_COIN_HAS_PACKAGE(Lapack, [coinlapack], [$1])
     4977 
     4978elif test "x$use_lapack" != x && test "$use_lapack" != no; then
     4979  coin_has_lapack=yes
     4980  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 0])
     4981  AC_DEFINE([COIN_HAS_LAPACK],[1], [If defined, the LAPACK Library is available.])
     4982  LAPACK_LIBS="$use_lapack"
     4983  LAPACK_CFLAGS=
     4984  LAPACK_DATA=
     4985  AC_SUBST(LAPACK_LIBS)
     4986  AC_SUBST(LAPACK_CFLAGS)
     4987  AC_SUBST(LAPACK_DATA)
     4988  coin_foreach_w([myvar], [$1], [
     4989    m4_toupper(myvar)_PCLIBS="$LAPACK_LIBS $m4_toupper(myvar)_PCLIBS"
     4990    m4_toupper(myvar)_LIBS="$LAPACK_LIBS $m4_toupper(myvar)_LIBS"
     4991  ])
     4992 
     4993else
     4994  coin_has_lapack=no
     4995  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 1])
     4996fi
     4997
     4998coin_foreach_w([myvar], [$1], [
     4999  AC_SUBST(m4_toupper(myvar)_PCLIBS)
     5000  AC_SUBST(m4_toupper(myvar)_LIBS)
     5001])
     5002
     5003]) # AC_COIN_HAS_PACKAGE_LAPACK
Note: See TracChangeset for help on using the changeset viewer.