Changeset 3119


Ignore:
Timestamp:
Dec 4, 2013 3:53:33 PM (6 years ago)
Author:
stefan
Message:

give coin.m4 a fresh start, see also #95

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makemain.inc

    r2105 r3119  
    5656
    5757# Take care of updating externals (if Dependencies file exists)
    58 if HAVE_EXTERNALS
    59 $(top_builddir)/Makefile: .Dependencies-stamp
    60 
    61 .Dependencies-stamp: $(srcdir)/Dependencies
    62         cd $(srcdir); BuildTools/set_externals Dependencies
    63         touch .Dependencies-stamp
    64 
    65 update-externals: .Dependencies-stamp
    66         cd $(srcdir); svn update
     58#if HAVE_EXTERNALS
     59#$(top_builddir)/Makefile: .Dependencies-stamp
     60#
     61#.Dependencies-stamp: $(srcdir)/Dependencies
     62#       cd $(srcdir); BuildTools/set_externals Dependencies
     63#       touch .Dependencies-stamp
     64#
     65#update-externals: .Dependencies-stamp
     66#       cd $(srcdir); svn update
     67#
     68#endif
    6769
    6870endif
    6971
    70 endif
    71 
    72 if HAVE_EXTERNALS
    73 EXTRA_DIST += Dependencies
    74 DISTCLEANFILES += .Dependencies-stamp
    75 endif
     72#if HAVE_EXTERNALS
     73#EXTRA_DIST += Dependencies
     74#DISTCLEANFILES += .Dependencies-stamp
     75#endif
    7676
    7777DISTCLEANFILES += $(VPATH_DISTCLEANFILES)
  • trunk/coin.m4

    r3115 r3119  
    1 # Copyright (C) 2006, 2009 International Business Machines.
     1# Copyright (C) 2013
    22# All Rights Reserved.
    33# This file is distributed under the Eclipse Public License.
    44#
    5 ## $Id$
     5# This file defines the common autoconf macros for COIN-OR
    66#
    7 # Author: Andreas Wachter    IBM      2006-04-14
    8 
    9 # This file defines the common autoconf macros for COIN
    10 #
    117
    128# Check requirements
    13 AC_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
    23 AC_DEFUN([coin_foreach_w], [m4_ifval([$2], [m4_foreach([$1], [m4_bpatsubsts([$2],[[     ]+],[, ])], [$3])])])
    24 
    25 ###########################################################################
    26 #                            COIN_CHECK_FILE                              #
    27 ###########################################################################
    28 
    29 # A simple replacement for AC_CHECK_FILE that works for cross compilation
    30 
    31 AC_DEFUN([AC_COIN_CHECK_FILE],
    32 [if test -r $1; then
    33   $2
    34   :
    35 else
    36   $3
    37   :
    38 fi
    39 ])
    40 
    41 ###########################################################################
    42 #                           COIN_CHECK_VPATH                              #
    43 ###########################################################################
    44 
    45 # This macro sets the variable coin_vpath_config to true if this is a
    46 # VPATH configuration, otherwise it sets it to false.
    47 
    48 AC_DEFUN([AC_COIN_CHECK_VPATH],
    49 [
    50 AC_MSG_CHECKING(whether this is a VPATH configuration)
    51 if test `cd $srcdir; pwd` != `pwd`; then
    52   coin_vpath_config=yes;
    53 else
    54   coin_vpath_config=no;
    55 fi
    56 AC_MSG_RESULT($coin_vpath_config)
    57 ]) # AC_COIN_CHECK_VPATH
    58 
    59 
    60 ###########################################################################
    61 #                          COIN_PROJECTVERSION                            #
    62 ###########################################################################
    63 
    64 # This macro is used by COIN_PROJECTDIR_INIT and sets up variables related
    65 # to versioning numbers of the project.
    66 
    67 AC_DEFUN([AC_COIN_PROJECTVERSION],
    68 [m4_ifvaln([$1],[
    69   AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION), ["$PACKAGE_VERSION"],[Version number of project])
    70  
    71   [coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'`]
    72   [coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'`]
    73   [coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'`]
    74   if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi
    75   if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi
    76   if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi
    77   AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION_MAJOR),   [$coin_majorver],   [Major Version number of project])
    78   AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION_MINOR),   [$coin_minorver],   [Minor Version number of project])
    79   AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION_RELEASE), [$coin_releasever], [Release Version number of project])
    80 
    81   # We use the following variable to have a string with the upper case
    82   # version of the project name
    83   COIN_PRJCT=m4_toupper($1)
    84 
    85   # Set the project's SVN revision number. The complicated sed expression
    86   # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up
    87   # as a single number.
    88   AC_CHECK_PROG([have_svnversion],[svnversion],[yes],[no])
    89   if test "x$have_svnversion" = xyes; then
    90     AC_SUBST(m4_toupper($1_SVN_REV))
    91     svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null`
    92     if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then
    93       m4_toupper($1_SVN_REV)=`echo $svn_rev_tmp | sed -n -e 's/^@<:@0-9@:>@*://' -e 's/\(@<:@0-9@:>@\)@<:@^0-9@:>@*$/\1/p'`
    94       AC_DEFINE_UNQUOTED(m4_toupper($1_SVN_REV), $m4_toupper($1_SVN_REV), [SVN revision number of project])
    95     fi
    96   fi
    97  ])
    98  
    99 # Capture libtool library version, if given.
    100  m4_ifvaln([$2],[coin_libversion=$2],[])
    101 ])
    102 
    103 ###########################################################################
    104 #                         COIN_PROJECTDIR_INIT                            #
    105 ###########################################################################
    106 
    107 # This macro does everything that is required in the early part in the
    108 # configure script, such as defining a few variables.  This should only be used
    109 # in the main directory of a project directory (the one which holds the src
    110 # directory for the project). The first parameter is the project name. The
    111 # second (optional) is the libtool library version (important for releases,
    112 # less so for stable or trunk).
    113 
    114 AC_DEFUN([AC_COIN_PROJECTDIR_INIT],
    115 [
    116 # As backup, we make sure we don't loose an FLIBS if it has been set
    117 # by the user
    118 save_FLIBS="$FLIBS"
    119 
    120 # A useful makefile conditional that is always false
    121 AM_CONDITIONAL(ALWAYS_FALSE, false)
    122 
    123 # We set the following variable so that we know later in AC_COIN_FINALIZE
    124 # that we are in a project main directory
    125 coin_projectdir=yes
    126 
    127 # Set the project's version numbers
    128 AC_COIN_PROJECTVERSION($1, $2)
    129 ]) # AC_COIN_PROJECTDIR_INIT
    130 
    131 ###########################################################################
    132 #                          COIN_DEBUG_COMPILE                             #
    133 ###########################################################################
    134 
    135 # enable the configure flags --enable-debug and --enable-debug-prjct
    136 # (where prcjt is the name of the project in lower case) and set the
    137 # variable coin_debug_compile to true or false This is used by
    138 # COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77 to determine the
    139 # compilation flags.  This macro also makes the switches
    140 # --with-prjct-verbosity and --with-prjct-checklevel available, which
    141 # define the preprocessor macros COIN_PRJCT_VERBOSITY and
    142 # COIN_PRJCT_CHECKLEVEL to the specified value (default is 0).
    143 #
    144 # The project specific flags are only made available, if one gives the
    145 # name of the project as first argument to this macro.
    146 
    147 AC_DEFUN([AC_COIN_DEBUG_COMPILE],
    148 [AC_BEFORE([$0],[AC_COIN_PROG_CXX])dnl
    149 AC_BEFORE([$0],[AC_COIN_PROG_CC])dnl
    150 AC_BEFORE([$0],[AC_COIN_PROG_F77])dnl
    151 
    152 AC_MSG_CHECKING([whether we want to compile in debug mode])
    153 
    154 AC_ARG_ENABLE([debug],
    155 [AC_HELP_STRING([--enable-debug],
    156                 [compile all projects with debug options tests (implies --disable-shared)])],
    157 [case "${enableval}" in
    158    yes) coin_debug_compile=true
    159         if test "${enable_shared+set}" = set; then :; else
    160           enable_shared=no
    161         fi
    162         ;;
    163    no)  coin_debug_compile=false
    164         ;;
    165    *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
    166         ;;
    167 esac],
    168 [coin_debug_compile=false])
    169 
    170 m4_ifvaln([$1],
    171 [AC_ARG_ENABLE(debug-m4_tolower($1),
    172  [AC_HELP_STRING([--enable-debug-m4_tolower($1)],
    173                  [compile project $1 with debug compiler flags])],
    174  [case "${enableval}" in
    175     yes) coin_debug_compile=true
    176          ;;
    177     no)  coin_debug_compile=false
    178          ;;
    179     *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-m4_tolower($1))
    180          ;;
    181  esac],[:])
    182 ]) # m4_ifvaln([$1],
    183 
    184 if test $coin_debug_compile = true; then
    185   AC_MSG_RESULT([yes])
    186 else
    187   AC_MSG_RESULT([no])
    188 fi
    189 
    190 m4_ifvaln([$1],
    191 [AC_ARG_WITH(m4_tolower($1)-verbosity,
    192              AC_HELP_STRING([--with-m4_tolower($1)-verbosity],
    193                             [specify the debug verbosity level for project $1]),
    194              [if test "$withval" = yes; then
    195                 withval=1
    196               fi
    197               m4_tolower(coin_$1_verbosity)=$withval],
    198              [m4_tolower(coin_$1_verbosity)=0])
    199  AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_VERBOSITY),
    200                     m4_tolower($coin_$1_verbosity),
    201                     [Define to the debug verbosity level (0 is no output)])
    202 
    203  AC_ARG_WITH(m4_tolower($1)-checklevel,
    204              AC_HELP_STRING([--with-m4_tolower($1)-checklevel],
    205                             [specify the sanity check level for project $1]),
    206              [if test "$withval" = yes; then
    207                 withval=1
    208               fi
    209               m4_tolower(coin_$1_checklevel)=$withval],
    210              [m4_tolower(coin_$1_checklevel)=0])
    211  AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_CHECKLEVEL),
    212                     m4_tolower($coin_$1_checklevel),
    213                     [Define to the debug sanity check level (0 is no test)])
    214 ]) # m4_ifvaln([$1],
    215  
    216 ]) # AC_COIN_DEBUG_COMPILE
    217 
    218 ###########################################################################
    219 #                          COIN_MINGW_LD_FIX                              #
    220 ###########################################################################
    221 
    222 # This macro is included by any PROG_compiler macro, to set the LD
    223 # environment variable on MinGW to the correct value (link). If we're
    224 # building from cygwin with MSVC tools (cl/link), then we do want link and
    225 # you'd better have your PATH variable straight, else you'll be doing file
    226 # links instead of code links!
    227 
    228 AC_DEFUN([AC_COIN_MINGW_LD_FIX],
    229 [AC_REQUIRE([AC_COIN_ENABLE_MSVC])
    230  case $build in
    231   *-mingw*)
    232     if test "${LD+set}" = set; then :; else
    233       LD=link
    234     fi
    235     ;;
    236  esac
    237  if test $enable_msvc = yes ; then
    238    if test "x${LD+set}" = xset; then :; else
    239      LD=link
    240    fi
    241  fi
    242 ])
    243 
    244 ###########################################################################
    245 #                          COIN_ENABLE_MSVC                               #
    246 ###########################################################################
    247 
    248 # This macro is invoked by any PROG_compiler macro to establish the
    249 # --enable-msvc option.
    250 # The job of this macro is to make sure the option is correct and
    251 # to set enable_msvc. Legal values are yes and no (disabled).
    252 # If set, assume the presence of cl/link. It's the user's responsibility to
    253 # make sure their PATH is correct. In particular, that MSVC link is found
    254 # and not cygwin link (we want to do code linking, not file linking).
    255 # It's the responsibility of individual PROG_compiler macros to ensure that
    256 # they correctly set the compiler search list and preprocess, compile, and
    257 # link flags. This is tied to compiler setup because in practice invocations
    258 # of the preprocessor and linker are made through the compiler.
    259 # For backward compatibility, we also check for --enable-doscompile=msvc.
    260 
    261 AC_DEFUN([AC_COIN_ENABLE_MSVC],
    262 [AC_REQUIRE([AC_CANONICAL_BUILD])
    263 
    264   # for backward compatibility
    265   AC_ARG_ENABLE([doscompile],,[enable_doscompile=$enableval],[enable_doscompile=no])
    266  
    267   AC_ARG_ENABLE([msvc],
    268     [AC_HELP_STRING([--enable-msvc],
    269                     [Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin.])],
    270     [enable_msvc=$enableval],
    271     [enable_msvc=no
    272      if test "$enable_doscompile" = msvc ; then
    273        enable_msvc=yes
    274      elif test "$enable_doscompile" != no ; then
    275        AC_MSG_ERROR([--enable-doscompile=$enable_doscompile not supported anymore.])
    276      fi
    277     ])
    278    
    279   if test "$enable_msvc" = MD; then
    280     enable_shared=yes
    281     enable_msvc=yes
    282   fi
    283 
    284   if test "$enable_msvc" = yes; then
    285     case $build in
    286       *-cygwin* | *-mingw*) ;;
    287       *) AC_MSG_ERROR([--enable-msvc option makes sense only under Cygwin or MinGW]) ;;
    288     esac
    289   fi
    290 ])
    291 
    292 ###########################################################################
    293 #                             COIN_PROG_CXX                               #
    294 ###########################################################################
    295 
    296 # Find the compile command by running AC_PROG_CXX (with compiler names for
    297 # different operating systems) and put it into CXX (unless it was given by the
    298 # user). Then find an appropriate value for CXXFLAGS. If either of CXXFLAGS or
    299 # PRJCT_CXXFLAGS is defined, that value is used (replace PRJCT with the upper
    300 # case name of this project).  It is possible to provide additional -D flags
    301 # in the variable CXXDEFS, and additional compilation flags with ADD_CXXFLAGS.
    302 
    303 AC_DEFUN([AC_COIN_PROG_CXX],
    304 [AC_REQUIRE([AC_COIN_PROG_CC]) #Let's try if that overcomes configuration problem with VC++ 6.0
    305 AC_REQUIRE([AC_COIN_ENABLE_MSVC])
    306 AC_REQUIRE([AC_COIN_ENABLE_STATICSTDLIBS])
    307 AC_LANG_PUSH(C++)
    308 
    309 AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.])
    310 AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options])
    311 AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options])
    312 AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options])
    313 
    314 coin_has_cxx=yes
    315 
    316 save_cxxflags="$CXXFLAGS"
    317 # For *-*-solaris*, promote Studio/Workshop compiler to front of list.
    318 case $build in
    319   *-cygwin* | *-mingw*)
    320       if test "$enable_msvc" = yes ; then
    321          comps="icl cl g++"
    322       else
    323          comps="g++ icl cl"
    324       fi ;;
    325   *-*-solaris*)
    326              comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;;
    327   *-darwin*) comps="g++ c++ CC" ;;
    328   *-linux-gnu*)
    329              comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;;
    330           *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;;
    331 esac
    332 
    333 # We delete the cached value, since the test might not have been
    334 # performed with our choice of compilers earlier
    335 $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; }
    336 # AC_MSG_NOTICE([C++ compiler candidates: $comps])
    337 AC_PROG_CXX([$comps])
    338 
    339 #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler
    340 #thus, we test here whether $CXX is actually working
    341 AC_LANG_PUSH(C++)
    342 AC_MSG_CHECKING([whether C++ compiler $CXX works]);
    343 AC_COMPILE_IFELSE(
    344   [AC_LANG_PROGRAM(, [int i=0;])],
    345   [AC_MSG_RESULT(yes)],
    346   [AC_MSG_RESULT(no)
    347    AC_MSG_ERROR(failed to find a C++ compiler or C++ compiler $CXX does not work)]
    348 )
    349 AC_LANG_POP(C++)
    350 
    351 coin_cxx_is_cl=false
    352 # It seems that we need to cleanup something here for the Windows
    353 case "$CXX" in
    354   clang* ) ;;
    355   cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    356     sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh
    357     mv confdefs.hh confdefs.h
    358     coin_cxx_is_cl=true
    359     ;;
    360 esac
    361 
    362 # add automake conditional so we can recognize cl compiler in makefile
    363 AM_CONDITIONAL(COIN_CXX_IS_CL, [test $coin_cxx_is_cl = true])
    364 
    365 # Autoconf incorrectly concludes that cl recognises -g. It doesn't.
    366 case "$CXX" in
    367   clang* ) ;;
    368   cl* | */cl* | CL* | */CL* )
    369     if test "$ac_cv_prog_cxx_g" = yes ; then
    370       ac_cv_prog_cxx_g=no
    371       AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.])
    372     fi ;;
    373   * )
    374     if test x"$CYGPATH_W" = x ; then
    375       CYGPATH_W=echo
    376     fi
    377     ;;
    378 esac
    379 CXXFLAGS="$save_cxxflags"
    380 
    381 # Check if a project specific CXXFLAGS variable has been set
    382 if test x$COIN_PRJCT != x; then
    383   eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set}
    384   if test x$coin_tmp = xset; then
    385     eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS}
    386   fi
    387 fi
    388 
    389 if test x"$CXXFLAGS" = x; then
    390 
    391 # ToDo decide whether we want -DNDEBUG for optimization
    392   coin_add_cxxflags=
    393   coin_opt_cxxflags=
    394   coin_dbg_cxxflags=
    395   coin_warn_cxxflags=
    396 
    397   if test "$GXX" = "yes"; then
    398     case "$CXX" in
    399       icpc* | */icpc*)
    400         ;;
    401       *)
    402 # ToDo decide about unroll-loops
    403         coin_opt_cxxflags="-O3"
    404         coin_add_cxxflags="-pipe"
    405         coin_dbg_cxxflags="-g -O0"
    406         coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long"
    407         case $build in
    408           *-darwin*)
    409             ;;
    410           *)
    411             coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags"
    412             ;;
    413         esac
    414     esac
    415   fi
    416 
    417 # Note that we do not need to cover GCC in the following tests.
    418 
    419   if test -z "$coin_opt_cxxflags"; then
    420     case $build in
    421       *-cygwin* | *-mingw*)
    422         case "$CXX" in
    423           clang* ) ;;
    424           cl* | */cl* | CL* | */CL*)
    425             # The MT and MTd options are mutually exclusive
    426             if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
    427                coin_opt_cxxflags='-MD -O2'
    428                coin_dbg_cxxflags='-MDd'
    429             else
    430                coin_opt_cxxflags='-MT -O2'
    431                coin_dbg_cxxflags='-MTd'
    432             fi
    433             coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE'
    434             ;;
    435           icl* | */icl* | ICL* | */ICL*)
    436           # The MT and MTd options are mutually exclusive
    437             if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
    438               coin_opt_cxxflags='-MD -Ox'
    439               coin_dbg_cxxflags='-MDd -debug'
    440             else
    441               coin_opt_cxxflags='-MT -Ox'
    442               coin_dbg_cxxflags='-MTd -debug'
    443             fi
    444             coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE'
    445             ;;
    446         esac
    447         ;;
    448       *-linux-*)
    449         case "$CXX" in
    450           icpc* | */icpc*)
    451             coin_opt_cxxflags="-O3 -ip -mp1"
    452             coin_add_cxxflags=""
    453             coin_dbg_cxxflags="-g"
    454             # Check if -i_dynamic is necessary (for new glibc library)
    455             CXXFLAGS=
    456             AC_TRY_LINK(,[int i=0; i++;],[],
    457                         [coin_add_cxxflags="-i_dynamic $coin_add_cxxflags"])
    458             ;;
    459           pgCC* | */pgCC*)
    460             coin_opt_cxxflags="-fast"
    461             coin_add_cxxflags="-Kieee -pc 64"
    462             coin_dbg_cxxflags="-g"
    463             ;;
    464         esac
    465         ;;
    466       *-ibm-*)
    467         case "$CXX" in
    468           xlC* | */xlC* | mpxlC* | */mpxlC*)
    469             coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
    470             coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++"
    471             coin_dbg_cxxflags="-g"
    472             ;;
    473         esac
    474         ;;
    475       *-hp-*)
    476         case "$CXX" in
    477           aCC* | */aCC* )
    478             coin_opt_cxxflags="-O"
    479             coin_add_cxxflags="-AA"
    480             coin_dbg_cxxflags="-g"
    481             ;;
    482         esac
    483         ;;
    484       *-*-solaris*)
    485           coin_opt_cxxflags="-O4"
    486           coin_dbg_cxxflags="-g"
    487         ;;
    488     esac
    489   fi
    490 
    491 # Generic flag settings. If these don't work, add a case above.
    492 
    493   if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then
    494     coin_dbg_cxxflags="-g"
    495   fi
    496 
    497   if test -z "$coin_opt_cxxflags"; then
    498     # Try if -O option works if nothing else is set
    499     CXXFLAGS=-O
    500     AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"])
    501   fi
    502 
    503   # if PM doesn't want the warning messages, take them out
    504   if test x"$coin_skip_warn_cxxflags" = xyes; then
    505     coin_warn_cxxflags=
    506   fi
    507 
    508 # Do final setup of flags based on values determined above.
    509 
    510   if test x${DBG_CXXFLAGS+set} != xset; then
    511     DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags"
    512   fi
    513   if test x${OPT_CXXFLAGS+set} != xset; then
    514     OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags"
    515   fi
    516 
    517   DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
    518   OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
    519 
    520   if test "$coin_debug_compile" = "true"; then
    521     CXXFLAGS="$DBG_CXXFLAGS"
    522   else
    523     CXXFLAGS="$OPT_CXXFLAGS"
    524   fi
    525 
    526 # Handle the case where CXXFLAGS was set externally.
    527 else
    528   CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
    529   if test x${DBG_CXXFLAGS+set} != xset; then
    530     DBG_CXXFLAGS="$CXXFLAGS"
    531   fi
    532   if test x${OPT_CXXFLAGS+set} != xset; then
    533     OPT_CXXFLAGS="$CXXFLAGS"
    534   fi
    535 fi
    536 
    537 # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include
    538 if test x$COIN_PRJCT != x; then
    539   CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD"
    540 fi
    541 
    542 # Try if CXXFLAGS works
    543 save_CXXFLAGS="$CXXFLAGS"
    544 AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
    545 if test -z "$CXXFLAGS"; then
    546   AC_MSG_WARN([The flags CXXFLAGS="$save_CXXFLAGS" do not work.  I will now just try '-O', but you might want to set CXXFLAGS manually.])
    547   CXXFLAGS='-O'
    548   AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
    549   if test -z "$CXXFLAGS"; then
    550     AC_MSG_WARN([This value for CXXFLAGS does not work.  I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.])
    551   fi
    552 fi
    553 
    554 AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS])
    555 
    556 AC_ARG_VAR(MPICXX,[C++ MPI Compiler])
    557 if test x"$MPICXX" = x; then :; else
    558   AC_MSG_NOTICE([Will use MPI C++ compiler $MPICXX])
    559   CXX="$MPICXX"
    560 fi
    561 
    562 # correct the LD variable in a mingw build with MS or intel compiler
    563 case "$CXX" in
    564   clang* ) ;;
    565   cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    566     AC_COIN_MINGW_LD_FIX
    567     ;;
    568 esac
    569 
    570 # check whether to add flag for static linking against standard libraries to LDFLAGS
    571 if test x$use_static_standardlibs != xno ; then
    572   case $build in
    573     *-mingw*)
    574       static_standardlib_flag=-static
    575       ;;
    576     *)
    577       static_standardlib_flag=-static-libstdc++
    578       ;;
    579   esac
    580   case " $LDFLAGS " in
    581     *" $static_standardlib_flag "* ) ;;
    582     *)
    583     AC_MSG_CHECKING([whether linking with $static_standardlib_flag works])
    584     coin_save_LDFLAGS="$LDFLAGS"
    585     LDFLAGS="$LDFLAGS $static_standardlib_flag"
    586     AC_LINK_IFELSE(
    587       [AC_LANG_PROGRAM(, [int i=0;])],
    588       [AC_MSG_RESULT(yes)],
    589       [AC_MSG_RESULT(no)
    590        LDFLAGS="$coin_save_LDFLAGS"
    591        if test $use_static_standardlibs = yes ; then
    592          AC_MSG_ERROR([failed to link with $static_standardlib_flag])
    593        fi
    594       ])
    595     ;;
    596   esac
    597 fi
    598 
    599 AC_LANG_POP(C++)
    600 ]) # AC_COIN_PROG_CXX
    601 
    602 
    603 ###########################################################################
    604 #                             COIN_CXXLIBS                                #
    605 ###########################################################################
    606 
    607 # Determine the C++ runtime libraries required for linking a C++ library
    608 # with a Fortran or C compiler.  The result is available in CXXLIBS.
    609 
    610 AC_DEFUN([AC_COIN_CXXLIBS],
    611 [AC_REQUIRE([AC_PROG_CXX])dnl
    612 AC_LANG_PUSH(C++)
    613 AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler])
    614 if test -z "$CXXLIBS"; then
    615   if test "$GXX" = "yes"; then
    616     case "$CXX" in
    617       icpc* | */icpc*)
    618         CXXLIBS="-lstdc++"
    619         ;;
    620       *)
    621         # clang uses libc++ as the default standard C++ library, not libstdc++
    622         # this test is supposed to recognize whether the compiler is clang
    623         #
    624         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ciso646>]], [[
    625 #ifndef _LIBCPP_VERSION
    626        choke me
    627 #endif
    628           ]])],
    629           [CXXLIBS="-lc++"],
    630           [CXXLIBS="-lstdc++ -lm"])
    631         ;;
    632     esac
    633   else
    634     case $build in
    635      *-mingw32 | *-cygwin* )
    636       case "$CXX" in
    637       clang* ) ;;
    638       cl* | */cl* | CL* | */CL*)
    639         CXXLIBS=nothing;;
    640       esac;;
    641      *-linux-*)
    642       case "$CXX" in
    643       icpc* | */icpc*)
    644         CXXLIBS="-lstdc++"
    645              ;;
    646       pgCC* | */pgCC*)
    647         CXXLIBS="-lstd -lC -lc"
    648              ;;
    649       esac;;
    650     *-ibm-*)
    651       CXXLIBS="-lC -lc"
    652       ;;
    653     *-hp-*)
    654       CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc"
    655       ;;
    656     *-*-solaris*)
    657       CXXLIBS="-lCstd -lCrun"
    658     esac
    659   fi
    660 fi
    661 if test -z "$CXXLIBS"; then
    662   AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C).])
    663 else
    664   AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".])
    665 fi
    666 if test x"$CXXLIBS" = xnothing; then
    667   CXXLIBS=
    668 fi
    669 AC_LANG_POP(C++)
    670 ]) # AC_COIN_CXXLIBS
    671 
    672 ###########################################################################
    673 #                           COIN_CHECK_HEADER                             #
    674 ###########################################################################
    675 
    676 # This macro checks for a header file, but it does so without the
    677 # standard header.  This avoids warning messages like:
    678 #
    679 # configure: WARNING: dlfcn.h: present but cannot be compiled
    680 # configure: WARNING: dlfcn.h:     check for missing prerequisite headers?
    681 # configure: WARNING: dlfcn.h: see the Autoconf documentation
    682 # configure: WARNING: dlfcn.h:     section "Present But Cannot Be Compiled"
    683 # configure: WARNING: dlfcn.h: proceeding with the preprocessor's result
    684 # configure: WARNING: dlfcn.h: in the future, the compiler will take precedence
    685 
    686 # My guess that the problem lay with CPPFLAGS seems to be correct. With this
    687 # macro reduced to a direct call to AC_CHECK_HEADERS, there are no warnings
    688 # now that CPPFLAGS contains -mno-cygwin when it needs it. -- lh, 061214 --
    689 
    690 # AW 070609: I restored the previous version, since otherwise the warnings
    691 # still pop up for the cl compiler
    692 
    693 AC_DEFUN([AC_COIN_CHECK_HEADER],
    694 [#if test x"$4" = x; then
    695 #  hdr="#include <$1>"
    696 #else
    697 #  hdr="$4"
    698 #fi
    699 #AC_CHECK_HEADERS([$1],[$2],[$3],[$hdr])
    700 AC_CHECK_HEADERS([$1],[$2],[$3],[$4])
    701 ]) # AC_COIN_CHECK_HEADER
    702 
    703 ###########################################################################
    704 #                       COIN_CHECK_CXX_CHEADER                             #
    705 ###########################################################################
    706 
    707 # This macro checks for C header files that are used from C++.  For a give
    708 # stub (e.g., math), it first checks if the C++ library (cmath) is available.
    709 # If it is, it defines HAVE_CMATH (or whatever the stub is).  If it is not
    710 # available, it checks for the old C head (math.h) and defines HAVE_MATH_H
    711 # if that one exists.
    712 
    713 AC_DEFUN([AC_COIN_CHECK_CXX_CHEADER],
    714 [AC_LANG_PUSH(C++)
    715 AC_COIN_CHECK_HEADER([c$1],[$2],[$3],[$4])
    716 if test "$ac_cv_header_c$1" != "yes"; then
    717   AC_COIN_CHECK_HEADER([$1.h],[$2],[$3],[$4])
    718 fi
    719 AC_LANG_POP(C++)
    720 ]) # AC_COIN_CHECK_CXX_CHEADER
    721 
    722 ###########################################################################
    723 #                   COIN_ENABLE_STATICSTDLIBS                             #
    724 ###########################################################################
    725 
    726 # This macro defines the --enable-static-standardlibs flag and determines
    727 # its default value according to the setting of --enable-shared.
    728 # That is, if static libraries are build, then we also try to link against
    729 # static standard libraries, unless the corresponding flags do not work.
    730 #
    731 # Since this is not yet always working as desired, we do not advertise this
    732 # option and do not enable it automatically, yet.
    733 
    734 #AC_DEFUN([AC_COIN_ENABLE_STATICSTDLIBS],
    735 #[
    736 #AC_ARG_ENABLE([static-standardlibs],
    737 #  [AC_HELP_STRING([--enable-static-standardlibs],
    738 #                  [whether to link against static standard libraries (libgcc, libgfortran, libstdc++)])],
    739 #  [case "$enableval" in
    740 #     no | yes | auto ) ;;
    741 #     *)
    742 #       AC_MSG_ERROR([invalid argument for --enable-static-standardlibs: $enableval]) ;;
    743 #   esac
    744 #   use_static_standardlibs=$enableval],
    745 #  [if test x$enable_shared = xno ; then
    746 #     use_static_standardlibs=auto
    747 #   else
    748 #     use_static_standardlibs=no
    749 #   fi
    750 #  ]
    751 #)
    752 #]);
    753 
    754 AC_DEFUN([AC_COIN_ENABLE_STATICSTDLIBS],
    755 [
    756 AC_ARG_ENABLE([static-standardlibs],
    757   [],
    758   [case "$enableval" in
    759      no | yes | auto ) ;;
    760      *)
    761        AC_MSG_ERROR([invalid argument for --enable-static-standardlibs: $enableval]) ;;
    762    esac
    763    use_static_standardlibs=$enableval],
    764   [use_static_standardlibs=no])
    765 ]);
    766 
    767 ###########################################################################
    768 #                             COIN_PROG_CC                                #
    769 ###########################################################################
    770 
    771 # Find the compile command by running AC_PROG_CC (with compiler names
    772 # for different operating systems) and put it into CC (unless it was
    773 # given my the user), and find an appropriate value for CFLAGS.  It is
    774 # possible to provide additional -D flags in the variable CDEFS.
    775 
    776 AC_DEFUN([AC_COIN_PROG_CC],
    777 [AC_REQUIRE([AC_COIN_MINGW_LD_FIX])
    778 AC_REQUIRE([AC_COIN_ENABLE_MSVC])
    779 AC_REQUIRE([AC_COIN_ENABLE_STATICSTDLIBS])
    780 AC_LANG_PUSH(C)
    781 
    782 # For consistency, we set the C compiler to the same value of the C++
    783 # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl)
    784 if test x"$CXX" != x; then
    785   case "$CXX" in
    786     clang* ) ;;
    787     cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    788       if test x"$CC" = x; then
    789         CC="$CXX"
    790         AC_MSG_WARN([C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX])
    791       fi
    792       ;;
    793   esac
    794 fi
    795 
    796 AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.])
    797 AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options])
    798 AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options])
    799 AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options])
    800 
    801 coin_has_cc=yes
    802 
    803 save_cflags="$CFLAGS"
    804 
    805 # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list.
    806 # Depending on the user's PATH, when Studio/Workshop cc is not present we may
    807 # find /usr/ucb/cc, which is almost certainly not a good choice for the C
    808 # compiler. In this case, put cc after gcc.
    809 
    810 case $build in
    811   *-cygwin* | *-mingw*)
    812              if test "$enable_msvc" = yes ; then
    813                comps="icl cl gcc"
    814              else
    815                comps="gcc icl cl"
    816              fi ;;
    817   *-*-solaris*)
    818              AC_CHECK_PROG(sol_cc_compiler,cc,cc,[],[],/usr/ucb/cc)
    819              if test "$sol_cc_compiler" = "cc" ; then
    820                comps="cc xlc gcc pgcc icc"
    821              else
    822                comps="xlc gcc pgcc icc cc"
    823              fi
    824              ;;
    825   *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;;
    826   *-linux-*) comps="xlc gcc cc pgcc icc" ;;
    827   *)         comps="xlc_r xlc cc gcc pgcc icc" ;;
    828 esac
    829 
    830 # We delete the cached value, since the test might not have been
    831 # performed with our choice of compilers earlier
    832 $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; }
    833 # AC_MSG_NOTICE([C compiler candidates: $comps])
    834 AC_PROG_CC([$comps])
    835 if test -z "$CC" ; then
    836   AC_MSG_ERROR([Failed to find a C compiler!])
    837 fi
    838 # Autoconf incorrectly concludes that cl recognises -g. It doesn't.
    839 case "$CC" in
    840   clang* ) ;;
    841   cl* | */cl* | CL* | */CL* )
    842     if test "$ac_cv_prog_cc_g" = yes ; then
    843       ac_cv_prog_cc_g=no
    844       AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.])
    845     fi ;;
    846   * )
    847     if test x"$CYGPATH_W" = x ; then
    848       CYGPATH_W=echo
    849     fi
    850     ;;
    851 esac
    852 CFLAGS="$save_cflags"
    853 
    854 # add automake conditional so we can recognize cl compiler in makefile
    855 coin_cc_is_cl=false
    856 case "$CC" in
    857   clang* ) ;;
    858   cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    859     coin_cc_is_cl=true
    860     ;;
    861 esac
    862 AM_CONDITIONAL(COIN_CC_IS_CL, [test $coin_cc_is_cl = true])
    863 
    864 # Check if a project specific CFLAGS variable has been set
    865 if test x$COIN_PRJCT != x; then
    866   eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set}
    867   if test x$coin_tmp = xset; then
    868     eval CFLAGS=\${${COIN_PRJCT}_CFLAGS}
    869   fi
    870 fi
    871 
    872 if test x"$CFLAGS" = x; then
    873 
    874   coin_add_cflags=
    875   coin_opt_cflags=
    876   coin_dbg_cflags=
    877   coin_warn_cflags=
    878 
    879   if test "$GCC" = "yes"; then
    880     case "$CC" in
    881       icc* | */icc*)
    882         ;;
    883       *)
    884         coin_opt_cflags="-O3"
    885         coin_add_cflags="-pipe"
    886         coin_dbg_cflags="-g -O0"
    887         coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long"
    888         case $build in
    889           *-darwin*)
    890             ;;
    891           *)
    892             coin_warn_cflags="-pedantic-errors $coin_warn_cflags"
    893             ;;
    894         esac
    895     esac
    896   fi
    897   if test -z "$coin_opt_cflags"; then
    898     case $build in
    899       *-cygwin* | *-mingw*)
    900         case "$CC" in
    901           clang* ) ;;
    902           cl* | */cl* | CL* | */CL*)
    903             if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
    904               coin_opt_cflags='-MD -O2'
    905               coin_dbg_cflags='-MDd'
    906             else
    907               coin_opt_cflags='-MT -O2'
    908               coin_dbg_cflags='-MTd'
    909             fi
    910             coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE'
    911             ;;
    912           icl* | */icl* | ICL* | */ICL*)
    913             if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
    914               coin_opt_cflags='-MD -Ox'
    915               coin_dbg_cflags='-MDd -debug'
    916             else
    917               coin_opt_cflags='-MT -Ox'
    918               coin_dbg_cflags='-MTd -debug'
    919             fi
    920             coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE'
    921             ;;
    922         esac
    923         ;;
    924       *-linux-*)
    925         case "$CC" in
    926           icc* | */icc*)
    927             coin_opt_cflags="-O3 -ip -mp1"
    928             coin_add_cflags=""
    929             coin_dbg_cflags="-g"
    930             # Check if -i_dynamic is necessary (for new glibc library)
    931             CFLAGS=
    932             AC_TRY_LINK([],[int i=0; i++;],[],
    933                         [coin_add_cflags="-i_dynamic $coin_add_cflags"])
    934             ;;
    935           pgcc* | */pgcc*)
    936             coin_opt_cflags="-fast"
    937             coin_add_cflags="-Kieee -pc 64"
    938             coin_dbg_cflags="-g"
    939             ;;
    940         esac
    941         ;;
    942       *-ibm-*)
    943         case "$CC" in
    944           xlc* | */xlc* | mpxlc* | */mpxlc*)
    945             coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
    946             coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029"
    947             coin_dbg_cflags="-g"
    948           ;;
    949         esac
    950         ;;
    951       *-hp-*)
    952         coin_opt_cflags="-O"
    953         coin_add_cflags="-Ae"
    954         coin_dbg_cflags="-g"
    955         ;;
    956       *-*-solaris*)
    957         coin_opt_cflags="-xO4"
    958         coin_dbg_cflags="-g"
    959         ;;
    960       *-sgi-*)
    961         coin_opt_cflags="-O -OPT:Olimit=0"
    962         coin_dbg_cflags="-g"
    963         ;;
    964     esac
    965   fi
    966 
    967   if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then
    968     coin_dbg_cflags="-g"
    969   fi
    970 
    971   if test -z "$coin_opt_cflags"; then
    972     # Try if -O option works if nothing else is set
    973     CFLAGS="-O"
    974     AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"])
    975   fi
    976 
    977   # if PM doesn't want the warning messages, take them out
    978   if test x"$coin_skip_warn_cflags" = xyes; then
    979     coin_warn_cflags=
    980   fi
    981 
    982   if test x${DBG_CFLAGS+set} != xset; then
    983     DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags"
    984   fi
    985   if test x${OPT_CFLAGS+set} != xset; then
    986     OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags"
    987   fi
    988 
    989   DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS"
    990   OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS"
    991 
    992   if test "$coin_debug_compile" = "true"; then
    993     CFLAGS="$DBG_CFLAGS"
    994   else
    995     CFLAGS="$OPT_CFLAGS"
    996   fi
    997 
    998 else
    999   CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS"
    1000   if test x${DBG_CFLAGS+set} != xset; then
    1001     DBG_CFLAGS="$CFLAGS"
    1002   fi
    1003   if test x${OPT_CFLAGS+set} != xset; then
    1004     OPT_CFLAGS="$CFLAGS"
    1005   fi
    1006 fi
    1007 
    1008 # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include
    1009 if test x$COIN_PRJCT != x; then
    1010   CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD"
    1011 fi
    1012 
    1013 # Try if CFLAGS works
    1014 save_CFLAGS="$CFLAGS"
    1015 AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
    1016 if test -z "$CFLAGS"; then
    1017   AC_MSG_WARN([The value CFLAGS="$save_CFLAGS" do not work.  I will now just try '-O', but you might want to set CFLAGS manually.])
    1018   CFLAGS='-O'
    1019   AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
    1020   if test -z "$CFLAGS"; then
    1021     AC_MSG_WARN([This value for CFLAGS does not work.  I will continue with empty CFLAGS, but you might want to set CFLAGS manually.])
    1022   fi
    1023 fi
    1024 
    1025 AC_MSG_NOTICE([C compiler options are: $CFLAGS])
    1026 
    1027 AC_ARG_VAR(MPICC,[C MPI Compiler])
    1028 if test x"$MPICC" = x; then :; else
    1029   AC_MSG_NOTICE([Will use MPI C compiler $MPICC])
    1030   CC="$MPICC"
    1031 fi
    1032 
    1033 # Correct the LD variable if we are using the MS or Intel-windows compiler
    1034 case "$CC" in
    1035   clang* ) ;;
    1036   cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    1037     AC_COIN_MINGW_LD_FIX
    1038     ;;
    1039 esac
    1040 
    1041 # check whether to add flags for static linking against standard libraries to LDFLAGS
    1042 if test x$use_static_standardlibs != xno ; then
    1043   case $build in
    1044     *-mingw*)
    1045       static_standardlib_flag=-static
    1046       ;;
    1047     *)
    1048       static_standardlib_flag=-static-libgcc
    1049       ;;
    1050   esac
    1051   case " $LDFLAGS " in
    1052     *" $static_standardlib_flag "* ) ;;
    1053     *)
    1054     AC_MSG_CHECKING([whether linking with $static_standardlib_flag works])
    1055     coin_save_LDFLAGS="$LDFLAGS"
    1056     LDFLAGS="$LDFLAGS $static_standardlib_flag"
    1057     AC_LINK_IFELSE(
    1058       [AC_LANG_PROGRAM(, [int i=0;])],
    1059       [AC_MSG_RESULT(yes)],
    1060       [AC_MSG_RESULT(no)
    1061        LDFLAGS="$coin_save_LDFLAGS"
    1062        if test $use_static_standardlibs = yes ; then
    1063          AC_MSG_ERROR([failed to link with $static_standardlib_flag])
    1064        fi
    1065       ])
    1066     ;;
    1067   esac
    1068 fi
    1069 
    1070 AC_LANG_POP(C)
    1071 ]) # AC_COIN_PROG_CC
    1072 
    1073 ###########################################################################
    1074 #                             COIN_PROG_F77                               #
    1075 ###########################################################################
    1076 
    1077 # Find the compile command by running AC_PROG_F77 (with compiler names
    1078 # for different operating systems) and put it into F77 (unless it was
    1079 # given by the user), and find an appropriate value for FFLAGS
    1080 
    1081 AC_DEFUN([AC_COIN_PROG_F77],
    1082 [AC_REQUIRE([AC_COIN_MINGW_LD_FIX])
    1083 AC_REQUIRE([AC_COIN_ENABLE_MSVC])
    1084 AC_REQUIRE([AC_COIN_ENABLE_STATICSTDLIBS])
    1085 AC_REQUIRE([AC_COIN_PROG_CC])
    1086 AC_REQUIRE([AC_COIN_F77_COMPS])
    1087 AC_LANG_PUSH([Fortran 77])
    1088 
    1089 AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options])
    1090 AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options])
    1091 AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options])
    1092 
    1093 coin_has_f77=yes
    1094 
    1095 save_fflags="$FFLAGS"
    1096 
    1097 # We delete the cached value, since the test might not have been
    1098 # performed with our choice of compilers earlier
    1099 $as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; }
    1100 
    1101 # This is a real belt-and-suspenders approach. AC_COIN_FIND_F77 will use
    1102 # coin_f77_comps to see if there's a program that matches one of the names.
    1103 # If there's no such program, F77 = unavailable. If we match the name,
    1104 # feed AC_PROG_F77 the same search list, just to be sure it's a functioning
    1105 # compiler.
    1106 # AC_MSG_NOTICE([Fortran compiler candidates: $coin_f77_comps])
    1107 AC_COIN_FIND_F77
    1108 if test "$F77" != "unavailable" ; then
    1109   AC_PROG_F77($coin_f77_comps)
    1110 else
    1111   AC_MSG_WARN([Failed to find a Fortran compiler!])
    1112 fi
    1113 
    1114 FFLAGS="$save_fflags"
    1115 
    1116 # Check if a project specific FFLAGS variable has been set
    1117 if test x$COIN_PRJCT != x; then
    1118   eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set}
    1119   if test x$coin_tmp = xset; then
    1120     eval FFLAGS=\${${COIN_PRJCT}_FFLAGS}
    1121   fi
    1122 fi
    1123 
    1124 if test "$F77" != "unavailable" && test x"$FFLAGS" = x ; then
    1125 
    1126   coin_add_fflags=
    1127   coin_opt_fflags=
    1128   coin_dbg_fflags=
    1129   coin_warn_fflags=
    1130 
    1131   if test "$G77" = "yes"; then
    1132     coin_opt_fflags="-O3"
    1133     coin_add_fflags="-pipe"
    1134     coin_dbg_fflags="-g -O0"
    1135   else
    1136     case $build in
    1137       *-cygwin* | *-mingw*)
    1138         case $F77 in
    1139           ifort* | */ifort* | IFORT* | */IFORT* )
    1140             if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
    1141               coin_opt_fflags='-MD -O3'
    1142               coin_dbg_fflags='-MDd -debug'
    1143             else
    1144               coin_opt_fflags='-MT -O3'
    1145               coin_dbg_fflags='-MTd -debug'
    1146             fi
    1147             coin_add_fflags='-fpp -nologo'
    1148           ;;
    1149           compile_f2c*)
    1150             if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
    1151               coin_opt_fflags='-MD -O2'
    1152               coin_dbg_fflags='-MDd'
    1153             else
    1154               coin_opt_fflags='-MT -O2'
    1155               coin_dbg_fflags='-MTd'
    1156             fi
    1157             coin_add_fflags='-nologo -wd4996'
    1158           ;;
    1159         esac
    1160         ;;
    1161       *-linux-*)
    1162         case $F77 in
    1163           ifc* | */ifc* | ifort* | */ifort*)
    1164             coin_opt_fflags="-O3 -ip"
    1165             coin_add_fflags="-cm -w90 -w95"
    1166             coin_dbg_fflags="-g -CA -CB -CS"
    1167             # Check if -i_dynamic is necessary (for new glibc library)
    1168             FFLAGS=
    1169             AC_TRY_LINK(,[      write(*,*) 'Hello world'],[],
    1170                         [coin_add_fflags="-i_dynamic $coin_add_fflags"])
    1171             ;;
    1172           pgf77* | */pgf77* | pgf90* | */pgf90*)
    1173             coin_opt_fflags="-fast"
    1174             coin_add_fflags="-Kieee -pc 64"
    1175             coin_dbg_fflags="-g"
    1176           ;;
    1177         esac
    1178         ;;
    1179       *-ibm-*)
    1180         case "$F77" in
    1181           xlf* | */xlf* | mpxlf* | */mpxlf* )
    1182             coin_opt_fflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
    1183             coin_add_fflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029"
    1184             coin_dbg_fflags="-g -C"
    1185             ;;
    1186         esac
    1187         ;;
    1188       *-hp-*)
    1189         coin_opt_fflags="+O3"
    1190         coin_add_fflags="+U77"
    1191         coin_dbg_fflags="-C -g"
    1192         ;;
    1193       *-*-solaris*)
    1194         coin_opt_fflags="-O4"
    1195         coin_dbg_fflags="-g"
    1196         ;;
    1197       *-sgi-*)
    1198         coin_opt_fflags="-O5 -OPT:Olimit=0"
    1199         coin_dbg_fflags="-g"
    1200         ;;
    1201     esac
    1202   fi
    1203 
    1204   if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then
    1205     coin_dbg_fflags="-g"
    1206   fi
    1207 
    1208   if test -z "$coin_opt_fflags"; then
    1209     # Try if -O option works if nothing else is set
    1210     FFLAGS=-O
    1211     AC_TRY_LINK(,[      integer i], [coin_opt_fflags="-O"])
    1212   fi
    1213 
    1214   # if PM doesn't want the warning messages, take them out
    1215   if test x"$coin_skip_warn_fflags" = xyes; then
    1216     coin_warn_fflags=
    1217   fi
    1218 
    1219   if test x${DBG_FFLAGS+set} != xset; then
    1220     DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags"
    1221   fi
    1222   if test x${OPT_FFLAGS+set} != xset; then
    1223     OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags"
    1224   fi
    1225 
    1226   DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS"
    1227   OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS"
    1228 
    1229   if test "$coin_debug_compile" = "true"; then
    1230     FFLAGS="$DBG_FFLAGS"
    1231   else
    1232     FFLAGS="$OPT_FFLAGS"
    1233   fi
    1234 
    1235 else
    1236   FFLAGS="$FFLAGS $ADD_FFLAGS"
    1237   if test x${DBG_FFLAGS+set} != xset; then
    1238     DBG_FFLAGS="$FFLAGS"
    1239   fi
    1240   if test x${OPT_FFLAGS+set} != xset; then
    1241     OPT_FFLAGS="$FFLAGS"
    1242   fi
    1243 fi
    1244 
    1245 # Try if FFLAGS works
    1246 if test "$F77" != "unavailable" ; then
    1247   AC_TRY_LINK(,[      integer i],[],[FFLAGS=])
    1248   if test -z "$FFLAGS"; then
    1249     AC_MSG_WARN([The flags FFLAGS="$FFLAGS" do not work.  I will now just try '-O', but you might want to set FFLAGS manually.])
    1250     FFLAGS='-O'
    1251     AC_TRY_LINK(,[      integer i],[],[FFLAGS=])
    1252     if test -z "$FFLAGS"; then
    1253       AC_MSG_WARN([This value for FFLAGS does not work.  I will continue with empty FFLAGS, but you might want to set FFLAGS manually.])
    1254     fi
    1255   fi
    1256 fi
    1257 
    1258 AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS])
    1259 
    1260 AC_ARG_VAR(MPIF77,[Fortran MPI Compiler])
    1261 if test x"$MPIF77" = x; then :; else
    1262   AC_MSG_NOTICE([Will use MPI Fortran compiler $MPIF77])
    1263   F77="$MPIF77"
    1264 fi
    1265 
    1266 # correct the LD variable if we use the intel fortran compiler in windows
    1267 case "$F77" in
    1268   ifort* | */ifort* | IFORT* | */IFORT*)
    1269     AC_COIN_MINGW_LD_FIX
    1270     ;;
    1271 esac
    1272 
    1273 # check whether to add flag for static linking against standard libraries to LDFLAGS
    1274 if test x$use_static_standardlibs != xno ; then
    1275   case $build in
    1276     *-mingw*)
    1277       static_standardlib_flag=-static
    1278       ;;
    1279     *)
    1280       static_standardlib_flag=-static-libgfortran
    1281       ;;
    1282   esac
    1283   case " $LDFLAGS " in
    1284     *" $static_standardlib_flag "* ) ;;
    1285     *)
    1286     AC_MSG_CHECKING([whether linking with $static_standardlib_flag works])
    1287     coin_save_LDFLAGS="$LDFLAGS"
    1288     LDFLAGS="$LDFLAGS $static_standardlib_flag"
    1289     AC_LINK_IFELSE(
    1290       [AC_LANG_PROGRAM(,[      integer i])],
    1291       [AC_MSG_RESULT(yes)],
    1292       [AC_MSG_RESULT(no)
    1293        LDFLAGS="$coin_save_LDFLAGS"
    1294        if test $use_static_standardlibs = yes ; then
    1295          AC_MSG_ERROR([failed to link with $static_standardlib_flag])
    1296        fi
    1297       ])
    1298     ;;
    1299   esac
    1300 fi
    1301 
    1302 AC_LANG_POP([Fortran 77])
    1303 ]) # AC_COIN_PROG_F77
    1304 
    1305 ###########################################################################
    1306 #                           COIN_F77_WRAPPERS                             #
    1307 ###########################################################################
    1308 
    1309 # Calls autoconfs AC_F77_LIBRARY_LDFLAGS and does additional corrections to FLIBS.
    1310 # Then calls AC_F77_WRAPPERS to get Fortran namemangling scheme.
    1311 #
    1312 # To ensure that the FLIBS are determined and corrected before linking against
    1313 # Fortran compilers is attempted by other macros, we put it into an extra macro
    1314 # and call it via AC_REQUIRE. This way it seems to be called before the macros
    1315 # required by AC_F77_WRAPPERS.
    1316 
    1317 AC_DEFUN([_AC_COIN_F77_LIBRARY_LDFLAGS],
    1318 [AC_BEFORE([AC_PROG_F77],[$0])dnl
    1319 
    1320 # get FLIBS
    1321 AC_F77_LIBRARY_LDFLAGS
    1322 orig_FLIBS="$FLIBS"
    1323 
    1324 # If FLIBS has been set by the user, we just restore its value here
    1325 if test x"$save_FLIBS" != x; then
    1326   FLIBS="$save_FLIBS"
    1327 else
    1328   # This is to correct a missing exclusion in autoconf 2.59
    1329   if test x"$FLIBS" != x; then
    1330     my_flibs=
    1331     for flag in $FLIBS; do
    1332       case $flag in
    1333         -lcrt*.o) ;;
    1334         -lcygwin) ;;
    1335         -lgcc*)   ;;
    1336                *) my_flibs="$my_flibs $flag" ;;
    1337       esac
    1338     done
    1339     FLIBS="$my_flibs"
    1340   fi
    1341 
    1342   case $build in
    1343   # The following is a fix to define FLIBS for ifort on Windows
    1344   # In its original version, it linked in libifcorert.lib or libifcorertd.lib on Windows/ifort explicitly.
    1345   # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables.
    1346   # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line.
    1347   # Further, excluding libc.lib from the default libs seemed to be necessary only for VS < 8.
    1348   # Since the corresponding flag seems to make more trouble than it avoids, it has been removed now.
    1349      *-cygwin* | *-mingw*)
    1350        case "$F77" in
    1351 #         ifort* | */ifort* | IFORT* | */IFORT*)
    1352 #           FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib"
    1353 #           if "$coin_debug_compile" = true ; then
    1354 #             FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib"
    1355 #           else
    1356 #             FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib"
    1357 #           fi
    1358 #           ;;
    1359          compile_f2c*)
    1360            FLIBS=`$F77 -FLIBS` ;;
    1361        esac;;
    1362      *-hp-*)
    1363          FLIBS="$FLIBS -lm";;
    1364      *-ibm-*)
    1365          FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;;
    1366      *-linux-*)
    1367        case "$F77" in
    1368          pgf77* | */pgf77* | pgf90* | */pgf90*)
    1369 # ask linker to go through the archives multiple times
    1370 # (the Fortran compiler seems to do that automatically...)
    1371            FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;;
    1372        esac
    1373   esac
    1374   ac_cv_f77_libs="$FLIBS"
    1375 fi
    1376 
    1377 if test "x$orig_FLIBS" != "x$FLIBS" ; then
    1378   AC_MSG_NOTICE([Corrected Fortran libraries: $FLIBS])
    1379 fi
    1380 ]) # _AC_COIN_F77_LIBRARY_LDFLAGS
    1381 
    1382 AC_DEFUN([AC_COIN_F77_WRAPPERS],
    1383 [AC_BEFORE([AC_COIN_PROG_F77],[$0])dnl
    1384 AC_REQUIRE([_AC_COIN_F77_LIBRARY_LDFLAGS])dnl
    1385 
    1386 AC_LANG_PUSH([Fortran 77])
    1387 AC_F77_WRAPPERS
    1388 AC_LANG_POP([Fortran 77])
    1389 
    1390 ]) # AC_COIN_F77_WRAPPERS
    1391 
    1392 ###########################################################################
    1393 #                             COIN_FIND_F77                               #
    1394 ###########################################################################
    1395 
    1396 # Attempt to preempt autoconf by locating an appropriate F77 program. This
    1397 # macro will not trigger a fatal error if a suitable compiler cannot be
    1398 # found. It should be called before COIN_PROG_F77 or COIN_TRY_FLINK.
    1399 
    1400 AC_DEFUN([AC_COIN_FIND_F77],
    1401 [AC_REQUIRE([AC_COIN_ENABLE_MSVC])
    1402 AC_REQUIRE([AC_COIN_F77_COMPS])
    1403 AC_MSG_NOTICE([Trying to determine Fortran compiler name])
    1404 AC_CHECK_TOOLS([F77],[$coin_f77_comps],[unavailable])
    1405 ])
    1406 
    1407 # Auxilliary macro to make sure both COIN_PROG_F77 and COIN_FIND_F77 use
    1408 # the same search lists for compiler names.
    1409 # For *-*-solaris*, promote Studio/Workshop compilers to front of list.
    1410 AC_DEFUN([AC_COIN_F77_COMPS],
    1411 [case $build in
    1412   *-cygwin* | *-mingw*)
    1413      if test "$enable_msvc" = yes ; then
    1414        coin_f77_comps="ifort fl32 compile_f2c gfortran g95 g77"
    1415      else
    1416        coin_f77_comps="gfortran ifort g95 g77 fl32 compile_f2c"
    1417      fi ;;
    1418   *-*-solaris*)
    1419      coin_f77_comps="f95 f90 g95 f77 xlf_r fort77 gfortran g77 pgf90 pgf77 ifort ifc frt af77" ;;
    1420   *-linux-gnu*)
    1421      coin_f77_comps="gfortran ifort g95 fort77 f77 g77 pgf90 pgf77 ifc frt af77 xlf_r" ;;
    1422   *) coin_f77_comps="xlf_r fort77 gfortran ifort g95 f77 g77 pgf90 pgf77 ifc frt af77" ;;
    1423  esac
    1424 ])
    1425 
    1426 ###########################################################################
    1427 #                          COIN_INIT_AUTOMAKE                             #
    1428 ###########################################################################
    1429 
    1430 # This macro calls the regular INIT_AUTOMAKE and MAINTAINER_MODE
    1431 # macros, and defines additional variables and makefile conditionals,
    1432 # that are used in the maintainer parts of the makfile.  It also
    1433 # checks if the correct versions of the autotools are used.
    1434 #
    1435 # This also defines the AC_SUBST variables:
    1436 # abs_source_dir     absolute path to source code for this package
    1437 # abs_bin_dir        absolute path to the directory where binaries are
    1438 #                    going to be installed (prefix/bin)
    1439 # abs_lib_dir        absolute path to the directory where libraries are
    1440 #                    going to be installed (prefix/lib)
    1441 # abs_include_dir    absolute path to the directory where the header files
    1442 #                    are installed (prefix/include)
    1443 
    1444 AC_DEFUN([AC_COIN_INIT_AUTOMAKE],
    1445 [AC_REQUIRE([AC_PROG_EGREP])
    1446 AC_REQUIRE([AC_PROG_LN_S])
    1447 
    1448 # AC_MSG_NOTICE([Beginning automake initialisation.])
    1449 # Stuff for automake
    1450 AM_INIT_AUTOMAKE
    1451 AM_MAINTAINER_MODE
    1452 
    1453 coin_have_externals=no
    1454 if test "$enable_maintainer_mode" = yes; then
    1455 
    1456   # If maintainer mode is chosen, we make sure that the correct versions
    1457   # of the tools are used, and that we know where libtool.m4 is (to
    1458   # recreate acinclude.m4)
    1459 
    1460   AC_SUBST(LIBTOOLM4)
    1461   LIBTOOLM4=
    1462   # Normally, $HOME
    1463   AUTOTOOLS_DFLT=$HOME
    1464 
    1465   AC_CACHE_CHECK([whether we are using the correct autotools],
    1466                  [ac_cv_use_correct_autotools],
    1467                  [ac_cv_use_correct_autotools=check])
    1468 
    1469   if test $ac_cv_use_correct_autotools = check; then
    1470     ac_cv_use_correct_autotools=yes
    1471     # Check if we have autoconf
    1472     AC_CHECK_PROG([have_autoconf],[autoconf],[yes],[no])
    1473     if test $have_autoconf = no; then
    1474       AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find autoconf in your path.])
    1475     fi
    1476 
    1477     # Check whether autoconf is the correct version
    1478     correct_version='2.59'
    1479     grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
    1480     AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of autoconf])
    1481     autoconf --version > confauto.out 2>&1
    1482     if $EGREP $grep_version confauto.out >/dev/null 2>&1; then
    1483       AC_MSG_RESULT([yes])
    1484     else
    1485       rm -f confauto.out
    1486       AC_MSG_RESULT([no])
    1487       AC_MSG_ERROR([You don't have the correct version of autoconf as the first one in your path.])
    1488     fi
    1489     rm -f confauto.out
    1490 
    1491     # Check if the executable autoconf is picked up from the correct location
    1492     AC_MSG_CHECKING([whether autoconf is coming from the correct location])
    1493     autoconf_dir=`which autoconf | sed -e 's=/autoconf=='`
    1494     autoconf_dir=`cd $autoconf_dir; pwd`
    1495     if test x$AUTOTOOLS_DIR = x; then
    1496       want_dir=$AUTOTOOLS_DFLT/bin
    1497     else
    1498       want_dir=$AUTOTOOLS_DIR/bin
    1499     fi
    1500     if test $autoconf_dir = `cd $want_dir; pwd`; then
    1501       AC_MSG_RESULT([yes])
    1502     else
    1503       rm -f confauto.out
    1504       AC_MSG_RESULT([no])
    1505       AC_MSG_ERROR([The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.])
    1506     fi
    1507 
    1508     # Check if we have automake
    1509     AC_CHECK_PROG([have_automake],[automake],[yes],[no])
    1510     if test $have_automake = no; then
    1511       AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find automake in your path.])
    1512     fi
    1513  
    1514     # Check whether automake is the correct version
    1515     correct_version='1.9.6'
    1516     grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
    1517     AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of automake])
    1518     automake --version > confauto.out 2>&1
    1519     if $EGREP $grep_version confauto.out >/dev/null 2>&1; then
    1520       AC_MSG_RESULT([yes])
    1521     else
    1522       rm -f confauto.out
    1523       AC_MSG_RESULT([no])
    1524       AC_MSG_ERROR([You don't have the correct version of automake as the first one in your path.])
    1525     fi
    1526     rm -f confauto.out
    1527 
    1528     # Check if the executable automake is picked up from the correct location
    1529     AC_MSG_CHECKING([whether automake is coming from the correct location])
    1530     automake_dir=`which automake | sed -e 's=/automake=='`
    1531     automake_dir=`cd $automake_dir; pwd`
    1532     if test x$AUTOTOOLS_DIR = x; then
    1533       want_dir=$AUTOTOOLS_DFLT/bin
    1534     else
    1535       want_dir=$AUTOTOOLS_DIR/bin
    1536     fi
    1537     if test $automake_dir = `cd $want_dir; pwd`; then
    1538       AC_MSG_RESULT([yes])
    1539     else
    1540       rm -f confauto.out
    1541       AC_MSG_RESULT([no])
    1542       AC_MSG_ERROR([The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.])
    1543     fi
    1544 
    1545     # Check if this is the correct version of libtool (with escaped dots)
    1546     if test x$AUTOTOOLS_DIR = x; then
    1547       want_dir=$AUTOTOOLS_DFLT/share
    1548     else
    1549       want_dir=$AUTOTOOLS_DIR/share
    1550     fi
    1551     correct_version='1.5.22'
    1552     grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
    1553     AC_COIN_CHECK_FILE([$want_dir/libtool/ltmain.sh],
    1554                        [have_ltmain=yes],
    1555                        [have_ltmain=no])
    1556     AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of libtool.])
    1557     if test $have_ltmain = yes; then
    1558     if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then
    1559         AC_MSG_RESULT([yes])
    1560       else
    1561         AC_MSG_RESULT([no])
    1562         AC_MSG_ERROR([You don't have the correct version of libtool.])
    1563       fi
    1564     else
    1565       AC_MSG_RESULT([no])
    1566       AC_MSG_ERROR([I cannot find the ltmain.sh file.])
    1567     fi
    1568   fi
    1569 
    1570   # Check if we can find the libtool file
    1571   if test x$AUTOTOOLS_DIR = x; then
    1572     want_dir=$AUTOTOOLS_DFLT/share
    1573   else
    1574     want_dir=$AUTOTOOLS_DIR/share
    1575   fi
    1576   AC_COIN_CHECK_FILE([$want_dir/aclocal/libtool.m4],
    1577                      [LIBTOOLM4="$want_dir/aclocal/libtool.m4"],
    1578                      [AC_MSG_ERROR([I cannot find the libtool.m4 file.])])
    1579 
    1580   # Check if we have an Dependencies file
    1581   if test -r $srcdir/Dependencies; then
    1582     coin_have_externals=yes
    1583   fi
    1584   # Check if subversion is installed and understands https
    1585   AC_CHECK_PROG([have_svn],[svn],[yes],[no])
    1586   if test x$have_svn = xyes; then
    1587     AC_CACHE_CHECK([whether svn understands https],
    1588                    [ac_cv_svn_understands_https],
    1589                    [svn --version > confauto.out 2>&1
    1590                     if $EGREP https confauto.out >/dev/null 2>&1; then
    1591                       ac_cv_svn_understands_https=yes
    1592                     else
    1593                       ac_cv_svn_understands_https=no
    1594                       have_svn=no
    1595                       ac_cv_prog_have_svn=no
    1596                     fi
    1597                     rm -f confauto.out])
    1598   fi
    1599 
    1600   # Find the location of the BuildTools directory
    1601   BUILDTOOLSDIR=
    1602   if test -r $srcdir/BuildTools/coin.m4; then
    1603     BUILDTOOLSDIR=$srcdir/BuildTools
    1604   else
    1605     if test -r $srcdir/../BuildTools/coin.m4; then
    1606       BUILDTOOLSDIR=$srcdir/../BuildTools
    1607     else
    1608       if test -r $srcdir/../../BuildTools/coin.m4; then
    1609         BUILDTOOLSDIR=$srcdir/../../BuildTools
    1610       else
    1611         AC_MSG_ERROR(Cannot find the BuildTools directory, better disable maintainer mode.)
    1612       fi
    1613     fi
    1614   fi
    1615   AC_SUBST(BUILDTOOLSDIR)
    1616  
    1617   # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools
    1618   if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then
    1619     $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools"
    1620   fi
    1621 
    1622   # The following variable is set to the name of the directory where
    1623   # the autotool scripts are located
    1624   AC_SUBST(AUX_DIR)
    1625   AUX_DIR=$ac_aux_dir
    1626 fi
    1627 
    1628 # helpful variable for the base directory of this package
    1629 abs_source_dir=`cd $srcdir; pwd`
    1630 AC_SUBST(abs_source_dir)
    1631 
    1632 # Stuff for example Makefiles
    1633 if test x$prefix = xNONE; then
    1634   full_prefix=$ac_default_prefix
    1635 else
    1636   full_prefix=$prefix
    1637 fi
    1638 full_prefix=`cd $full_prefix ; pwd`
    1639 AC_SUBST(abs_lib_dir)
    1640 abs_lib_dir=$full_prefix/lib
    1641 AC_SUBST(abs_include_dir)
    1642 abs_include_dir=$full_prefix/include
    1643 AC_SUBST(abs_bin_dir)
    1644 abs_bin_dir=$full_prefix/bin
    1645 
    1646 AM_CONDITIONAL(HAVE_EXTERNALS,
    1647                test $coin_have_externals = yes && test x$have_svn = xyes)
    1648 
    1649 # AC_MSG_NOTICE([End automake initialisation.])
    1650 
    1651 ]) # AC_COIN_INIT_AUTOMAKE
    1652 
    1653 ###########################################################################
    1654 #                          COIN_CREATE_LIBTOOL                            #
    1655 ###########################################################################
    1656 
    1657 # This does all the tests necessary to create the libtool script in the
    1658 # package base directory.  If this is used, then the COIN_INIT_AUTO_TOOLS
    1659 # test in the subdirectories will be able to skip the libtool tests and
    1660 # just use the one in the package base directory.
    1661 
    1662 m4_define([AC_COIN_CREATE_LIBTOOL],
    1663 [AC_CANONICAL_BUILD
    1664 
    1665 # Check if user wants to produce debugging code
    1666 AC_COIN_DEBUG_COMPILE
    1667 
    1668 # Get the name of the C compiler and appropriate compiler options
    1669 AC_COIN_PROG_CC
    1670 
    1671 # Get the name of the C++ compiler and appropriate compiler options
    1672 AC_COIN_PROG_CXX
    1673 
    1674 # Get the name of the Fortran compiler and appropriate compiler options
    1675 AC_COIN_PROG_F77
    1676 
    1677 # Initialize automake and libtool
    1678 # AC_MSG_NOTICE([Calling INIT_AUTO_TOOLS from CREATE_LIBTOOL.])
    1679 AC_COIN_INIT_AUTO_TOOLS
    1680 # AC_MSG_NOTICE([Finished INIT_AUTO_TOOLS from CREATE_LIBTOOL.])
    1681 ])
    1682 
    1683 ###########################################################################
    1684 #                         COIN_INIT_AUTO_TOOLS                            #
    1685 ###########################################################################
    1686 
    1687 # Initialize the auto tools automake and libtool, with all
    1688 # modifications we want for COIN packages.
    1689 #
    1690 # RPATH_FLAGS        link flags for hardcoding path to shared objects
    1691 
    1692 # This is a trick to have this code before AC_COIN_PROG_LIBTOOL
    1693 AC_DEFUN([AC_COIN_DISABLE_STATIC],
    1694 [
    1695 coin_disable_shared=no
    1696 # Test if force_shared has been set
    1697 if test "x$1" = xforce_shared; then
    1698   if test x$enable_shared = xno; then
    1699     AC_MSG_ERROR([Shared libraries are disabled by user, but this is not feasible with the given options])
    1700   fi
    1701   enable_shared=yes;
    1702 else
    1703   # On Cygwin and AIX, building DLLs doesn't work
    1704   case $build in
    1705     *-cygwin* | *-mingw*)
    1706       coin_disable_shared=yes
    1707       if test x"$enable_shared" = xyes; then
    1708         case "$CC" in
    1709           clang* )
    1710             AC_MSG_WARN([DLL building not supported. I'm disabling your choice.])
    1711             ;;
    1712           cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    1713             AC_MSG_NOTICE([DLL building not supported, but will build with -MD(d) instead of -MT(d).])
    1714             ;;
    1715           *gcc*)
    1716             if test x"$enable_dependency_linking" = xyes; then
    1717               coin_disable_shared=no
    1718             else
    1719               AC_MSG_WARN([To build shared libraries with gcc on CYGWIN or MSys, use --enable-dependency-linking])
    1720             fi
    1721             ;;
    1722           *)
    1723             AC_MSG_WARN([DLL building not supported. I'm disabling your choice.])
    1724             ;;
    1725         esac
    1726       fi
    1727     ;;
    1728     *-aix*)
    1729       coin_disable_shared=yes
    1730       platform=AIX
    1731       if test x"$enable_shared" = xyes; then
    1732         AC_MSG_WARN([Shared objects are not supported. I'm disabling your choice.])
    1733       fi
    1734     ;;
    1735   esac
    1736 fi
    1737 if test x"$coin_disable_shared" = xyes; then
    1738   if test x"$enable_shared" = xyes; then
    1739     :
    1740   else
    1741     # we don't disable shared, because it was not selected anyway
    1742     coin_disable_shared=no
    1743   fi
    1744   enable_shared=no
    1745 fi
    1746 # By default, we only want the shared objects to be compiled
    1747 AC_DISABLE_STATIC
    1748 ])
    1749 
    1750 m4_define([AC_COIN_INIT_AUTO_TOOLS],
    1751 [{AC_BEFORE([AC_COIN_PROG_CXX],[$0])
    1752 AC_BEFORE([AC_COIN_PROG_CC],[$0])
    1753 AC_BEFORE([AC_COIN_PROG_F77],[$0])
    1754 
    1755 # START
    1756 AC_COIN_DISABLE_STATIC([$1])
    1757 
    1758 # Initialize automake
    1759 AC_COIN_INIT_AUTOMAKE
    1760 
    1761 LIBTOOL=
    1762 if test -f ../libtool; then
    1763   coin_config_dir=..
    1764   LIBTOOL='$(SHELL) $(top_builddir)/../libtool'
    1765 fi
    1766 if test "x$LIBTOOL" = x; then
    1767   if test -f ../../libtool; then
    1768     coin_config_dir=../..
    1769     LIBTOOL='$(SHELL) $(top_builddir)/../../libtool'
    1770   fi
    1771 fi
    1772 
    1773 if test "x$LIBTOOL" = x; then
    1774 # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).])
    1775   # Stuff for libtool
    1776   AC_COIN_PROG_LIBTOOL
    1777 # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.])
    1778   # set RPATH_FLAGS to the compiler link flags required to hardcode location
    1779   # of the shared objects
    1780   AC_COIN_RPATH_FLAGS([$abs_lib_dir])
    1781 
    1782 else
    1783 
    1784   AC_MSG_NOTICE([Using libtool script in directory $coin_config_dir])
    1785   # get all missing information from the config.log file
    1786 
    1787   # output variables and defines
    1788   as_save_IFS=$IFS
    1789   IFS='
    1790 '
    1791   for oneline in `cat $coin_config_dir/config.status`; do
    1792     case "$oneline" in
    1793          # First some automake conditionals
    1794       s,@am__fastdep* | s,@AR@* | s,@CPP@*  | s,@CPPFLAGS@* | s,@CXXCPP@*  | \
    1795       s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \
    1796       s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \
    1797       s,@ac_c_preproc_warn_flag@* |  s,@ac_cxx_preproc_warn_flag@* )
    1798         command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'`
    1799 #        echo "$command"
    1800         eval "$command"
    1801         ;;
    1802       s,@DEFS@* )
    1803         command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'`
    1804 #        echo "$command"
    1805         eval "$command"
    1806         ;;
    1807     esac
    1808   done
    1809   IFS=$as_save_IFS
    1810 
    1811   # And some defines (assuming here that the packages base dir
    1812   # doesn't have a config.h file
    1813   for word in $defsline; do
    1814 #    echo word $word
    1815     case $word in
    1816       -DHAVE_@<:@A-Z_@:>@*_H=1 | -DSTDC_HEADERS=1 )
    1817         i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'`
    1818 #        echo dd $i
    1819         echo $i >>confdefs.h
    1820         ;;
    1821     esac
    1822   done
    1823 fi
    1824 
    1825 # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.])
    1826 
    1827 AC_ARG_ENABLE([dependency-linking],[],
    1828   [dependency_linking="$enableval"],
    1829   [dependency_linking=no])
    1830 
    1831 # ToDo
    1832 # For now, don't use the -no-undefined flag, since the Makefiles are
    1833 # not yet set up that way.  But we need to fix this, when we want
    1834 # to comile DLLs under Windows.
    1835 if test "$dependency_linking" = yes ;
    1836 then
    1837   LT_LDFLAGS="-no-undefined"
    1838 else
    1839   LT_LDFLAGS=
    1840 fi
    1841 
    1842 AM_CONDITIONAL(DEPENDENCY_LINKING, [test "$dependency_linking" = yes])
    1843 
    1844 # Check if we want to set the library version
    1845 AC_MSG_CHECKING([if library version is set])
    1846 if test x"$coin_libversion" != x; then
    1847   LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion"
    1848   AC_MSG_RESULT([$coin_libversion])
    1849 else
    1850   AC_MSG_RESULT([no])
    1851 fi
    1852 
    1853 AC_SUBST(LT_LDFLAGS)
    1854 
    1855 #END
    1856 }])
    1857 
    1858 ###########################################################################
    1859 #                      COIN_PATCH_LIBTOOL_CYGWIN                          #
    1860 ###########################################################################
    1861 
    1862 # Patches to libtool for cygwin. Lots for cl, a few for GCC.
    1863 # For cl:
    1864 # - cygpath is not correctly quoted in fix_srcfile_path
    1865 # - paths generated for .lib files is not run through cygpath -w
    1866 
    1867 
    1868 AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
    1869 [ case "$CXX" in
    1870     clang* )
    1871       # we assume that libtool patches for CLANG are the same as for GNU compiler - correct???
    1872       AC_MSG_NOTICE(Applying patches to libtool for CLANG compiler)
    1873       sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
    1874           -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
    1875           -e 's|libext="lib"|libext="a"|' \
    1876       libtool > conftest.bla
    1877       ;;
    1878     cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    1879       AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
    1880       sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
    1881           -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
    1882           -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
    1883           -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
    1884           -e 's%lib /OUT:%lib -OUT:%' \
    1885           -e "s%cygpath -w%$CYGPATH_W%" \
    1886           -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$[]1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$[]1"'); done%' \
    1887           -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$[]1"') '"$mydos2unix"'%' \
    1888           -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
    1889           -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
    1890           -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \
    1891       libtool > conftest.bla
    1892       ;;
    1893     *)
    1894       AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
    1895       sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
    1896           -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
    1897           -e 's|libext="lib"|libext="a"|' \
    1898       libtool > conftest.bla
    1899       ;;
    1900   esac
    1901   mv conftest.bla libtool
    1902   chmod 755 libtool
    1903 ]) # COIN_PATCH_LIBTOOL_CYGWIN
    1904 
    1905 ###########################################################################
    1906 #                    COIN_PATCH_LIBTOOL_SOLARIS                           #
    1907 ###########################################################################
    1908 # If we want to do a 64-bit build with GCC on Solaris, the system search
    1909 # libraries need to point to 64-bit subdirectories. If they do not already do
    1910 # that, fix them. This patch is evolving, as are GCC compilers.  GCC 4.2.1
    1911 # reports the correct search list, given the correct call. GCC 4.1.1 does not.
    1912 # `Correct call' means -m64 is specified. `Correct search list' seems to amount
    1913 # to prepending the list of 64-bit subdirectories to the 32-bit directories.
    1914 # Both SPARC and x86 have this issue, but a different hardware id string is
    1915 # required depending on the underlying CPU. The macro executes isainfo to get
    1916 # the string. This will fail, of course, if we're cross-compiling. The
    1917 # alternative is to fail on a regular basis each time a new CPU identifier is
    1918 # needed. This macro will also fail if the search list reported with
    1919 # -print-search-dirs differs between the C, C++, and Fortran compilers; each
    1920 # have their own setting in libtool.  If GCC reports the correct search list
    1921 # given the -m64 flag, the best solution is to define CC='gcc -m64', and
    1922 # similarly for CXX, F77, so that libtool will make the correct call.
    1923 ###########################################################################
    1924 AC_DEFUN([AC_COIN_PATCH_LIBTOOL_SOLARIS],
    1925 [ if test "$GCC" = yes && \
    1926      (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then
    1927     hdwisa=`isainfo | sed -e 's/\(@<:@^ @:>@*\) .*$/\1/'`
    1928     if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then
    1929       AC_MSG_NOTICE([Applying patches to libtool for 64-bit GCC compilation])
    1930       fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'`
    1931       fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'`
    1932       if `echo "$fixlibtmp" | $EGREP -v $hdwisa  >/dev/null 2>&1` ; then
    1933         # AC_MSG_NOTICE(Compensating for broken gcc)
    1934         for lib in $fixlibtmp ; do
    1935           if test -d "${lib}${hdwisa}" ; then
    1936             syslibpath64="$syslibpath64 ${lib}${hdwisa}/"
    1937           fi
    1938         done
    1939         syslibpath64="${syslibpath64} ${fixlibtmp}"
    1940       else
    1941         syslibpath64="$fixlibtmp"
    1942       fi
    1943       sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla
    1944       mv conftest.bla libtool
    1945       chmod 755 libtool 
    1946     fi
    1947     # AC_MSG_NOTICE(Result is )
    1948     # $EGREP 'sys_lib_search_path_spec=' libtool
    1949   fi ]) # COIN_PATCH_LIBTOOL_SOLARIS
    1950 
    1951 ###########################################################################
    1952 #                           COIN_PROG_LIBTOOL                             #
    1953 ###########################################################################
    1954 
    1955 # Setup the libtool stuff together with any modifications to make it
    1956 # work on additional platforms
    1957 
    1958 AC_DEFUN([AC_COIN_PROG_LIBTOOL],
    1959 [# No longer needed now that CPPFLAGS is correctly set -- lh, 061214 --
    1960  # AC_REQUIRE([AC_COIN_DLFCN_H])
    1961 
    1962 # NEW: If libtool exists in the directory higher up, we use that one
    1963 #      instead of creating a new one
    1964 
    1965 # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED
    1966 # out in front of this macro body. You'll notice that LIBTOOL is already
    1967 # defined here.  We'll have to count on this macro not being called if libtool
    1968 # already exists, or at least move the libtool fixes outside the conditional.
    1969 # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".])
    1970 # This test is therefore removed.  -- lh, 061214 --
    1971 # if test "x$LIBTOOL" = x; then
    1972 
    1973 # AC_MSG_NOTICE([Calling PROG_LIBTOOL.])
    1974   AC_PROG_LIBTOOL
    1975 # AC_MSG_NOTICE([Finished PROG_LIBTOOL.])
    1976   AC_SUBST(ac_c_preproc_warn_flag)
    1977   AC_SUBST(ac_cxx_preproc_warn_flag)
    1978 
    1979   AC_MSG_NOTICE([Build is "$build".])
    1980   mydos2unix='| dos2unix'
    1981   case $build in
    1982     *-mingw*)
    1983       CYGPATH_W=echo
    1984       mydos2unix=
    1985       ;;
    1986   esac
    1987 
    1988   case $build in
    1989     # Here we need to check if -m32 is specified.  If so, we need to correct
    1990     # sys_lib_search_path_spec
    1991     *-cygwin* | *-mingw*)
    1992       AC_COIN_PATCH_LIBTOOL_CYGWIN
    1993       ;;
    1994     *x86_64-*)
    1995       if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then
    1996         AC_MSG_NOTICE(Applying patches to libtool for 32bit compilation)
    1997         sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla
    1998         mv conftest.bla libtool
    1999         chmod 755 libtool 
    2000       fi
    2001       ;;
    2002 
    2003     *-solaris*)
    2004       AC_COIN_PATCH_LIBTOOL_SOLARIS
    2005       ;;
    2006     # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro.
    2007     *-darwin*)
    2008       AC_MSG_NOTICE(Applying patches to libtool for Darwin)
    2009       sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \
    2010         -e 's/ -dynamiclib / -dynamiclib -single_module /g' \
    2011       libtool > conftest.bla
    2012 
    2013       mv conftest.bla libtool
    2014       chmod 755 libtool
    2015       ;;
    2016   esac
    2017 # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of
    2018 # the macro. -- lh, 061214 --
    2019 # fi
    2020 
    2021 # AC_MSG_NOTICE([End libtool initialisation.])
    2022 ]) # AC_COIN_PROG_LIBTOOL
    2023 
    2024 # This is a trick to force the check for the dlfcn header to be done before
    2025 # the checks for libtool
    2026 # No longer needed now that CPPFLAGS is correctly set.  -- lh, 061214 --
    2027 # ACDEFUN([AC_COIN_DLFCN_H],
    2028 # [AC_LANG_PUSH(C)
    2029 # AC_COIN_CHECK_HEADER([dlfcn.h])
    2030 # AC_LANG_POP(C)
    2031 # ]) # AC_COIN_DLFCN_H
    2032 
    2033 ###########################################################################
    2034 #                            COIN_RPATH_FLAGS                             #
    2035 ###########################################################################
    2036 
    2037 # This macro, in case shared objects are used, defines a variable
    2038 # RPATH_FLAGS that can be used by the linker to hardwire the library
    2039 # search path for the given directories.  This is useful for example
    2040 # Makefiles
    2041 
    2042 AC_DEFUN([AC_COIN_RPATH_FLAGS],
    2043 [RPATH_FLAGS=
    2044 
    2045 if test $enable_shared = yes; then
    2046   case $build in
    2047     *-linux-*)
    2048       if test "$GXX" = "yes"; then
    2049         RPATH_FLAGS=
    2050         for dir in $1; do
    2051           RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir"
    2052         done
    2053       fi ;;
    2054     *-darwin*)
    2055         RPATH_FLAGS=nothing ;;
    2056     *-ibm-*)
    2057       case "$CXX" in
    2058       xlC* | */xlC* | mpxlC* | */mpxlC*)
    2059         RPATH_FLAGS=nothing ;;
    2060       esac ;;
    2061     *-hp-*)
    2062         RPATH_FLAGS=nothing ;;
    2063     *-mingw32)
    2064         RPATH_FLAGS=nothing ;;
    2065     *-*-solaris*)
    2066         RPATH_FLAGS=
    2067         for dir in $1; do
    2068           RPATH_FLAGS="$RPATH_FLAGS -R$dir"
    2069         done
    2070   esac
    2071 
    2072   if test "$RPATH_FLAGS" = ""; then
    2073     AC_MSG_WARN([Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries.  The test examples might not work if you link against shared objects.  You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually.])
    2074   fi
    2075   if test "$RPATH_FLAGS" = "nothing"; then
    2076     RPATH_FLAGS=
    2077   fi
    2078 fi
    2079 
    2080 AC_SUBST(RPATH_FLAGS)
    2081 ]) # AC_COIN_RPATH_FLAGS
    2082 
    2083 ###########################################################################
    2084 #                        COIN_LINK_INPUT_CMD                              #
    2085 ###########################################################################
    2086 
    2087 # This macro determines which command should be used to "link" files
    2088 # that are input to the generated executables.  On Windows, the codes
    2089 # using the native Windows system libraries, cannot understand symbolic
    2090 # links, and a copy should be used instead of 'ln -s'.
    2091 # The result is stored in coin_link_input_cmd
    2092 
    2093 AC_DEFUN([AC_COIN_LINK_INPUT_CMD],
    2094 [AC_REQUIRE([AC_PROG_LN_S])
    2095 AC_BEFORE([AC_COIN_PROG_CC], [$0])
    2096 AC_BEFORE([AC_COIN_ENABLE_MSVC], [$0])
    2097 
    2098 AC_MSG_CHECKING([which command should be used to link input files])
    2099 coin_link_input_cmd="$LN_S"
    2100 case "$CC" in
    2101   clang* ) ;;
    2102   cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    2103     coin_link_input_cmd=cp ;;
    2104 esac
    2105 AC_MSG_RESULT($coin_link_input_cmd)
    2106 ])
    2107 
    2108 ###########################################################################
    2109 #                              COIN_FINALIZE                              #
    2110 ###########################################################################
    2111 
    2112 # This macro should be called at the very end of the configure.ac file.
    2113 # It creates the output files (by using AC_OUTPUT), and might do some other
    2114 # things (such as generating links to data files in a VPATH configuration).
    2115 # It also prints the "success" message.
    2116 # Note: If the variable coin_skip_ac_output is set to yes, then no output
    2117 # files are written.
    2118 
    2119 AC_DEFUN([AC_COIN_FINALIZE],
    2120 [
    2121 AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
    2122 if test x$coin_skip_ac_output != xyes; then
    2123 
    2124   # library extension
    2125   AC_SUBST(LIBEXT)
    2126   case "$CC" in
    2127     clang* )
    2128          LIBEXT=a ;;
    2129     cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    2130          LIBEXT=lib ;;
    2131       *) LIBEXT=a ;;
    2132   esac
    2133 
    2134   # Define VPATH_DISTCLEANFILES to be everything that needs to be
    2135   # cleaned for distclean in a vpath configuration
    2136   AC_SUBST(VPATH_DISTCLEANFILES)
    2137   VPATH_DISTCLEANFILES="$coin_vpath_link_files"
    2138 
    2139   # Take out subdirectories if their configuration concluded that they
    2140   # don't need to be compiled
    2141   if test x"$coin_ac_skip_subdirs" != x; then
    2142     new_subdirs=
    2143     for i in $subdirs; do
    2144       skipme=no
    2145       for j in $coin_ac_skip_subdirs; do
    2146         if test $i = $j; then
    2147           skipme=yes;
    2148         fi
    2149       done
    2150       if test $skipme = no; then
    2151         new_subdirs="$new_subdirs $i"
    2152       fi
    2153     done
    2154     subdirs="$new_subdirs"
    2155   fi
    2156 
    2157   # need to come before AC_OUTPUT
    2158   if test x$coin_projectdir != xyes; then
    2159     # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects
    2160     echo $coin_subdirs > coin_subdirs.txt
    2161   else
    2162     # substitute for OBJDIR, needed to setup .pc file for uninstalled project
    2163     ABSBUILDDIR="`pwd`"
    2164     AC_SUBST(ABSBUILDDIR)
    2165   fi
    2166  
    2167   AC_OUTPUT
    2168 
    2169   if test x"$coin_vpath_link_files" = x; then : ; else
    2170     lnkcmd="$coin_link_input_cmd"
    2171     if test "$lnkcmd" = cp; then
    2172       AC_MSG_NOTICE(Copying data files for VPATH configuration)
    2173     else
    2174       AC_MSG_NOTICE(Creating VPATH links for data files)
    2175     fi
    2176     for file in $coin_vpath_link_files; do
    2177       dir=`AS_DIRNAME(["./$file"])`
    2178       if test -d $dir; then : ; else
    2179         AS_MKDIR_P($dir)
    2180       fi
    2181       rm -f $file
    2182       $lnkcmd $abs_source_dir/$file $file
    2183     done
    2184   fi
    2185 
    2186   AC_MSG_NOTICE([In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting])
    2187   if test x$coin_projectdir = xyes; then
    2188     AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful])
    2189   else
    2190     AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful])
    2191   fi
    2192 else
    2193   AC_MSG_NOTICE([No configuration of $PACKAGE_NAME necessary])
    2194 fi
    2195 
    2196 ]) #AC_COIN_FINALIZE
    2197 
    2198 ###########################################################################
    2199 #                             COIN_VPATH_LINK                             #
    2200 ###########################################################################
    2201 
    2202 # This macro queues source files that need to be available in the build
    2203 # directory. In a VPATH configuration, the files will be made available by
    2204 # symbolic link or copy (when the platform does not support links). The list
    2205 # is processed by COIN_FINALIZE. The parameter is a whitespace-separated
    2206 # list of files.
    2207 
    2208 AC_DEFUN([AC_COIN_VPATH_LINK],
    2209 [
    2210 AC_REQUIRE([AC_COIN_CHECK_VPATH])
    2211 # Allow for newlines in the parameter
    2212 if test $coin_vpath_config = yes; then
    2213   cvl_tmp="$1"
    2214   for file in $cvl_tmp ; do
    2215     coin_vpath_link_files="$coin_vpath_link_files $file"
    2216   done
    2217 fi
    2218 ]) #AC_COIN_VPATH_LINK
    2219 
    2220 ###########################################################################
    2221 #                       COIN_ENABLE_GNU_PACKAGES                          #
    2222 ###########################################################################
    2223 
    2224 # This macro defined the --enable-gnu-packages flag.  This can be used
    2225 # to check if a user wants to compile GNU packges (such as readline)
    2226 # into the executable.  By default, GNU packages are disabled.
    2227 # This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES
    2228 
    2229 AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES],
    2230 [AC_ARG_ENABLE([gnu-packages],
    2231                [AC_HELP_STRING([--enable-gnu-packages],
    2232                                [compile with GNU packages (disabled by default)])],
    2233                [coin_enable_gnu=$enableval],
    2234                [coin_enable_gnu=no])
    2235 ]) # AC_COIN_ENABLE_GNU_PACKAGES
    2236 
    2237 #######################################################################
    2238 #                           COIN_CHECK_LIBM                           #
    2239 #######################################################################
    2240 
    2241 # For a (space separated) list of arguments X, this macro adds the flags
    2242 # for linking against the math library to a X_LIBS and X_PCLIBS.
    2243 
    2244 AC_DEFUN([AC_COIN_CHECK_LIBM],
    2245 [AC_BEFORE([AC_COIN_PROG_CC],[$0])
    2246 
    2247 if test $coin_cc_is_cl != true ; then
    2248   coin_foreach_w([myvar], [$1], [
    2249     m4_toupper(myvar)_LIBS="-lm $m4_toupper(myvar)_LIBS"
    2250     m4_toupper(myvar)_PCLIBS="-lm $m4_toupper(myvar)_PCLIBS"
    2251     m4_toupper(myvar)_LIBS_INSTALLED="-lm $m4_toupper(myvar)_LIBS_INSTALLED"
    2252   ])
    2253 fi
    2254 
    2255 ]) # AC_COIN_CHECK_LIBM
    2256 
    2257 ###########################################################################
    2258 #                           COIN_CHECK_GNU_ZLIB                           #
    2259 ###########################################################################
    2260 
    2261 # This macro checks for the libz library.  If found, it sets the automake
    2262 # conditional COIN_HAS_ZLIB and defines the C preprocessor variable
    2263 # COIN_HAS_ZLIB.  Further, for a (space separated) list of arguments X,
    2264 # it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
    2265 
    2266 # TODO the macro name should be changed to AC_COIN_CHECK_ZLIB
    2267 
    2268 AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB],
    2269 [
    2270 AC_BEFORE([AC_COIN_PROG_CXX],[$0])
    2271 AC_BEFORE([AC_COIN_PROG_CC],[$0])
    2272 AC_BEFORE([AC_COIN_PROG_F77],[$0])
    2273 AC_BEFORE([$0],[AC_COIN_FINALIZE])
    2274 
    2275 coin_has_zlib=no
    2276 
    2277 AC_ARG_ENABLE([zlib],
    2278               [AC_HELP_STRING([--disable-zlib],[do not compile with compression library zlib])],
    2279               [coin_enable_zlib=$enableval],
    2280               [coin_enable_zlib=yes])
    2281 
    2282 if test $coin_enable_zlib = yes; then
    2283   AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes])
    2284 
    2285   if test $coin_has_zlib = yes; then
    2286     AC_CHECK_LIB([z],[gzopen],[:],[coin_has_zlib=no])
    2287   fi
    2288 
    2289   if test $coin_has_zlib = yes; then
    2290     coin_foreach_w([myvar], [$1], [
    2291                     m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS"
    2292                     m4_toupper(myvar)_PCLIBS="-lz $m4_toupper(myvar)_PCLIBS"
    2293                     m4_toupper(myvar)_LIBS_INSTALLED="-lz $m4_toupper(myvar)_LIBS_INSTALLED"
    2294                    ])
    2295     AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
    2296   fi
    2297 fi
    2298 
    2299 AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes)
    2300 ]) # AC_COIN_CHECK_GNU_ZLIB
    2301 
    2302 
    2303 ###########################################################################
    2304 #                          COIN_CHECK_GNU_BZLIB                           #
    2305 ###########################################################################
    2306 
    2307 # This macro checks for the libbz2 library.  If found, it defines the C
    2308 # preprocessor variable COIN_HAS_BZLIB.  Further, for a (space separated) list
    2309 # of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
    2310 
    2311 # TODO the macro name should be changed to AC_COIN_CHECK_BZLIB
    2312 
    2313 AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB],
    2314 [
    2315 AC_BEFORE([AC_COIN_PROG_CXX],[$0])
    2316 AC_BEFORE([AC_COIN_PROG_CC],[$0])
    2317 AC_BEFORE([AC_COIN_PROG_F77],[$0])
    2318 AC_BEFORE([$0],[AC_COIN_FINALIZE])
    2319 
    2320 AC_ARG_ENABLE([bzlib],
    2321               [AC_HELP_STRING([--disable-bzlib],[do not compile with compression library bzlib])],
    2322               [coin_enable_bzlib=$enableval],
    2323               [coin_enable_bzlib=yes])
    2324 
    2325 coin_has_bzlib=no
    2326 if test $coin_enable_bzlib = yes; then
    2327   AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes])
    2328 
    2329   if test $coin_has_bzlib = yes; then
    2330     AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],[:],[coin_has_bzlib=no])
    2331   fi
    2332 
    2333   if test $coin_has_bzlib = yes; then
    2334     coin_foreach_w([myvar], [$1], [
    2335                     m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS"
    2336                     m4_toupper(myvar)_PCLIBS="-lbz2 $m4_toupper(myvar)_PCLIBS"
    2337                     m4_toupper(myvar)_LIBS_INSTALLED="-lbz2 $m4_toupper(myvar)_LIBS_INSTALLED"
    2338                   ])
    2339     AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
    2340   fi
    2341 fi
    2342 ]) # AC_COIN_CHECK_GNU_BZLIB
    2343 
    2344 
    2345 ###########################################################################
    2346 #                         COIN_CHECK_GNU_READLINE                         #
    2347 ###########################################################################
    2348 
    2349 # This macro checks for GNU's readline.  It verifies that the header
    2350 # readline/readline.h is available, and that the -lreadline library
    2351 # contains "readline".  It is assumed that #include <stdio.h> is included
    2352 # in the source file before the #include<readline/readline.h>
    2353 # If found, it defines the C preprocessor variable COIN_HAS_READLINE.
    2354 # Further, for a (space separated) list of arguments X, it adds the
    2355 # linker flag to the variable X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
    2356 
    2357 AC_DEFUN([AC_COIN_CHECK_GNU_READLINE],
    2358 [AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
    2359 AC_BEFORE([AC_COIN_PROG_CXX],[$0])
    2360 AC_BEFORE([AC_COIN_PROG_CC],[$0])
    2361 AC_BEFORE([AC_COIN_PROG_F77],[$0])
    2362 AC_BEFORE([$0],[AC_COIN_FINALIZE])
    2363 
    2364 coin_has_readline=no
    2365 if test $coin_enable_gnu = yes; then
    2366   AC_COIN_CHECK_HEADER([readline/readline.h],
    2367                        [coin_has_readline=yes],[],
    2368                        [#include <stdio.h>])
    2369 
    2370   coin_save_LIBS="$LIBS"
    2371   LIBS=
    2372   # First we check if tputs and friends are available
    2373   if test $coin_has_readline = yes; then
    2374     AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[],
    2375                    [coin_has_readline=no])
    2376   fi
    2377 
    2378   # Now we check for readline
    2379   if test $coin_has_readline = yes; then
    2380     AC_CHECK_LIB([readline],[readline],[:],[coin_has_readline=no])
    2381   fi
    2382 
    2383   if test $coin_has_readline = yes; then
    2384     coin_foreach_w([myvar], [$1], [
    2385                     m4_toupper(myvar)_LIBS="-lreadline $LIBS $m4_toupper(myvar)_LIBS"
    2386                     m4_toupper(myvar)_PCLIBS="-lreadline $LIBS $m4_toupper(myvar)_PCLIBS"
    2387                     m4_toupper(myvar)_LIBS_INSTALLED="-lreadline $LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
    2388                    ])
    2389     AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
    2390   fi
    2391 
    2392   LIBS="$coin_save_LIBS"
    2393 fi
    2394 ]) # AC_COIN_CHECK_GNU_READLINE
    2395 
    2396 ###########################################################################
    2397 #                              COIN_CHECK_GMP                             #
    2398 ###########################################################################
    2399 
    2400 # This macro checks for the gmp library.  If found, it defines the C
    2401 # preprocessor variable COIN_HAS_GMP.  Further, for a (space separated) list
    2402 # of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
    2403 
    2404 AC_DEFUN([AC_COIN_CHECK_GMP],
    2405 [
    2406 AC_BEFORE([AC_COIN_PROG_CXX],[$0])
    2407 AC_BEFORE([AC_COIN_PROG_CC],[$0])
    2408 AC_BEFORE([AC_COIN_PROG_F77],[$0])
    2409 AC_BEFORE([$0],[AC_COIN_FINALIZE])
    2410 
    2411 AC_ARG_ENABLE([gmp],
    2412               [AC_HELP_STRING([--disable-gmp],[do not compile with GNU multiple precision library])],
    2413               [coin_enable_gmp=$enableval],
    2414               [coin_enable_gmp=yes])
    2415 
    2416 coin_has_gmp=no
    2417 if test $coin_enable_gmp = yes; then
    2418   AC_COIN_CHECK_HEADER([gmp.h],[AC_CHECK_LIB([gmp],[__gmpz_init],[coin_has_gmp=yes])])
    2419  
    2420   if test $coin_has_gmp = yes ; then
    2421     coin_foreach_w([myvar], [$1], [
    2422                     m4_toupper(myvar)_LIBS="-lgmp $m4_toupper(myvar)_LIBS"
    2423                     m4_toupper(myvar)_PCLIBS="-lgmp $m4_toupper(myvar)_PCLIBS"
    2424                     m4_toupper(myvar)_LIBS_INSTALLED="-lgmp $m4_toupper(myvar)_LIBS_INSTALLED"
    2425                    ])
    2426     AC_DEFINE([COIN_HAS_GMP],[1],[Define to 1 if GMP is available])
    2427   fi
    2428 fi
    2429 ]) # AC_COIN_CHECK_GMP
     9AC_PREREQ(2.69)
     10
    243011
    243112###########################################################################
     
    244223AC_LANG_PUSH(C++)
    244324
    2444 AC_COIN_CHECK_CXX_CHEADER(math)
    2445 AC_COIN_CHECK_CXX_CHEADER(float)
    2446 AC_COIN_CHECK_CXX_CHEADER(ieeefp)
     25#AC_COIN_CHECK_CXX_CHEADER(math)
     26#AC_COIN_CHECK_CXX_CHEADER(float)
     27#AC_COIN_CHECK_CXX_CHEADER(ieeefp)
     28AC_CHECK_HEADERS([cmath])
     29if test "$ac_cv_header_cmath" != "yes"; then
     30  AC_CHECK_HEADERS([math.h])
     31fi
     32AC_CHECK_HEADERS([cfloat])
     33if test "$ac_cv_header_cfloat" != "yes"; then
     34  AC_CHECK_HEADERS([float.h])
     35fi
     36AC_CHECK_HEADERS([cieeefp])
     37if test "$ac_cv_header_cieeefp" != "yes"; then
     38  AC_CHECK_HEADERS([ieeefp.h])
     39fi
    244740
    244841COIN_C_FINITE=
     
    2540133AC_LANG_PUSH(C++)
    2541134
    2542 AC_COIN_CHECK_CXX_CHEADER(math)
    2543 AC_COIN_CHECK_CXX_CHEADER(float)
    2544 AC_COIN_CHECK_CXX_CHEADER(ieeefp)
     135#AC_COIN_CHECK_CXX_CHEADER(math)
     136#AC_COIN_CHECK_CXX_CHEADER(float)
     137#AC_COIN_CHECK_CXX_CHEADER(ieeefp)
     138AC_CHECK_HEADERS([cmath])
     139if test "$ac_cv_header_cmath" != "yes"; then
     140  AC_CHECK_HEADERS([math.h])
     141fi
     142AC_CHECK_HEADERS([cfloat])
     143if test "$ac_cv_header_cfloat" != "yes"; then
     144  AC_CHECK_HEADERS([float.h])
     145fi
     146AC_CHECK_HEADERS([cieeefp])
     147if test "$ac_cv_header_cieeefp" != "yes"; then
     148  AC_CHECK_HEADERS([ieeefp.h])
     149fi
    2545150
    2546151COIN_C_ISNAN=
     
    2654259AC_LANG_POP(C++)
    2655260])
    2656 
    2657 ###########################################################################
    2658 #                             COIN_DATA_PATH                              #
    2659 ###########################################################################
    2660 
    2661 # This macro defines a preprocessor macro with the absolute path to a
    2662 # subdirectory of Data.  The argument of this macro is the name of the
    2663 # subdirectory (in correct case), and the name of the macro is
    2664 # COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of
    2665 # the directory.  The path ends with a separator ("/" for linux and
    2666 # '\\' for Windows).  The default value for this path can be
    2667 # overwritten with the input variable with the same name
    2668 # (COIN_DATA_DIR_PATH).  At this point we chech only for the
    2669 # $srcdir/../Data subdirectory.
    2670 
    2671 AC_DEFUN([AC_COIN_DATA_PATH],
    2672 [AC_MSG_CHECKING([absolute path to data directory $1])
    2673 
    2674 AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory])
    2675 
    2676 if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then
    2677   m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd`
    2678 fi
    2679 
    2680 # Under Cygwin, use Windows path.  Add separator
    2681 case $build in
    2682   *-cygwin*)
    2683     m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\
    2684     ;;
    2685   *)
    2686     m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/"
    2687     ;;
    2688 esac
    2689 
    2690 if test -d $m4_toupper(COIN_DATA_$1_PATH); then
    2691   AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"],
    2692             [Define to absolute path for Data subdirectory $1])
    2693   AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH))
    2694 else
    2695   AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist)
    2696 fi
    2697 ]) # AC_COIN_DATA_PATH
    2698 
    2699 ###########################################################################
    2700 #                       COIN_LINK_FROM_FILELIST                           #
    2701 ###########################################################################
    2702 
    2703 # This macro creates links (or copies, if necessary) to files listed
    2704 # as content in a text file (second argument) into a target directory
    2705 # (first argument), which is created if it doesn't exist yet.  If s link
    2706 # already exists, nothing happens.
    2707 
    2708 AC_DEFUN([AC_COIN_LINKCOPY_FROM_FILELIST],
    2709 [cmd="$3"
    2710 if test -r $srcdir/$2 ; then
    2711   my_target_dir="$1"
    2712   my_link_files=`cat $srcdir/$2`
    2713   my_dirname=`AS_DIRNAME($2)`
    2714 #  if test -e $my_target_dir; then : ; else
    2715 #    AS_MKDIR_P($my_target_dir)
    2716 #  fi
    2717   for i in $my_link_files; do
    2718     #rm -rf $my_target_dir/$i
    2719     if test -e $my_target_dir/$i; then : ; else
    2720       dirn2=`AS_DIRNAME($my_target_dir/$i)`
    2721       if test -d $dirn2; then : ; else
    2722         AS_MKDIR_P($dirn2)
    2723       fi
    2724       $cmd $abs_source_dir/$my_dirname/$i $my_target_dir/$i
    2725     fi
    2726   done
    2727 else
    2728   AC_MSG_WARN([File list file $2 missing!])
    2729 fi
    2730 ])
    2731 
    2732 AC_DEFUN([AC_COIN_LINK_FROM_FILELIST],
    2733 [
    2734 AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
    2735 echo Creating links in $1 ...
    2736 AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, $coin_link_input_cmd)
    2737 ])
    2738 
    2739 ###########################################################################
    2740 #                       COIN_COPY_FROM_FILELIST                           #
    2741 ###########################################################################
    2742 
    2743 # Like COIN_LINK_FROM_FILELIST, but copies the files.
    2744 
    2745 AC_DEFUN([AC_COIN_COPY_FROM_FILELIST],
    2746 [
    2747 echo Creating copies in $1 ...
    2748 AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, [cp])
    2749 ])
    2750 
    2751 ###########################################################################
    2752 #                          COIN_EXAMPLE_FILES                             #
    2753 ###########################################################################
    2754 
    2755 # This macro determines the names of the example files (using the
    2756 # argument in an "ls" command) and sets up the variables EXAMPLE_FILES
    2757 # and EXAMPLE_CLEAN_FILES.  If this is a VPATH configuration, it also
    2758 # creates soft links to the example files.
    2759 
    2760 AC_DEFUN([AC_COIN_EXAMPLE_FILES],
    2761 [AC_REQUIRE([AC_COIN_CHECK_VPATH])
    2762 AC_REQUIRE([AC_COIN_ENABLE_MSVC])
    2763 AC_REQUIRE([AC_PROG_LN_S])
    2764 
    2765 files=`cd $srcdir; ls $1`
    2766 # We need to do the following loop to make sure that are no newlines
    2767 # in the variable
    2768 for file in $files; do
    2769   EXAMPLE_FILES="$EXAMPLE_FILES $file"
    2770 done
    2771 if test $coin_vpath_config = yes; then
    2772   lnkcmd=
    2773   if test "$enable_msvc" = yes; then
    2774     lnkcmd=cp
    2775   fi
    2776   case "$CC" in
    2777     clang* ) ;;
    2778     cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    2779       lnkcmd=cp ;;
    2780   esac
    2781   if test "x$lnkcmd" = xcp; then
    2782     AC_MSG_NOTICE([Copying example files ($1)])
    2783   else
    2784     AC_MSG_NOTICE([Creating links to the example files ($1)])
    2785     lnkcmd="$LN_S"
    2786   fi
    2787   for file in $EXAMPLE_FILES; do
    2788     rm -f $file
    2789     $lnkcmd $srcdir/$file $file
    2790   done
    2791   EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES $1"
    2792 else
    2793   EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES"
    2794 fi
    2795 
    2796 # In case there are compressed files, we create a variable with the
    2797 # uncompressed names
    2798 EXAMPLE_UNCOMPRESSED_FILES=
    2799 for file in $EXAMPLE_FILES; do
    2800   case $file in
    2801     *.gz)
    2802       EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`"
    2803       ;;
    2804   esac
    2805 done
    2806 
    2807 AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES)
    2808 AC_SUBST(EXAMPLE_FILES)
    2809 AC_SUBST(EXAMPLE_CLEAN_FILES)
    2810 ]) #AC_COIN_EXAMPLE_FILES
    2811 
    2812 ###########################################################################
    2813 #                      COIN_CHECK_USER_LIBRARY                            #
    2814 ###########################################################################
    2815 # This macro sets up usage of a user library with header files. The assumption
    2816 # is that the header file(s) and library do not reside in standard system
    2817 # directories, hence both the include directory and link flags must be
    2818 # specified. There are two mandatory arguments and two optional arguments.
    2819 #
    2820 # The first argument (mandatory) should be a name (LibraryName) for the
    2821 # library.  The second argument (mandatory) should be an abbreviation in
    2822 # upper case letters (LBRY) for the library. Ultimately, the macro will
    2823 # specify two variables, LBRYINCDIR and LBRYLIB, to be substituted in files
    2824 # generated during configuration; a preprocessor symbol COIN_HAS_LBRY; and a
    2825 # matching automake conditional COIN_HAS_LBRY. LBRYINCDIR should specify the
    2826 # directory containing include files for the library. LBRYLIB should specify
    2827 # the flags necessary to link to the library. A variable coin_has_lbry will
    2828 # be set to true or false, as appropriate. A variable lbry_libcheck will be
    2829 # be set to yes or no; no indicates link checks should not be attempted.
    2830 #
    2831 # The macro defines three configure arguments, --with-libraryname-incdir,
    2832 # --with-libraryname-lib, and --disable-libraryname-libcheck, by converting
    2833 # LibraryName to lower case.
    2834 #
    2835 # LBRYINCDIR and LBRYLIB can be specified as environment variables or as
    2836 # part of the configure command using --with-libraryname-incdir and
    2837 # --with-libraryname-lib, respectively. Command line arguments override
    2838 # environment variables.
    2839 #
    2840 # If a third argument is given, it should specify a file in LBRYINCDIR.  The
    2841 # macro will check for the presence of the file. If a fourth argument is given,
    2842 # it should specify a function name, `fname'.  The macro will attempt to link a
    2843 # trivial program containing a parameterless call to the function, `fname()',
    2844 # using the LBRYLIB flags. The link check uses C as the language; this has been
    2845 # adequate to date but has limitations. It is possible to disable the link
    2846 # check by specifying --disable-libraryname-libcheck. This is a workaround for
    2847 # instances where the link check does not work properly, for whatever reason.
    2848 # If you're trying to link to a Fortran library, consider using F77_FUNC or
    2849 # FC_FUNC to obtain a mangled fname appropriate for use from C code. For a C++
    2850 # library, you're on your own unless the library declares some function with
    2851 # extern "C" linkage. Otherwise, you'll have to somehow find the mangled C++
    2852 # name.
    2853 # A fifth argument can be specified to include linker flags that may be required
    2854 # to sucessfully perform the linking check.
    2855 #
    2856 # An optional sixth argument can be given to specify a list of targets.
    2857 # For each target X, the variables X_LIBS and X_PCLIBS will be extended by $LBRYLIB,
    2858 # if the library has been found and seems to work.
    2859 
    2860 AC_DEFUN([AC_COIN_CHECK_USER_LIBRARY],
    2861 [ AC_REQUIRE([AC_COIN_PROJECTDIR_INIT])
    2862   AC_MSG_CHECKING(if user provides library for $1)
    2863 
    2864 # Check for header file directory
    2865 
    2866   AC_ARG_WITH(m4_tolower($1)-incdir,
    2867       AS_HELP_STRING([--with-m4_tolower($1)-incdir],
    2868                      [specify the header file directory for library $1]),
    2869       [$2INCDIR=`cd $withval; pwd`])
    2870 
    2871 # Check for library directory
    2872 
    2873   AC_ARG_WITH(m4_tolower($1)-lib,
    2874       AS_HELP_STRING([--with-m4_tolower($1)-lib],
    2875                      [specify the flags used to link with the library $1]),
    2876       [$2LIB=$withval])
    2877 
    2878 # Switch to disable library check if requested
    2879 
    2880   AC_ARG_ENABLE(m4_tolower($1)-libcheck,
    2881       AS_HELP_STRING([--disable-m4_tolower($1)-libcheck],
    2882                      [skip the link check at configuration time]),
    2883       [m4_tolower($1)_libcheck=$enableval],
    2884       [m4_tolower($1)_libcheck=yes])
    2885 
    2886 # At this point, if we're going to use the library, both LBRYINCDIR and
    2887 # LBRYLIB must be defined and not empty.
    2888 
    2889   if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then
    2890     if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then
    2891       AC_MSG_ERROR([You need to specify both an include directory and link flags to use library $1. Use --with-m4_tolower($1)-incdir of environment variable $$2INCDIR to specify the include directory. Use --with-m4_tolower($1)-lib or environment variable $$2LIB to specify link flags.])
    2892     fi
    2893     m4_tolower(coin_has_$2)=true
    2894     AC_MSG_RESULT(yes)
    2895   else
    2896     m4_tolower(coin_has_$2)=false
    2897     AC_MSG_RESULT(no)
    2898   fi
    2899 
    2900 # If we have instructions for use, consider header and link checks.
    2901 
    2902   if test $m4_tolower(coin_has_$2) = true; then
    2903 
    2904 # If argument 3 (file) is given, check for the file. Typically this will be a
    2905 # header file, but that's not assumed.
    2906 
    2907     m4_ifval([$3],
    2908         [AC_COIN_CHECK_FILE([$$2INCDIR/$3],[],
    2909              [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])])
    2910 
    2911 # Now see if we can link the function. There are arguments for and against
    2912 # assuming argument 3 is a header file declaring the function. A correct
    2913 # function declaration is the main argument in favour. Having to cope with
    2914 # possible dependencies or other oddities are the main arguments against.
    2915 # Force the use of C as the best single choice amongst C++, C, and Fortran.
    2916 # Obviously, this has limits.
    2917 
    2918     m4_ifvaln([$4],
    2919         [if test x"$m4_tolower($1)_libcheck" != xno; then
    2920            coin_save_LIBS="$LIBS"
    2921            LIBS="$$2LIB $5"
    2922            coin_$2_link=no
    2923            AC_LANG_PUSH(C)
    2924            for fnm in $4 ; do
    2925              AC_MSG_CHECKING([whether symbol $fnm is available with $2])
    2926              AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$fnm()]])],
    2927                  [AC_MSG_RESULT(yes)
    2928                   coin_$2_link=yes
    2929                   break],
    2930                  [AC_MSG_RESULT(no)])
    2931            done
    2932            AC_LANG_POP(C)
    2933            LIBS="$coin_save_LIBS"
    2934            if test x"$coin_$2_link" != xyes ; then
    2935              AC_MSG_ERROR([Cannot find symbol(s) $4 with $2])
    2936            fi
    2937          fi])
    2938 
    2939 # If we make it this far, we've verified the file and linked the function. Add
    2940 # the necessary link flags to $6_{PC}LIBS and define the preprocessor symbol
    2941 # COIN_HAS_LBRY.
    2942 
    2943     coin_foreach_w([myvar], [$6], [
    2944       m4_toupper(myvar)_LIBS="$$2LIB $m4_toupper(myvar)_LIBS"
    2945       m4_toupper(myvar)_PCLIBS="$$2LIB $m4_toupper(myvar)_PCLIBS"
    2946       m4_toupper(myvar)_LIBS_INSTALLED="$$2LIB $m4_toupper(myvar)_LIBS_INSTALLED"
    2947     ])
    2948    
    2949     AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available])
    2950   fi
    2951 
    2952 # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
    2953 # automake conditional. These actions must occur unconditionally.
    2954 
    2955   AC_SUBST($2INCDIR)
    2956   AC_SUBST($2LIB)
    2957   AM_CONDITIONAL(COIN_HAS_$2, test $m4_tolower(coin_has_$2) = true)
    2958 ]) #AC_COIN_CHECK_USER_LIBRARY
    2959 
    2960 ###########################################################################
    2961 #                            COIN_TRY_FLINK                               #
    2962 ###########################################################################
    2963 
    2964 # Auxilliary macro to test if a Fortran function name can be linked,
    2965 # given the current settings of LIBS.  We determine from the context, what
    2966 # the currently active programming language is, and cast the name accordingly.
    2967 # The first argument is the name of the function/subroutine, in small letters,
    2968 # the second argument are the actions taken when the test works, and the
    2969 # third argument are the actions taken if the test fails.
    2970 
    2971 AC_DEFUN([AC_COIN_TRY_FLINK],
    2972 [case $ac_ext in
    2973   f)
    2974     AC_TRY_LINK(,[      call $1],[$2],[$3])
    2975     ;;
    2976   c)
    2977     AC_F77_FUNC($1,cfunc$1)
    2978     if test x"$coin_need_flibs" = xyes; then
    2979       flink_try=no;
    2980     else
    2981       AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
    2982                   [flink_try=yes],[flink_try=no])
    2983     fi
    2984     if test $flink_try = yes; then
    2985       $2
    2986     else
    2987       if test x"$FLIBS" != x; then
    2988         flink_save_libs="$LIBS"
    2989         LIBS="$LIBS $FLIBS"
    2990         AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
    2991                     [LIBS="$flink_save_libs"
    2992                      coin_need_flibs=yes
    2993                      $2
    2994                     ],
    2995                     [LIBS="$flink_save_libs"
    2996                      $3])
    2997       else
    2998         $3
    2999       fi
    3000     fi
    3001     ;;
    3002   cc|cpp)
    3003     AC_F77_FUNC($1,cfunc$1)
    3004     if test x"$coin_need_flibs" = xyes; then
    3005       flink_try=no;
    3006     else
    3007       AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
    3008                   [flink_try=yes],[flink_try=no])
    3009     fi
    3010     if test $flink_try = yes; then
    3011       $2
    3012     else
    3013       if test x"$FLIBS" != x; then
    3014         flink_save_libs="$LIBS"
    3015         LIBS="$LIBS $FLIBS"
    3016         AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
    3017                     [LIBS="$flink_save_libs"
    3018                      coin_need_flibs=yes
    3019                      $2
    3020                     ],
    3021                     [LIBS="$flink_save_libs"
    3022                      $3])
    3023       else
    3024         $3
    3025       fi
    3026     fi
    3027     ;;
    3028 esac
    3029 ]) # AC_COIN_TRY_FLINK
    3030 
    3031 ###########################################################################
    3032 #                           COIN_DOXYGEN                                  #
    3033 ###########################################################################
    3034 #
    3035 # This macro determines the configuration information for doxygen, the tool
    3036 # used to generate online documentation of COIN code. It takes one parameter,
    3037 # a list of projects (mixed-case, to match the directory names) that should
    3038 # be processed as external tag files. E.g., COIN_DOXYGEN([Clp Osi]).
    3039 #
    3040 # This macro will define the following variables:
    3041 #  coin_have_doxygen    Yes if doxygen is found, no otherwise
    3042 #  coin_doxy_usedot     Defaults to `yes'; --with-dot will still check to see
    3043 #                       if dot is available
    3044 #  coin_doxy_tagname    Name of doxygen tag file (placed in doxydoc directory)
    3045 #  coin_doxy_logname    Name of doxygen log file (placed in doxydoc directory)
    3046 #  coin_doxy_tagfiles   List of doxygen tag files used to reference other
    3047 #                       doxygen documentation
    3048 #  coin_doxy_excludes   Directories to exclude from doxygen processing
    3049 
    3050 AC_DEFUN([AC_COIN_DOXYGEN],
    3051 [
    3052 
    3053 AC_MSG_NOTICE([configuring doxygen documentation options])
    3054 
    3055 # Check to see if doxygen is available.
    3056 
    3057 AC_CHECK_PROG([coin_have_doxygen],[doxygen],[yes],[no])
    3058 
    3059 # Look for the dot tool from the graphviz package, unless the user has
    3060 # disabled it.
    3061 
    3062 AC_ARG_WITH([dot],
    3063   AS_HELP_STRING([--with-dot],
    3064                  [use dot (from graphviz) when creating documentation with
    3065                   doxygen if available; --without-dot to disable]),
    3066   [],[withval=yes])
    3067 if test x"$withval" = xno ; then
    3068   coin_doxy_usedot=NO
    3069   AC_MSG_CHECKING([for dot ])
    3070   AC_MSG_RESULT([disabled])
    3071 else
    3072   AC_CHECK_PROG([coin_doxy_usedot],[dot],[YES],[NO])
    3073 fi
    3074 
    3075 # Generate a tag file name and a log file name
    3076 
    3077 AC_SUBST([coin_doxy_tagname],[doxydoc/${PACKAGE}_doxy.tag])
    3078 AC_SUBST([coin_doxy_logname],[doxydoc/${PACKAGE}_doxy.log])
    3079 
    3080 # Process the list of project names and massage them into possible doxygen
    3081 # doc'n directories. Prefer 1) classic external, source processed using
    3082 # a project-specific doxygen.conf, we use the tag file; 2) classic
    3083 # external, source processed using package doxygen.conf; 3) installed
    3084 # doxydoc. Alternatives 1) and 2) are only possible if the directory will be
    3085 # configured, which we can't know unless this is the package base configure,
    3086 # since coin_subdirs is only set there. Hence it's sufficient to check for
    3087 # membership. If we use a tag file from a classic external, exclude the
    3088 # source from doxygen processing when doxygen runs in the base directory.
    3089 
    3090 coin_doxy_tagfiles=
    3091 coin_doxy_excludes=
    3092 tmp="$1"
    3093 for proj in $tmp ; do
    3094   lc_proj=`echo $proj | [tr [A-Z] [a-z]]`
    3095   AC_MSG_CHECKING([for doxygen doc'n for $proj ])
    3096   doxytag=${lc_proj}_doxy.tag
    3097   doxyfound=no
    3098   for chkProj in $coin_subdirs ; do
    3099     if test "$chkProj" = "$proj" ; then
    3100       # proj will be configured, hence doxydoc present in build tree
    3101       doxysrcdir="${srcdir}/${proj}"
    3102       # AC_MSG_NOTICE([Considering $doxysrcdir (base)])
    3103       if test -d "$doxysrcdir" ; then
    3104         # with a doxydoc directory?
    3105         doxydir="$doxysrcdir/doxydoc"
    3106         # AC_MSG_NOTICE([Considering $doxydir (base)])
    3107         # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
    3108         if test -d "$doxydir" ; then
    3109           # use tag file; don't process source
    3110           eval doxydir="`pwd`/${proj}/doxydoc"
    3111           coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
    3112           AC_MSG_RESULT([$doxydir (tag)])
    3113           coin_doxy_excludes="$coin_doxy_excludes */${proj}"
    3114         else
    3115           # will process the source -- nothing further to be done here
    3116           AC_MSG_RESULT([$doxysrcdir (src)])
    3117         fi
    3118         doxyfound=yes
    3119       fi
    3120     fi
    3121   done
    3122   # Not built, fall back to installed tag file
    3123   if test $doxyfound = no ; then
    3124     eval doxydir="${datadir}/coin/doc/${proj}/doxydoc"
    3125     # AC_MSG_NOTICE([Considering $doxydir (install)])
    3126     # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
    3127     coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
    3128     AC_MSG_RESULT([$doxydir (tag)])
    3129   fi
    3130 done
    3131 AC_SUBST([coin_doxy_tagfiles])
    3132 AC_SUBST([coin_doxy_excludes])
    3133 
    3134 ]) # AC_COIN_DOXYGEN
    3135 
    3136 
    3137 ###########################################################################
    3138 #                           COIN_HAS_PKGCONFIG                            #
    3139 ###########################################################################
    3140 
    3141 # This macro checks whether a pkg-config tool with a minimal version number
    3142 # is available.  If so, then the variable PKGCONFIG is set to its path.
    3143 # If not, PKGCONFIG is set to "".  The minimal version number can be given
    3144 # as first parameter, by default it is 0.16.0, since COIN-OR .pc files now
    3145 # include an URL field, which breaks pkg-config version <= 0.15.
    3146 # This macro is a modified version of PKG_PROG_PKG_CONFIG in pkg.m4.
    3147 # Further, the AM_CONDITIONAL COIN_HAS_PKGCONFIG is set and PKGCONFIG is
    3148 # AC_SUBST'ed.  Finally, if this setup belongs to a project directory, then
    3149 # the search path for .pc files is assembled from the value of
    3150 # $PKG_CONFIG_PATH, the values of --prefix, --coin-instdir, and the directories
    3151 # named in a file ../coin_subdirs.txt or ../../coin_subdirs.txt in a variable
    3152 # COIN_PKG_CONFIG_PATH, which is also AC_SUBST'ed. For a path xxx given in the
    3153 # coin-subdirs.txt, also the directory xxx/pkgconfig is added, if existing.
    3154 
    3155 AC_DEFUN([AC_COIN_HAS_PKGCONFIG],
    3156 [AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
    3157 
    3158 AC_ARG_ENABLE([pkg-config],
    3159   [AC_HELP_STRING([--disable-pkg-config],[disable use of pkg-config (if available)])],
    3160   [use_pkgconfig="$enableval"],
    3161   [if test x$coin_cc_is_cl = xtrue; then
    3162      use_pkgconfig=no
    3163    else
    3164      use_pkgconfig=yes
    3165    fi])
    3166 
    3167 if test $use_pkgconfig = yes ; then
    3168   if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
    3169     AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
    3170   fi
    3171   if test -n "$PKG_CONFIG"; then
    3172     _pkg_min_version=m4_default([$1], [0.16.0])
    3173     AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
    3174     if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
    3175       AC_MSG_RESULT([yes])
    3176     else
    3177       AC_MSG_RESULT([no])
    3178       PKG_CONFIG=""
    3179     fi
    3180   fi
    3181 
    3182   # check if pkg-config supports the short-errors flag
    3183   if test -n "$PKG_CONFIG" && \
    3184     $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
    3185     pkg_short_errors=" --short-errors "
    3186   else
    3187     pkg_short_errors=""
    3188   fi
    3189 fi
    3190 
    3191 AM_CONDITIONAL([COIN_HAS_PKGCONFIG], [test -n "$PKG_CONFIG"])
    3192 AC_SUBST(PKG_CONFIG)
    3193 
    3194 # assemble pkg-config search path for installed projects
    3195 COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
    3196 
    3197 # 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
    3198 # best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig,
    3199 # unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}...
    3200 if test "x${prefix}" = xNONE ; then
    3201   COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
    3202 else
    3203   COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
    3204 fi
    3205 
    3206 AC_ARG_WITH([coin-instdir],
    3207   AC_HELP_STRING([--with-coin-instdir],
    3208                  [prefix of installation directory for precompiled COIN packages]),
    3209   [if test -d "$withval"; then : ; else
    3210      AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
    3211    fi
    3212    COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
    3213   ],[])
    3214 
    3215 AC_SUBST(COIN_PKG_CONFIG_PATH)
    3216 
    3217 # assemble additional pkg-config search paths for uninstalled projects
    3218 if test x$coin_projectdir = xyes ; then
    3219   # if we are in a project setup, then in a classic setup, we want to find uninstalled projects
    3220   # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory
    3221   # unfortunately, if the user set prefix, then we do not know where the project base directory is located
    3222   # 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)
    3223   COIN_PKG_CONFIG_PATH_UNINSTALLED=
    3224   if test -f ../coin_subdirs.txt ; then
    3225     for i in `cat ../coin_subdirs.txt` ; do
    3226       if test -d ../$i ; then
    3227         COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
    3228       fi
    3229       if test -d ../$i/pkgconfig ; then
    3230         COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
    3231       fi
    3232     done
    3233   fi
    3234 
    3235   if test -f ../../coin_subdirs.txt ; then
    3236     for i in `cat ../../coin_subdirs.txt` ; do
    3237       if test -d ../../$i ; then
    3238         COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
    3239       fi
    3240       if test -d ../../$i/pkgconfig ; then
    3241         COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
    3242       fi
    3243     done
    3244   fi
    3245 
    3246   AC_SUBST(COIN_PKG_CONFIG_PATH_UNINSTALLED)
    3247 fi
    3248 
    3249 if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then
    3250   AC_MSG_WARN([Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config.])
    3251 fi
    3252 
    3253 ])
    3254 
    3255 ###########################################################################
    3256 #                           COIN_PKG_CHECK_PROJECT_EXISTS                 #
    3257 ###########################################################################
    3258 
    3259 # COIN_PKG_CHECK_PROJECT_EXISTS(PROJECT, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    3260 #
    3261 # Check to see whether a particular project exists.  Similar
    3262 # to PKG_CHECK_MODULES(), but set only the variables $1_VERSION and $1_PKG_ERRORS variables
    3263 #
    3264 AC_DEFUN([AC_COIN_PKG_CHECK_PROJECT_EXISTS],
    3265 [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
    3266 if test -n "$PKG_CONFIG" ; then
    3267   if $PKG_CONFIG --exists "m4_tolower($1)"; then
    3268     m4_toupper($1)[]_VERSION=`$PKG_CONFIG --modversion "m4_tolower($1)" 2>/dev/null`
    3269     m4_ifval([$2], [$2], [:])
    3270   else
    3271     m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "m4_tolower($1)"`
    3272     $3
    3273   fi
    3274 else
    3275   AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
    3276 fi
    3277 ])
    3278 
    3279 ###########################################################################
    3280 #                           COIN_PKG_CHECK_MODULE_EXISTS                  #
    3281 ###########################################################################
    3282 
    3283 # COIN_PKG_CHECK_MODULES_EXISTS(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    3284 #
    3285 # Check to see whether a particular set of packages exists.
    3286 # Similar to PKG_CHECK_MODULES(), but set only the variable $1_VERSIONS and $1_PKG_ERRORS
    3287 #
    3288 AC_DEFUN([AC_COIN_PKG_CHECK_MODULE_EXISTS],
    3289 [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
    3290 if test -n "$PKG_CONFIG" ; then
    3291   if $PKG_CONFIG --exists "$2"; then
    3292     m4_toupper($1)[]_VERSIONS=`$PKG_CONFIG --modversion "$2" 2>/dev/null | tr '\n' ' '`
    3293     $3
    3294   else
    3295     m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$2"`
    3296     $4
    3297   fi
    3298 else
    3299   AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
    3300 fi
    3301 ])
    3302 
    3303 ###########################################################################
    3304 #                           COIN_PKG_HAS_MODULE                           #
    3305 ###########################################################################
    3306 
    3307 # COIN_PKG_HAS_MODULE(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    3308 #
    3309 # Checks whether pkg-config files for a given set of packages is available.
    3310 # If so, sets MODULE_CFLAGS, MODULE_LIBS, and MODULES_DATA and executes ACTION-IF-FOUND.
    3311 # If not, then ACTION-IF-NOT-FOUND is executed.
    3312 # A reason for not finding a package is stored in MODULE_PKG_ERRORS
    3313 #
    3314 # --------------------------------------------------------------
    3315 AC_DEFUN([AC_COIN_PKG_HAS_MODULE],
    3316 [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
    3317 
    3318 AC_COIN_PKG_CHECK_MODULE_EXISTS([$1],[$2],
    3319   [ cflags=`$PKG_CONFIG --cflags "$2" 2>/dev/null`
    3320     # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files
    3321         # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's
    3322         # but only do this if is not trivial
    3323     if test "$CYGPATH_W" != "echo" ; then
    3324       # need to put into brackets since otherwise autoconf replaces the brackets in the sed command
    3325       [cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
    3326     fi
    3327     m4_toupper($1)[]_CFLAGS="$cflags"
    3328     m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "$2" 2>/dev/null`
    3329     m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "$2" 2>/dev/null`
    3330     $3
    3331   ],
    3332   [ $4 ])
    3333 
    3334 ])# PKG_CHECK_MODULES
    3335 
    3336 ###########################################################################
    3337 #                           COIN_MAIN_PACKAGEDIR                          #
    3338 ###########################################################################
    3339 
    3340 # This macro substitutes COIN_MAIN_SUBDIR.
    3341 # If $2/$1 or $1 is in COIN_SKIP_PROJECTS, do nothing.
    3342 # If --with-$1-lib, --with-$1-incdir, or --with-$1-datadir is given, then assume that the package is installed.
    3343 # Otherwise, if the directory $2/$1 and the file $2/$1/$3 exist, check whether $2/$1/configure exists.
    3344 #   If so, include this directory into the list of directories where configure and make recourse into.
    3345 # tolower(coin_has_$1) is set to "no" if the project source is not available or will not be compiled.
    3346 # Otherwise, it will be set to "yes".
    3347 
    3348 AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],[
    3349 AC_MSG_CHECKING([whether source of project $1 is available and should be compiled])
    3350 
    3351 m4_tolower(coin_has_$1)=notGiven
    3352 coin_reason=
    3353 
    3354 # check if user wants to skip project in any case
    3355 AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
    3356 if test x"$COIN_SKIP_PROJECTS" != x; then
    3357   for dir in $COIN_SKIP_PROJECTS; do
    3358     if test $dir = "$1"; then
    3359       m4_tolower(coin_has_$1)="no"
    3360       coin_reason="$1 has been specified in COIN_SKIP_PROJECTS"
    3361     fi
    3362     m4_ifval($2,[
    3363     if test $dir = "$2/$1"; then
    3364       m4_tolower(coin_has_$1)="no"
    3365       coin_reason="$2/$1 has been specified in COIN_SKIP_PROJECTS"
    3366     fi])
    3367   done
    3368 fi
    3369 
    3370 if test "$m4_tolower(coin_has_$1)" != no; then
    3371   AC_ARG_WITH([m4_tolower($1)],,
    3372     [if test "$withval" = no ; then
    3373        m4_tolower(coin_has_$1)="no"
    3374        coin_reason="--without-m4_tolower($1) has been specified"
    3375      fi
    3376     ])
    3377 fi
    3378 
    3379 if test "$m4_tolower(coin_has_$1)" != no; then
    3380   AC_ARG_WITH([m4_tolower($1)-lib],
    3381     AC_HELP_STRING([--with-m4_tolower($1)-lib],
    3382                    [linker flags for using project $1]),
    3383     [if test "$withval" = no ; then
    3384        m4_tolower(coin_has_$1)="no"
    3385        coin_reason="--without-m4_tolower($1)-lib has been specified"
    3386      else
    3387        m4_tolower(coin_has_$1)="no"
    3388        coin_reason="--with-m4_tolower($1)-lib has been specified"
    3389      fi],
    3390     [])
    3391 fi
    3392 
    3393 if test "$m4_tolower(coin_has_$1)" != no; then
    3394   AC_ARG_WITH([m4_tolower($1)-incdir],
    3395     AC_HELP_STRING([--with-m4_tolower($1)-incdir],
    3396                    [directory with header files for using project $1]),
    3397     [if test "$withval" = no ; then
    3398        m4_tolower(coin_has_$1)="no"
    3399        coin_reason="--without-m4_tolower($1)-incdir has been specified"
    3400      else
    3401        m4_tolower(coin_has_$1)="no"
    3402        coin_reason="--with-m4_tolower($1)-incdir has been specified"
    3403      fi],
    3404     [])
    3405 fi
    3406 
    3407 if test "$m4_tolower(coin_has_$1)" != no; then
    3408   AC_ARG_WITH([m4_tolower($1)-datadir],
    3409     AC_HELP_STRING([--with-m4_tolower($1)-datadir],
    3410                    [directory with data files for using project $1]),
    3411     [if test "$withval" = no ; then
    3412        m4_tolower(coin_has_$1)="no"
    3413        coin_reason="--without-m4_tolower($1)-datadir has been specified"
    3414      else
    3415        m4_tolower(coin_has_$1)="no"
    3416        coin_reason="--with-m4_tolower($1)-datadir has been specified"
    3417      fi],
    3418     [])
    3419 fi
    3420 
    3421 m4_if(m4_tolower($1), blas, [
    3422   if test $m4_tolower(coin_has_$1) != no; then
    3423     #--with-blas can overwrite --with-blas-lib, and can be set to BUILD to enforce building blas
    3424     AC_ARG_WITH([blas],
    3425       AC_HELP_STRING([--with-blas], [specify BLAS library (or BUILD to enforce use of ThirdParty/Blas)]),
    3426         [if test x"$withval" = "xno" ; then
    3427            coin_has_blas="no"
    3428            coin_reason="--without-blas has been specified"
    3429          elif test x"$withval" != "xBUILD" ; then
    3430            coin_has_blas="no"
    3431            coin_reason="--with-blas has been specified"
    3432          fi],
    3433         [])
    3434   fi
    3435 ])
    3436 
    3437 m4_if(m4_tolower($1), lapack, [
    3438   if test $m4_tolower(coin_has_$1) != skipping; then
    3439     #--with-lapack can overwrite --with-lapack-lib, and can be set to BUILD to enforce building lapack
    3440     AC_ARG_WITH([lapack],
    3441       AC_HELP_STRING([--with-lapack], [specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack)]),
    3442         [if test x"$withval" = "xno" ; then
    3443            coin_has_lapack="no"
    3444            coin_reason="--without-lapack has been specified"
    3445          elif test x"$withval" != "xBUILD" ; then
    3446            coin_has_lapack="no"
    3447            coin_reason="--with-lapack has been specified"
    3448          fi],
    3449         [])
    3450   fi
    3451 ])
    3452 
    3453 # check if project is available in present directory
    3454 if test "$m4_tolower(coin_has_$1)" = notGiven; then
    3455   m4_tolower(coin_has_$1)=no
    3456   if test -d $srcdir/m4_ifval($2,[$2/],)$1; then
    3457     coin_reason="source in m4_ifval($2,[$2/],)$1"
    3458     # If a third argument is given, then we have to check if one one the files given in that third argument is present.
    3459     # If none of the files in the third argument is available, then we consider the project directory as non-existing.
    3460     # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient.
    3461     m4_ifvaln([$3],
    3462       [for i in $srcdir/m4_ifval($2,[$2/],)$1/$3; do
    3463          if test -r $i; then
    3464            m4_tolower(coin_has_$1)="yes"
    3465          else
    3466            m4_tolower(coin_has_$1)="no"
    3467            coin_reason="source file $i not available"
    3468            break
    3469          fi
    3470        done],
    3471       [ m4_tolower(coin_has_$1)="yes" ])
    3472   fi
    3473 fi
    3474 
    3475 if test -z "$coin_reason" ; then
    3476   AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    3477 else
    3478   AC_MSG_RESULT([$m4_tolower(coin_has_$1), $coin_reason])
    3479 fi
    3480 
    3481 if test "$m4_tolower(coin_has_$1)" = yes ; then
    3482   if test -r $srcdir/m4_ifval($2,[$2/],)$1/configure; then
    3483     coin_subdirs="$coin_subdirs m4_ifval($2,[$2/],)$1"
    3484     AC_CONFIG_SUBDIRS(m4_ifval($2,[$2/],)$1)
    3485   fi
    3486 fi
    3487 ])
    3488 
    3489 ###########################################################################
    3490 #                            COIN_CHECK_PACKAGE                           #
    3491 ###########################################################################
    3492 
    3493 # This macro checks for the existance of a COIN-OR package and provides compiler and linker flags to compile against this package.
    3494 # A package can consists of one or more COIN-OR or other projects.
    3495 # It defines the PACKAGE_CFLAGS, PACKAGE_LIBS, PACKAGE_DEPENDENCIES, and PACKAGE_DATA variables, referring to the compiler and linker
    3496 # flags to use when linking against this module, the libraries the package depends on, and the directories where the module data resists.
    3497 # The difference between PACKAGE_LIBS and PACKAGE_DEPENDENCIES is that PACKAGE_DEPENDENCIES does not contain arguments starting with '-',
    3498 # so it can be used to setup the _DEPENDENCIES variable in a Makefile.am.
    3499 # It also defines a COIN_HAS_PACKAGE preprocessor macro and makefile conditional.
    3500 # Further, tolower(coin_has_$1) is set to "yes".
    3501 # If a list of build targets using this projects is given in the third argument,
    3502 # then the compiler and linker variables and .pc file setup variable corresponding to this build target
    3503 # are extended with the values for this package.
    3504 # That is, for each build target X, the variables X_CFLAGS, X_LIBS, X_DEPENDENCIES, X_PCLIBS, X_PCREQUIRES are setup,
    3505 # whereas the last two specify the values to put into the "Libs:" and "Requires:" fields of the .pc file, resp.
    3506 #
    3507 # The first argument should be the name (PACKAGE) of the package (in correct lower
    3508 # and upper case).
    3509 # The second argument should be a (space separated) list of projects which this
    3510 # package consists of. Optionally, required version numbers can be added.
    3511 # The optional third argument should be a (space separated) list of build targets
    3512 # which use this package, if available.
    3513 #
    3514 # It is also possible to specify a preinstalled version of this package
    3515 # or to specify only the linker and compiler flags and data directory.
    3516 #
    3517 # If the user did not specify --with-$1-... flags and pkg-config is not available,
    3518 # COIN_CHECK_PACKAGE_FALLBACK($1, $2, $3) is called.
    3519 
    3520 AC_DEFUN([AC_COIN_CHECK_PACKAGE],
    3521 [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
    3522 AC_MSG_CHECKING([for COIN-OR package $1])
    3523 
    3524 m4_tolower(coin_has_$1)=notGiven
    3525 
    3526 # check if user wants to skip package in any case
    3527 if test x"$COIN_SKIP_PROJECTS" != x; then
    3528   for dir in $COIN_SKIP_PROJECTS; do
    3529     if test $dir = "$1"; then
    3530       m4_tolower(coin_has_$1)=skipping
    3531     fi
    3532   done
    3533 fi
    3534 
    3535 if test "$m4_tolower(coin_has_$1)" != skipping; then
    3536   AC_ARG_WITH([m4_tolower($1)],,
    3537     [if test "$withval" = no ; then
    3538        m4_tolower(coin_has_$1)=skipping
    3539      fi
    3540     ])
    3541 fi
    3542 
    3543 m4_toupper($1_LIBS)=
    3544 m4_toupper($1_CFLAGS)=
    3545 m4_toupper($1_DATA)=
    3546 m4_toupper($1_DEPENDENCIES)=
    3547 m4_toupper($1_PCLIBS)=
    3548 m4_toupper($1_PCREQUIRES)=
    3549 m4_toupper($1_DATA)=
    3550 AC_SUBST(m4_toupper($1_LIBS))
    3551 AC_SUBST(m4_toupper($1_CFLAGS))
    3552 AC_SUBST(m4_toupper($1_DATA))
    3553 AC_SUBST(m4_toupper($1_DEPENDENCIES))
    3554 AC_SUBST(m4_toupper($1_LIBS_INSTALLED))
    3555 AC_SUBST(m4_toupper($1_CFLAGS_INSTALLED))
    3556 AC_SUBST(m4_toupper($1_DATA_INSTALLED))
    3557 coin_foreach_w([myvar], [$3], [
    3558   AC_SUBST(m4_toupper(myvar)_CFLAGS)
    3559   AC_SUBST(m4_toupper(myvar)_LIBS)
    3560   AC_SUBST(m4_toupper(myvar)_PCLIBS)
    3561   AC_SUBST(m4_toupper(myvar)_PCREQUIRES)
    3562   AC_SUBST(m4_toupper(myvar)_DEPENDENCIES)
    3563   AC_SUBST(m4_toupper(myvar)_CFLAGS_INSTALLED)
    3564   AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
    3565 ])
    3566 
    3567 #check if user provided LIBS, CFLAGS, or DATA for package or disables use of package
    3568 if test $m4_tolower(coin_has_$1) != skipping; then
    3569   AC_ARG_WITH([m4_tolower($1)-lib],
    3570     AC_HELP_STRING([--with-m4_tolower($1)-lib],
    3571                    [linker flags for using package $1]),
    3572     [if test "$withval" = no ; then
    3573        m4_tolower(coin_has_$1)=skipping
    3574      else
    3575        m4_tolower(coin_has_$1)=yes
    3576        m4_toupper($1_LIBS)="$withval"
    3577        m4_toupper($1_PCLIBS)="$withval"
    3578        coin_foreach_w([myvar], [$3], [
    3579          m4_toupper(myvar)_PCLIBS="$withval $m4_toupper(myvar)_PCLIBS"
    3580          m4_toupper(myvar)_LIBS="$withval $m4_toupper(myvar)_LIBS"
    3581        ])
    3582        # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
    3583        if test -z "$PKG_CONFIG" ; then
    3584          m4_toupper($1_LIBS_INSTALLED)="$withval"
    3585          coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_LIBS_INSTALLED="$withval $m4_toupper(myvar)_LIBS_INSTALLED"])
    3586        fi
    3587      fi
    3588     ],
    3589     [])
    3590 fi
    3591 
    3592 if test $m4_tolower(coin_has_$1) != skipping; then
    3593   AC_ARG_WITH([m4_tolower($1)-incdir],
    3594     AC_HELP_STRING([--with-m4_tolower($1)-incdir],
    3595                    [directory with header files for using package $1]),
    3596     [if test "$withval" = no ; then
    3597        m4_tolower(coin_has_$1)=skipping
    3598      else
    3599        m4_tolower(coin_has_$1)=yes
    3600        m4_toupper($1_CFLAGS)="-I`${CYGPATH_W} $withval`"
    3601        coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS="-I`${CYGPATH_W} $withval` $m4_toupper(myvar)_CFLAGS"])
    3602        # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
    3603        if test -z "$PKG_CONFIG" ; then
    3604          m4_toupper($1_CFLAGS_INSTALLED)="$m4_toupper($1_CFLAGS)"
    3605          coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1_CFLAGS) $m4_toupper(myvar)_CFLAGS_INSTALLED"])
    3606        fi
    3607      fi
    3608     ],
    3609     [])
    3610 fi
    3611 
    3612 if test $m4_tolower(coin_has_$1) != skipping; then
    3613   AC_ARG_WITH([m4_tolower($1)-datadir],
    3614     AC_HELP_STRING([--with-m4_tolower($1)-datadir],
    3615                    [directory with data files for using package $1]),
    3616     [if test "$withval" = no ; then
    3617        m4_tolower(coin_has_$1)=skipping
    3618      else
    3619        m4_tolower(coin_has_$1)=yes
    3620        m4_toupper($1_DATA)="$withval"
    3621        # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
    3622        if test -z "$PKG_CONFIG" ; then
    3623          m4_toupper($1_DATA_INSTALLED)="$withval"
    3624        fi
    3625      fi
    3626     ],
    3627     [])
    3628 fi
    3629 
    3630 if test $m4_tolower(coin_has_$1) = notGiven; then
    3631   if test -n "$PKG_CONFIG" ; then
    3632     # set search path for pkg-config
    3633     # need to export variable to be sure that the following pkg-config gets these values
    3634     coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
    3635     PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED"
    3636     export PKG_CONFIG_PATH
    3637    
    3638     # let pkg-config do it's magic
    3639     AC_COIN_PKG_HAS_MODULE([$1],[$2],
    3640       [ m4_tolower(coin_has_$1)=yes
    3641         AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS])
    3642 
    3643         # adjust linker flags for (i)cl compiler
    3644         # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl)
    3645         if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
    3646         then
    3647           m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']`
    3648         fi
    3649         m4_toupper($1_PCREQUIRES)="$2"
    3650    
    3651         # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in $3
    3652         coin_foreach_w([myvar], [$3], [
    3653           m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
    3654           m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
    3655           m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
    3656         ])
    3657       ],
    3658       [ m4_tolower(coin_has_$1)=notGiven
    3659         AC_MSG_RESULT([not given: $m4_toupper($1)_PKG_ERRORS])
    3660       ])
    3661 
    3662     # reset PKG_CONFIG_PATH variable
    3663     PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
    3664     export PKG_CONFIG_PATH
    3665 
    3666   else
    3667     AC_MSG_RESULT([skipped check via pkg-config, redirect to fallback])
    3668     AC_COIN_CHECK_PACKAGE_FALLBACK([$1], [$2], [$3])
    3669   fi
    3670 
    3671 else
    3672   AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    3673 fi
    3674 
    3675 if test $m4_tolower(coin_has_$1) != skipping &&
    3676    test $m4_tolower(coin_has_$1) != notGiven ; then
    3677   AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
    3678 
    3679   AC_ARG_ENABLE([interpackage-dependencies],
    3680     AC_HELP_STRING([--disable-interpackage-dependencies], [disables deduction of Makefile dependencies from package linker flags]),
    3681     [], [enable_interpackage_dependencies=yes])
    3682    
    3683   if test $enable_interpackage_dependencies = yes ; then
    3684      # construct dependencies variables from LIBS variables
    3685      # we add an extra space in LIBS so we can substitute out everything starting with " -"
    3686      # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows
    3687      # then remove everything of the form -xxx
    3688      # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl)
    3689      m4_toupper($1)_DEPENDENCIES=`echo " $m4_toupper($1)_LIBS" | [sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework  *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g']`
    3690      coin_foreach_w([myvar], [$3], [
    3691        m4_toupper(myvar)_DEPENDENCIES=`echo " $m4_toupper(myvar)_LIBS " | [sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework  *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g']`
    3692      ])
    3693   fi
    3694 
    3695   if test 1 = 0 ; then  #change this test to enable a bit of debugging output
    3696     if test -n "$m4_toupper($1)_CFLAGS" ; then
    3697       AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
    3698     fi
    3699     if test -n "$m4_toupper($1)_LIBS" ; then
    3700       AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
    3701     fi
    3702     if test -n "$m4_toupper($1)_DEPENDENCIES" ; then
    3703       AC_MSG_NOTICE([$1 DEPENDENCIES are $m4_toupper($1)_DEPENDENCIES])
    3704     fi
    3705     if test -n "$m4_toupper($1)_DATA" ; then
    3706       AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
    3707     fi
    3708     if test -n "$m4_toupper($1)_PCLIBS" ; then
    3709       AC_MSG_NOTICE([$1 PCLIBS are $m4_toupper($1)_PCLIBS])
    3710     fi
    3711     if test -n "$m4_toupper($1)_PCREQUIRES" ; then
    3712       AC_MSG_NOTICE([$1 PCREQUIRES are $m4_toupper($1)_PCREQUIRES])
    3713     fi
    3714     coin_foreach_w([myvar], [$3], [
    3715       AC_MSG_NOTICE([myvar CFLAGS are $m4_toupper(myvar)_CFLAGS])
    3716       AC_MSG_NOTICE([myvar LIBS   are $m4_toupper(myvar)_LIBS])
    3717       AC_MSG_NOTICE([myvar DEPENDENCIES are $m4_toupper(myvar)_DEPENDENCIES])
    3718     ])
    3719   fi
    3720 fi
    3721 
    3722 # Define the Makefile conditional
    3723 AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
    3724                [test $m4_tolower(coin_has_$1) != notGiven &&
    3725                 test $m4_tolower(coin_has_$1) != skipping])
    3726 
    3727 ]) # AC_COIN_CHECK_PACKAGE
    3728 
    3729 ###########################################################################
    3730 #                       COIN_CHECK_PACKAGE_FALLBACK                       #
    3731 ###########################################################################
    3732 
    3733 # This macro is used by COIN_CHECK_PACKAGE, if it fails to find a package
    3734 # because pkg-config was disabled or is not available.
    3735 #
    3736 # For each project xxx specified in $2, it searches for a xxx-uninstalled.pc
    3737 # file in the directories specified in $COIN_PKG_CONFIG_PATH_UNINSTALLED. The
    3738 # latter variable is setup by COIN_HAS_PKGCONFIG and consists of the content
    3739 # of the coin_subdirs.txt file which has been created by configure in the
    3740 # base directory.  The content of xxx-uninstalled.pc is parsed in order
    3741 # to defines the variables PACKAGE_CFLAGS, PACKAGE_LIBS, and PACKAGE_DATA,
    3742 # referring to the compiler and linker flags to use when linking against this
    3743 # package and the directory where the package data resists.  Further, for each
    3744 # build target X specified in the third argument, the variables X_CFLAGS and
    3745 # X_LIBS are extended with the compiler and linker flags of this package and
    3746 # the variables X_PCLIBS and X_PCREQUIRES are extended by the list of linker
    3747 # flags and dependent projects as needed to setup a .pc file.  The macros
    3748 # checks also dependencies of $2.  Note that the PACKAGE_DATA variable is
    3749 # set to the content of datadir of the first .pc file that is parsed.
    3750 # Finally, for each X in the third argument, also variables
    3751 # X_CFLAGS_INSTALLED and X_LIBS_INSTALLED are setup. They contain the compiler
    3752 # and linker flags for X when all projects have been installed. Their content
    3753 # is assembled from the .pc files that correspond to installed projects. I.e.,
    3754 # whenever a file proj-uninstalled.pc is parsed, then also a corresponding
    3755 # proj.pc file is parsed for compiler and linker flags, if available in the
    3756 # same directory.
    3757 # Similar, a variable PACKAGE_DATA_INSTALLED is setup to the content of datadir
    3758 # of the first .pc file that is parsed.
    3759 #
    3760 # If .pc files for all projects in $2 and their dependencies is found,
    3761 # tolower(coin_has_$1) is set to "yes".  Otherwise, if some dependency
    3762 # is not found, tolower(coin_has_$1) is set to "notGiven".  Further, a
    3763 # COIN_HAS_PACKAGE preprocessor macro and a makefile conditional are defined.
    3764 #
    3765 # The first argument should be the name (PACKAGE) of the package (in correct
    3766 # lower and upper case).  The second argument should be the base names of the
    3767 # projects .pc file which define this package.  The optional third argument
    3768 # should be a (space separated) list of build targets which use this package,
    3769 # if available.
    3770 #
    3771 # $1 is not checked for $COIN_SKIP_PROJECTS, since we only look into
    3772 # $COIN_PKG_CONFIG_PATH_UNINSTALLED.  When the content of this variable was
    3773 # setup in the base directory, $COIN_SKIP_PROJECTS has already been considered.
    3774 
    3775 AC_DEFUN([AC_COIN_CHECK_PACKAGE_FALLBACK],
    3776 [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
    3777 AC_MSG_CHECKING([for COIN-OR package $1 (fallback)])
    3778 
    3779 m4_tolower(coin_has_$1)=notGiven
    3780 m4_toupper($1_LIBS)=
    3781 m4_toupper($1_LIBS_INSTALLED)=
    3782 m4_toupper($1_CFLAGS)=
    3783 m4_toupper($1_CFLAGS_INSTALLED)=
    3784 m4_toupper($1_DATA)=
    3785 m4_toupper($1_DATA_INSTALLED)=
    3786 m4_toupper($1_PCLIBS)=
    3787 m4_toupper($1_PCREQUIRES)=
    3788 
    3789 # initial list of dependencies is "$2", but we need to filter out version number specifications (= x, <= x, >= x, != x)
    3790 projtoprocess="m4_bpatsubsts([$2], [<?>?!?=[    ]*[^    ]+])"
    3791 
    3792 # we first expand the list of projects to process by adding all dependencies just behind the project which depends on it
    3793 # further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards
    3794 # the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples
    3795 # also, we setup the DATA variable
    3796 allproj=""
    3797 allpcfiles=""
    3798 allpcifiles=""
    3799 while test "x$projtoprocess" != x ; do
    3800 
    3801   for proj in $projtoprocess ; do
    3802     # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it
    3803     pcfile=""
    3804     save_IFS="$IFS"
    3805     IFS=":"
    3806     for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do
    3807       # 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
    3808       if test -r "$dir/${proj}-uninstalled.pc" ; then
    3809         pcfile="$dir/$proj-uninstalled.pc"
    3810         if test -r "$dir/${proj}.pc" ; then
    3811           pcifile="$dir/${proj}.pc"
    3812         else
    3813           AC_MSG_WARN([Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples.])
    3814           pcifile=
    3815         fi
    3816         break
    3817       fi
    3818     done
    3819     IFS="$save_IFS"
    3820 
    3821     if test "x$pcfile" != x ; then
    3822       # read dependencies from $pcfile and filter it
    3823       projrequires=[`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[       ]\{0,\}[^       ]\{1,\}//g'`]
    3824 
    3825       # add projrequires to the front of the list of projects that have to be processed next
    3826       # at the same time, remove $proj from this list
    3827       projtoprocess=[`echo $projtoprocess | sed -e "s/$proj/$projrequires/"`]
    3828 
    3829       # read DATA from $pcfile, if _DATA is still empty
    3830       if test "x$m4_toupper($1_DATA)" = x ; then
    3831         projdatadir=
    3832         [pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile`]
    3833         eval `sh -c "$pcfilemod"`
    3834         m4_toupper($1_DATA)="$projdatadir"
    3835       fi
    3836 
    3837       allproj="$allproj $proj"
    3838       allpcfiles="$pcfile:$allpcfiles"
    3839 
    3840     else
    3841       AC_MSG_RESULT([no, dependency $proj not available])
    3842       allproj=fail
    3843       break 2
    3844     fi
    3845    
    3846     if test "x$pcifile" != x ; then
    3847       allpcifiles="$pcifile:$allpcifiles"
    3848      
    3849       # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty
    3850       if test "x$m4_toupper($1_DATA_INSTALLED)" = x ; then
    3851         projdatadir=
    3852         [pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile`]
    3853         eval `sh -c "$pcifilemod"`
    3854         if test "${CYGPATH_W}" != "echo"; then
    3855           projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`"
    3856         fi
    3857         m4_toupper($1_DATA_INSTALLED)="$projdatadir"
    3858       fi
    3859      
    3860     fi
    3861 
    3862     break
    3863   done
    3864 
    3865   # remove spaces on begin of $projtoprocess
    3866   projtoprocess=`echo $projtoprocess | sed -e 's/^[ ]*//'`
    3867 
    3868 done
    3869 
    3870 if test "$allproj" != fail ; then
    3871 
    3872   # now go through the list of .pc files and assemble compiler and linker flags
    3873   # important is here to obey the reverse order that has been setup before,
    3874   # since then libraries that are required by several others should be after these other libraries
    3875   pcfilesprocessed=""
    3876 
    3877   save_IFS="$IFS"
    3878   IFS=":"
    3879   for pcfile in $allpcfiles ; do
    3880 
    3881     # if $pcfile has been processed already, skip this round
    3882     if test "x$pcfilesprocessed" != x ; then
    3883       for pcfiledone in $pcfilesprocessed ; do
    3884         if test "$pcfiledone" = "$pcfile" ; then
    3885           continue 2
    3886         fi
    3887       done
    3888     fi
    3889 
    3890     # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags:
    3891     #   replace "Libs:" by "echo projlibs="
    3892     #   replace "Cflags:" by "echo projcflags="
    3893     #   remove every line starting with <some word>:
    3894     [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`]
    3895 
    3896     # set projcflags and projlibs variables by running $pcfilemod
    3897     # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default
    3898     projcflags=
    3899     projlibs=
    3900     IFS="$save_IFS"
    3901     eval `sh -c "$pcfilemod"`
    3902     IFS=":"
    3903 
    3904     # add CYGPATH_W cludge into include flags and set CFLAGS variable
    3905     if test "${CYGPATH_W}" != "echo"; then
    3906       projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
    3907     fi
    3908     m4_toupper($1_CFLAGS)="$projcflags $m4_toupper($1_CFLAGS)"
    3909 
    3910     # set LIBS variable
    3911     m4_toupper($1_LIBS)="$projlibs $m4_toupper($1_LIBS)"
    3912 
    3913     # remember that we have processed $pcfile
    3914     pcfilesprocessed="$pcfilesprocessed:$pcfile"
    3915 
    3916   done
    3917   IFS="$save_IFS"
    3918 
    3919 
    3920   # now go through the list of .pc files for installed projects and assemble compiler and linker flags
    3921   # important is here again to obey the reverse order that has been setup before,
    3922   # since then libraries that are required by several others should be after these other libraries
    3923   pcfilesprocessed=""
    3924 
    3925   save_IFS="$IFS"
    3926   IFS=":"
    3927   for pcfile in $allpcifiles ; do
    3928 
    3929     # if $pcfile has been processed already, skip this round
    3930     if test "x$pcfilesprocessed" != x ; then
    3931       for pcfiledone in $pcfilesprocessed ; do
    3932         if test "$pcfiledone" = "$pcfile" ; then
    3933           continue 2
    3934         fi
    3935       done
    3936     fi
    3937 
    3938     # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags:
    3939     #   replace "Libs:" by "echo projlibs="
    3940     #   replace "Cflags:" by "echo projcflags="
    3941     #   remove every line starting with <some word>:
    3942     [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`]
    3943 
    3944     # set projcflags and projlibs variables by running $pcfilemod
    3945     # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default
    3946     projcflags=
    3947     projlibs=
    3948     IFS="$save_IFS"
    3949     eval `sh -c "$pcfilemod"`
    3950     IFS=":"
    3951 
    3952     # add CYGPATH_W cludge into include flags and set CFLAGS variable
    3953     if test "${CYGPATH_W}" != "echo"; then
    3954       projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
    3955     fi
    3956     m4_toupper($1_CFLAGS_INSTALLED)="$projcflags $m4_toupper($1_CFLAGS_INSTALLED)"
    3957 
    3958     # set LIBS variable
    3959     m4_toupper($1_LIBS_INSTALLED)="$projlibs $m4_toupper($1_LIBS_INSTALLED)"
    3960    
    3961     # remember that we have processed $pcfile
    3962     pcfilesprocessed="$pcfilesprocessed:$pcfile"
    3963 
    3964   done
    3965   IFS="$save_IFS"
    3966 
    3967 
    3968   # finish up
    3969   m4_tolower(coin_has_$1)=yes
    3970   AC_MSG_RESULT([yes])
    3971   AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
    3972 
    3973   # adjust linker flags for (i)cl compiler
    3974   # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl),
    3975   # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`",
    3976   #    everything of the form "-lname" by "libname.lib", and
    3977   #    everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path`
    3978   if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
    3979   then
    3980     m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']`
    3981     m4_toupper($1_LIBS_INSTALLED)=`echo " $m4_toupper($1_LIBS_INSTALLED)" | [sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g']`
    3982   fi
    3983 
    3984   m4_toupper($1_PCREQUIRES)="$2"
    3985   coin_foreach_w([myvar], [$3], [
    3986     m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
    3987     m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
    3988     m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
    3989     m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1)_CFLAGS_INSTALLED $m4_toupper(myvar)_CFLAGS_INSTALLED"
    3990     m4_toupper(myvar)_LIBS_INSTALLED="$m4_toupper($1)_LIBS_INSTALLED $m4_toupper(myvar)_LIBS_INSTALLED"
    3991   ])
    3992 
    3993 fi
    3994 
    3995 AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
    3996                [test $m4_tolower(coin_has_$1) != notGiven &&
    3997                 test $m4_tolower(coin_has_$1) != skipping])
    3998 
    3999 ]) # AC_COIN_CHECK_PACKAGE_FALLBACK
    4000 
    4001 ###########################################################################
    4002 #                         COIN_CHECK_PACKAGE_BLAS                         #
    4003 ###########################################################################
    4004 
    4005 # This macro checks for a library containing the BLAS library.  It
    4006 # 1. checks the --with-blas argument
    4007 # 2. if --with-blas=BUILD has been specified goes to point 5
    4008 # 3. if --with-blas has been specified to a working library, sets BLAS_LIBS
    4009 #    to its value
    4010 # 4. tries standard libraries
    4011 # 5. calls COIN_CHECK_PACKAGE(Blas, [coinblas], [$1]) to check for
    4012 #    ThirdParty/Blas
    4013 # The makefile conditional and preprocessor macro COIN_HAS_BLAS is defined.
    4014 # BLAS_LIBS is set to the flags required to link with a Blas library.
    4015 # For each build target X in $1, X_LIBS is extended with $BLAS_LIBS.
    4016 # In case 3 and 4, the flags to link to Blas are added to X_PCLIBS too.
    4017 # In case 5, Blas is added to X_PCREQUIRES.
    4018 
    4019 AC_DEFUN([AC_COIN_CHECK_PACKAGE_BLAS],
    4020 [
    4021 AC_ARG_WITH([blas],
    4022             AC_HELP_STRING([--with-blas],
    4023                            [specify BLAS library (or BUILD to enforce use of ThirdParty/Blas)]),
    4024             [use_blas="$withval"], [use_blas=])
    4025 
    4026 # if user specified --with-blas-lib, then we should give COIN_CHECK_PACKAGE
    4027 # preference
    4028 AC_ARG_WITH([blas-lib],,[use_blas=BUILD])
    4029 
    4030 # Check if user supplied option makes sense
    4031 if test x"$use_blas" != x; then
    4032   if test "$use_blas" = "BUILD"; then
    4033     # we come to this later
    4034     :
    4035   elif test "$use_blas" != "no"; then
    4036     AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
    4037     coin_need_flibs=no
    4038     coin_save_LIBS="$LIBS"
    4039     LIBS="$use_blas $LIBS"
    4040     AC_COIN_TRY_FLINK([daxpy],
    4041                       [if test $coin_need_flibs = yes ; then
    4042                          use_blas="$use_blas $FLIBS"
    4043                        fi
    4044                        AC_MSG_RESULT([yes: $use_blas])],
    4045                       [AC_MSG_RESULT([no])
    4046                        AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
    4047     LIBS="$coin_save_LIBS"
    4048   fi
    4049 else
    4050 # Try to autodetect the library for blas based on build system
    4051   #AC_MSG_CHECKING([default locations for BLAS])
    4052   case $build in
    4053     *-sgi-*)
    4054       AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
    4055       coin_need_flibs=no
    4056       coin_save_LIBS="$LIBS"
    4057       LIBS="-lcomplib.sgimath $LIBS"
    4058       AC_COIN_TRY_FLINK([daxpy],
    4059                         [use_blas="-lcomplib.sgimath"
    4060                          if test $coin_need_flibs = yes ; then
    4061                            use_blas="$use_blas $FLIBS"
    4062                          fi
    4063                          AC_MSG_RESULT([yes: $use_blas])
    4064                         ],
    4065                         [AC_MSG_RESULT([no])])
    4066       LIBS="$coin_save_LIBS"
    4067       ;;
    4068 
    4069 # Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio
    4070 # cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't
    4071 # recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims
    4072 # that CC and cc will understand -library in Studio 13. The main extra
    4073 # function of -xlic_lib and -library is to arrange for the Fortran run-time
    4074 # libraries to be linked for C++ and C. We can arrange that explicitly.
    4075     *-*-solaris*)
    4076       AC_MSG_CHECKING([for BLAS in libsunperf])
    4077       coin_need_flibs=no
    4078       coin_save_LIBS="$LIBS"
    4079       LIBS="-lsunperf $FLIBS $LIBS"
    4080       AC_COIN_TRY_FLINK([daxpy],
    4081                         [use_blas='-lsunperf'
    4082                          if test $coin_need_flibs = yes ; then
    4083                            use_blas="$use_blas $FLIBS"
    4084                          fi
    4085                          AC_MSG_RESULT([yes: $use_blas])
    4086                         ],
    4087                         [AC_MSG_RESULT([no])])
    4088       LIBS="$coin_save_LIBS"
    4089       ;;
    4090      
    4091     *-cygwin* | *-mingw*)
    4092       case "$CC" in
    4093         clang* ) ;;
    4094         cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    4095           coin_save_LIBS="$LIBS"
    4096           AC_MSG_CHECKING([for BLAS in MKL (32bit)])
    4097           LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS"
    4098           AC_COIN_TRY_FLINK([daxpy],
    4099                             [use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib'
    4100                              AC_MSG_RESULT([yes: $use_blas])
    4101                             ],
    4102                             [AC_MSG_RESULT([no])])
    4103           LIBS="$coin_save_LIBS"
    4104          
    4105           if test "x$use_blas" = x ; then
    4106             AC_MSG_CHECKING([for BLAS in MKL (64bit)])
    4107             LIBS="mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib $LIBS"
    4108             AC_COIN_TRY_FLINK([daxpy],
    4109                               [use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib'
    4110                                AC_MSG_RESULT([yes: $use_blas])
    4111                               ],
    4112                               [AC_MSG_RESULT([no])])
    4113             LIBS="$coin_save_LIBS"
    4114           fi
    4115           ;;
    4116       esac
    4117       ;;
    4118      
    4119      *-darwin*)
    4120       AC_MSG_CHECKING([for BLAS in Veclib])
    4121       coin_need_flibs=no
    4122       coin_save_LIBS="$LIBS"
    4123       LIBS="-framework vecLib $LIBS"
    4124       AC_COIN_TRY_FLINK([daxpy],
    4125                         [use_blas='-framework vecLib'
    4126                          if test $coin_need_flibs = yes ; then
    4127                            use_blas="$use_blas $FLIBS"
    4128                          fi
    4129                          AC_MSG_RESULT([yes: $use_blas])
    4130                         ],
    4131                         [AC_MSG_RESULT([no])])
    4132       LIBS="$coin_save_LIBS"
    4133       ;;
    4134   esac
    4135 
    4136   if test -z "$use_blas" ; then
    4137     AC_MSG_CHECKING([whether -lblas has BLAS])
    4138     coin_need_flibs=no
    4139     coin_save_LIBS="$LIBS"
    4140     LIBS="-lblas $LIBS"
    4141     AC_COIN_TRY_FLINK([daxpy],
    4142                       [use_blas='-lblas'
    4143                        if test $coin_need_flibs = yes ; then
    4144                          use_blas="$use_blas $FLIBS"
    4145                        fi
    4146                        AC_MSG_RESULT([yes: $use_blas])
    4147                       ],
    4148                       [AC_MSG_RESULT([no])])
    4149     LIBS="$coin_save_LIBS"
    4150   fi
    4151 
    4152   # If we have no other ideas, consider building BLAS.
    4153   if test -z "$use_blas" ; then
    4154     use_blas=BUILD
    4155   fi
    4156 fi
    4157 
    4158 if test "x$use_blas" = xBUILD ; then
    4159   AC_COIN_CHECK_PACKAGE(Blas, [coinblas], [$1])
    4160  
    4161 elif test "x$use_blas" != x && test "$use_blas" != no; then
    4162   coin_has_blas=yes
    4163   AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 0])
    4164   AC_DEFINE([COIN_HAS_BLAS],[1], [If defined, the BLAS Library is available.])
    4165   BLAS_LIBS="$use_blas"
    4166   BLAS_CFLAGS=
    4167   BLAS_DATA=
    4168   AC_SUBST(BLAS_LIBS)
    4169   AC_SUBST(BLAS_CFLAGS)
    4170   AC_SUBST(BLAS_DATA)
    4171   coin_foreach_w([myvar], [$1], [
    4172     m4_toupper(myvar)_PCLIBS="$BLAS_LIBS $m4_toupper(myvar)_PCLIBS"
    4173     m4_toupper(myvar)_LIBS="$BLAS_LIBS $m4_toupper(myvar)_LIBS"
    4174     m4_toupper(myvar)_LIBS_INSTALLED="$BLAS_LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
    4175   ])
    4176  
    4177 else
    4178   coin_has_blas=no
    4179   AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 1])
    4180 fi
    4181 
    4182 coin_foreach_w([myvar], [$1], [
    4183   AC_SUBST(m4_toupper(myvar)_PCLIBS)
    4184   AC_SUBST(m4_toupper(myvar)_LIBS)
    4185   AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
    4186 ])
    4187 
    4188 ]) # AC_COIN_CHECK_PACKAGE_BLAS
    4189 
    4190 ###########################################################################
    4191 #                       COIN_CHECK_PACKAGE_LAPACK                         #
    4192 ###########################################################################
    4193 
    4194 # This macro checks for a library containing the LAPACK library.  It
    4195 # 1. checks the --with-lapack argument
    4196 # 2. if --with-lapack=BUILD has been specified goes to point 5
    4197 # 3. if --with-lapack has been specified to a working library, sets
    4198 #    LAPACK_LIBS to its value
    4199 # 4. tries standard libraries
    4200 # 5. calls COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]) to check for
    4201 #    ThirdParty/Lapack
    4202 # The makefile conditional and preprocessor macro COIN_HAS_LAPACK is defined.
    4203 # LAPACK_LIBS is set to the flags required to link with a Lapack library.
    4204 # For each build target X in $1, X_LIBS is extended with $LAPACK_LIBS.
    4205 # In case 3 and 4, the flags to link to Lapack are added to X_PCLIBS too.
    4206 # In case 5, Lapack is added to X_PCREQUIRES.
    4207 #
    4208 # TODO: Lapack usually depends on Blas, so if we check for a system lapack library,
    4209 #   shouldn't we include AC_COIN_CHECK_PACKAGE_BLAS first?
    4210 #   However, if we look for coinlapack via AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]),
    4211 #   then we will get Blas as dependency of coinlapack.
    4212 
    4213 AC_DEFUN([AC_COIN_CHECK_PACKAGE_LAPACK],
    4214 [
    4215 AC_ARG_WITH([lapack],
    4216             AC_HELP_STRING([--with-lapack],
    4217                            [specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack)]),
    4218             [use_lapack=$withval], [use_lapack=])
    4219 
    4220 #if user specified --with-lapack-lib, then we should give COIN_HAS_PACKAGE preference
    4221 AC_ARG_WITH([lapack-lib],,[use_lapack=BUILD])
    4222 
    4223 # Check if user supplied option makes sense
    4224 if test x"$use_lapack" != x; then
    4225   if test "$use_lapack" = "BUILD"; then
    4226     # we come to this later
    4227     :
    4228   elif test "$use_lapack" != no; then
    4229     AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
    4230     coin_need_flibs=no
    4231     use_lapack="$use_lapack $BLAS_LIBS"
    4232     coin_save_LIBS="$LIBS"
    4233     LIBS="$use_lapack $LIBS"
    4234     AC_COIN_TRY_FLINK([dsyev],
    4235                       [if test $coin_need_flibs = yes ; then
    4236                          use_lapack="$use_lapack $FLIBS"
    4237                        fi
    4238                        AC_MSG_RESULT([yes: $use_lapack])
    4239                       ],
    4240                       [AC_MSG_RESULT([no])
    4241                        AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
    4242     LIBS="$coin_save_LIBS"
    4243   fi
    4244 else
    4245   if test x$coin_has_blas = xyes; then
    4246     # First try to see if LAPACK is already available with BLAS library
    4247     AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
    4248     coin_save_LIBS="$LIBS"
    4249     coin_need_flibs=no
    4250     LIBS="$BLAS_LIBS $LIBS"
    4251     AC_COIN_TRY_FLINK([dsyev],
    4252                       [use_lapack="$BLAS_LIBS"
    4253                        if test $coin_need_flibs = yes ; then
    4254                          use_lapack="$use_lapack $FLIBS"
    4255                        fi
    4256                        AC_MSG_RESULT([yes: $use_lapack])
    4257                       ],
    4258                       [AC_MSG_RESULT([no])])
    4259     LIBS="$coin_save_LIBS"
    4260   fi
    4261   if test -z "$use_lapack"; then
    4262     # Try to autodetect the library for lapack based on build system
    4263     case $build in
    4264       # TODO: Is this check actually needed here, since -lcomplib.sigmath should have been recognized as Blas library,
    4265       #       and above it is checked whether the Blas library already contains Lapack
    4266       *-sgi-*)
    4267         AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
    4268         coin_save_LIBS="$LIBS"
    4269         coin_need_flibs=no
    4270         LIBS="-lcomplib.sgimath $BLAS_LIBS $LIBS"
    4271         AC_COIN_TRY_FLINK([dsyev],
    4272                           [use_lapack="-lcomplib.sgimath $BLAS_LIBS"
    4273                            if test $coin_need_flibs = yes ; then
    4274                              use_lapack="$use_lapack $FLIBS"
    4275                            fi
    4276                            AC_MSG_RESULT([yes: $use_lapack])
    4277                           ],
    4278                           [AC_MSG_RESULT([no])])
    4279         LIBS="$coin_save_LIBS"
    4280         ;;
    4281 
    4282       # See comments in COIN_CHECK_PACKAGE_BLAS.
    4283       # TODO: Is this check actually needed here, since -lsunperf should have been recognized as Blas library,
    4284       #       and above it is checked whether the Blas library already contains Lapack
    4285       *-*-solaris*)
    4286         AC_MSG_CHECKING([for LAPACK in libsunperf])
    4287         coin_need_flibs=no
    4288         coin_save_LIBS="$LIBS"
    4289         LIBS="-lsunperf $BLAS_LIBS $FLIBS $LIBS"
    4290         AC_COIN_TRY_FLINK([dsyev],
    4291                           [use_lapack='-lsunperf $BLAS_LIBS'
    4292                            if test $coin_need_flibs = yes ; then
    4293                              use_lapack="$use_lapack $FLIBS"
    4294                            fi
    4295                            AC_MSG_RESULT([yes: $use_lapack])
    4296                           ],
    4297                           [AC_MSG_RESULT([no])])
    4298         LIBS="$coin_save_LIBS"
    4299         ;;
    4300         # On cygwin, do this check only if doscompile is disabled. The prebuilt library
    4301         # will want to link with cygwin, hence won't run standalone in DOS.
    4302     esac
    4303   fi
    4304 
    4305   if test -z "$use_lapack" ; then
    4306     AC_MSG_CHECKING([whether -llapack has LAPACK])
    4307     coin_need_flibs=no
    4308     coin_save_LIBS="$LIBS"
    4309     LIBS="-llapack $BLAS_LIBS $LIBS"
    4310     AC_COIN_TRY_FLINK([dsyev],
    4311                       [use_lapack='-llapack'
    4312                        if test $coin_need_flibs = yes ; then
    4313                          use_lapack="$use_lapack $FLIBS"
    4314                        fi
    4315                        AC_MSG_RESULT([yes: $use_lapack])
    4316                       ],
    4317                       [AC_MSG_RESULT([no])])
    4318     LIBS="$coin_save_LIBS"
    4319   fi
    4320 
    4321   # If we have no other ideas, consider building LAPACK.
    4322   if test -z "$use_lapack" ; then
    4323     use_lapack=BUILD
    4324   fi
    4325 fi
    4326 
    4327 if test "x$use_lapack" = xBUILD ; then
    4328   AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1])
    4329 
    4330 elif test "x$use_lapack" != x && test "$use_lapack" != no; then
    4331   coin_has_lapack=yes
    4332   AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 0])
    4333   AC_DEFINE([COIN_HAS_LAPACK],[1], [If defined, the LAPACK Library is available.])
    4334   LAPACK_LIBS="$use_lapack"
    4335   LAPACK_CFLAGS=
    4336   LAPACK_DATA=
    4337   AC_SUBST(LAPACK_LIBS)
    4338   AC_SUBST(LAPACK_CFLAGS)
    4339   AC_SUBST(LAPACK_DATA)
    4340   coin_foreach_w([myvar], [$1], [
    4341     m4_toupper(myvar)_PCLIBS="$LAPACK_LIBS $m4_toupper(myvar)_PCLIBS"
    4342     m4_toupper(myvar)_LIBS="$LAPACK_LIBS $m4_toupper(myvar)_LIBS"
    4343     m4_toupper(myvar)_LIBS_INSTALLED="$LAPACK_LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
    4344   ])
    4345  
    4346 else
    4347   coin_has_lapack=no
    4348   AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 1])
    4349 fi
    4350 
    4351 coin_foreach_w([myvar], [$1], [
    4352   AC_SUBST(m4_toupper(myvar)_PCLIBS)
    4353   AC_SUBST(m4_toupper(myvar)_LIBS)
    4354   AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
    4355 ])
    4356 
    4357 ]) # AC_COIN_CHECK_PACKAGE_LAPACK
Note: See TracChangeset for help on using the changeset viewer.