source: branches/autotools-update/coin.m4 @ 2578

Last change on this file since 2578 was 2578, checked in by stefan, 7 years ago

revert r2553

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