source: stable/0.7/coin.m4 @ 3110

Last change on this file since 3110 was 3110, checked in by tkr, 8 years ago

No longer disabling shared libraries with gcc on Windows

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